allow provision demo image to be user-selected

This replaces CONFIG_PROVISION_CIRROS_URL with a set of configuration
options that permit a deployer to specify the image url, image name, and
username to use when connecting:

  CONFIG_PROVISION_IMAGE_URL
  CONFIG_PROVISION_IMAGE_NAME
  CONFIG_PROVISION_IMAGE_FORMAT
  CONFIG_PROVISION_IMAGE_SSH_USER

Resolves: rhbz#982035
Change-Id: Id6db5ea551465a6dbf94890e2fc895d255c5bd8e
This commit is contained in:
Lars Kellogg-Stedman 2015-03-18 13:34:04 -04:00 committed by Javier Pena
parent 8157722953
commit f7dfb9755f
5 changed files with 77 additions and 21 deletions

View File

@ -825,8 +825,17 @@ Provisioning demo config
**CONFIG_PROVISION_DEMO_FLOATRANGE**
CIDR network address for the floating IP subnet.
**CONFIG_PROVISION_CIRROS_URL**
A URL or local file location for the Cirros demo image (provided as an initial image in the Image service).
**CONFIG_PROVISION_IMAGE_URL**
A URL or local file location for an image to download and provision in Glance (defaults to a URL for a recent "cirros" image).
**CONFIG_PROVISION_IMAGE_NAME**
The name to be assigned to the demo image in Glance (default "cirros").
**CONFIG_PROVISION_IMAGE_FORMAT**
Format for the demo image (default "qcow2").
**CONFIG_PROVISION_IMAGE_SSH_USER**
User to use when connecting to instances booted from the demo image.
Provisioning tempest config
---------------------------

View File

@ -29,9 +29,12 @@ from packstack.modules.ospluginutils import getManifestTemplate
PLUGIN_NAME = "OS-Provision"
PLUGIN_NAME_COLORED = utils.color_text(PLUGIN_NAME, 'blue')
DEMO_CIRRUS_URL = (
DEMO_IMAGE_NAME = 'cirros'
DEMO_IMAGE_URL = (
'http://download.cirros-cloud.net/0.3.3/cirros-0.3.3-x86_64-disk.img'
)
DEMO_IMAGE_SSH_USER = 'cirros'
DEMO_IMAGE_FORMAT = 'qcow2'
def initConfig(controller):
@ -87,17 +90,58 @@ def initConfig(controller):
"NEED_CONFIRM": False,
"CONDITION": False},
{"CMD_OPTION": "provision-cirros-url",
"USAGE": "A URL or local file location for the Cirros demo image "
"used for Glance",
"PROMPT": "Enter the URL or local file location for the Cirros "
"image",
{"CMD_OPTION": "provision-image-name",
"USAGE": "A named to be used for the demo image in Glance",
"PROMPT": "Enter the name to be assigned to the demo image",
"OPTION_LIST": False,
"VALIDATORS": [validators.validate_not_empty],
"DEFAULT_VALUE": DEMO_CIRRUS_URL,
"DEFAULT_VALUE": DEMO_IMAGE_NAME,
"MASK_INPUT": False,
"LOOSE_VALIDATION": True,
"CONF_NAME": "CONFIG_PROVISION_CIRROS_URL",
"CONF_NAME": "CONFIG_PROVISION_IMAGE_NAME",
"USE_DEFAULT": False,
"NEED_CONFIRM": False,
"CONDITION": False},
{"CMD_OPTION": "provision-image-url",
"USAGE": ("A URL or local file location for an image "
"to be loaded into Glance"),
"PROMPT": ("Enter the location of an image to be loaded "
"into Glance"),
"OPTION_LIST": False,
"VALIDATORS": [validators.validate_not_empty],
"DEFAULT_VALUE": DEMO_IMAGE_URL,
"MASK_INPUT": False,
"LOOSE_VALIDATION": True,
"CONF_NAME": "CONFIG_PROVISION_IMAGE_URL",
"USE_DEFAULT": False,
"NEED_CONFIRM": False,
"CONDITION": False},
{"CMD_OPTION": "provision-image-format",
"USAGE": ("Disk format (qcow2, raw, etc) of demo image"),
"PROMPT": ("Enter the format of the demo image"),
"OPTION_LIST": False,
"VALIDATORS": [validators.validate_not_empty],
"DEFAULT_VALUE": DEMO_IMAGE_FORMAT,
"MASK_INPUT": False,
"LOOSE_VALIDATION": True,
"CONF_NAME": "CONFIG_PROVISION_IMAGE_FORMAT",
"USE_DEFAULT": False,
"NEED_CONFIRM": False,
"CONDITION": False},
{"CMD_OPTION": "provision-image-ssh-user",
"USAGE": ("Name of a user to use when connecting via ssh to "
"instances booted from the demo image"),
"PROMPT": ("Enter the name of a user to use when connecting "
"to the demo image via ssh"),
"OPTION_LIST": False,
"VALIDATORS": [validators.validate_not_empty],
"DEFAULT_VALUE": DEMO_IMAGE_SSH_USER,
"MASK_INPUT": False,
"LOOSE_VALIDATION": True,
"CONF_NAME": "CONFIG_PROVISION_IMAGE_SSH_USER",
"USE_DEFAULT": False,
"NEED_CONFIRM": False,
"CONDITION": False},

View File

@ -1,14 +1,15 @@
## Images
## Glance
$image_name = 'cirros'
$image_source = hiera('CONFIG_PROVISION_CIRROS_URL')
$image_ssh_user = 'cirros'
$image_name = hiera('CONFIG_PROVISION_IMAGE_NAME')
$image_source = hiera('CONFIG_PROVISION_IMAGE_URL')
$image_ssh_user = hiera('CONFIG_PROVISION_IMAGE_SSH_USER')
$image_format = hiera('CONFIG_PROVISION_IMAGE_FORMAT')
glance_image { $image_name:
ensure => present,
is_public => 'yes',
container_format => 'bare',
disk_format => 'qcow2',
disk_format => $image_format,
source => $image_source,
}

View File

@ -20,9 +20,10 @@ if $provision_tempest_user != '' {
$admin_tenant_name = 'admin'
## Glance
$image_name = 'cirros'
$image_source = hiera('CONFIG_PROVISION_CIRROS_URL')
$image_ssh_user = 'cirros'
$image_name = hiera('CONFIG_PROVISION_IMAGE_NAME')
$image_source = hiera('CONFIG_PROVISION_IMAGE_URL')
$image_ssh_user = hiera('CONFIG_PROVISION_IMAGE_SSH_USER')
$image_format = hiera('CONFIG_PROVISION_IMAGE_FORMAT')
## Neutron
$public_network_name = 'public'

View File

@ -1,8 +1,9 @@
## Glance
$image_name = 'cirros'
$image_source = hiera('CONFIG_PROVISION_CIRROS_URL')
$image_ssh_user = 'cirros'
$image_name = hiera('CONFIG_PROVISION_IMAGE_NAME')
$image_source = hiera('CONFIG_PROVISION_IMAGE_URL')
$image_ssh_user = hiera('CONFIG_PROVISION_IMAGE_SSH_USER')
$image_format = hiera('CONFIG_PROVISION_IMAGE_FORMAT')
## Tempest
@ -15,7 +16,7 @@
ensure => present,
is_public => 'yes',
container_format => 'bare',
disk_format => 'qcow2',
disk_format => $image_format,
source => $image_source,
}