From 11b281071a1eb379fa63953246e6436f1cb9fe83 Mon Sep 17 00:00:00 2001 From: Alfredo Moralejo Date: Fri, 27 May 2016 08:37:31 -0400 Subject: [PATCH] Added uec images for tempest tests When running instances on qemu emulated images in packstack gate we usually hit https://bugs.launchpad.net/cirros/+bug/1312199 and jobs fails. This patch adds glance UEC images (AKI, ARI and AMI) when tempest deployment is enabled and configure those images in tempest config file. UEC image name an URLs can be configured with parameters: * CONFIG_PROVISION_UEC_IMAGE_NAME * CONFIG_PROVISION_UEC_IMAGE_KERNEL_URL * CONFIG_PROVISION_UEC_IMAGE_RAMDISK_URL * CONFIG_PROVISION_UEC_IMAGE_DISK_URL Change-Id: I316e34d85a2e1a2799b7cbf11e7fa3635a81887a --- docs/packstack.rst | 12 ++++ packstack/plugins/provision_700.py | 61 +++++++++++++++++++ .../puppet/templates/provision_glance.pp | 52 +++++++++++++--- .../puppet/templates/provision_tempest.pp | 6 +- .../create-uec-image-70073744430d1538.yaml | 13 ++++ 5 files changed, 133 insertions(+), 11 deletions(-) create mode 100644 releasenotes/notes/create-uec-image-70073744430d1538.yaml diff --git a/docs/packstack.rst b/docs/packstack.rst index 85d961951..6c9556865 100644 --- a/docs/packstack.rst +++ b/docs/packstack.rst @@ -1025,6 +1025,18 @@ Provisioning tempest config **CONFIG_RUN_TEMPEST_TESTS** Test suites to run, example: "smoke dashboard TelemetryAlarming". Optional, defaults to "smoke". +**CONFIG_PROVISION_UEC_IMAGE_NAME** + Name of the uec image created in Glance used in tempest tests (default "cirros-uec"). + +**CONFIG_PROVISION_UEC_IMAGE_KERNEL_URL** + URL of the kernel image copied to Glance image for uec image (defaults to a URL for a recent "cirros" uec image). + +**CONFIG_PROVISION_UEC_IMAGE_RAMDISK_URL** + URL of the ramdisk image copied to Glance image for uec image (defaults to a URL for a recent "cirros" uec image). + +**CONFIG_PROVISION_UEC_IMAGE_DISK_URL** + URL of the disk image copied to Glance image for uec image (defaults to a URL for a recent "cirros" uec image). + Provisioning all-in-one ovs bridge config ----------------------------------------- diff --git a/packstack/plugins/provision_700.py b/packstack/plugins/provision_700.py index 6161ff886..be56562db 100644 --- a/packstack/plugins/provision_700.py +++ b/packstack/plugins/provision_700.py @@ -36,6 +36,16 @@ DEMO_IMAGE_URL = ( ) DEMO_IMAGE_SSH_USER = 'cirros' DEMO_IMAGE_FORMAT = 'qcow2' +UEC_IMAGE_NAME = 'cirros-uec' +UEC_IMAGE_KERNEL_URL = ( + 'http://download.cirros-cloud.net/0.3.4/cirros-0.3.4-x86_64-kernel' +) +UEC_IMAGE_RAMDISK_URL = ( + 'http://download.cirros-cloud.net/0.3.4/cirros-0.3.4-x86_64-initramfs' +) +UEC_IMAGE_DISK_URL = ( + 'http://download.cirros-cloud.net/0.3.4/cirros-0.3.4-x86_64-disk.img' +) def initConfig(controller): @@ -139,6 +149,57 @@ def initConfig(controller): "USE_DEFAULT": False, "NEED_CONFIRM": False, "CONDITION": False}, + + {"CMD_OPTION": "provision-uec-image-name", + "PROMPT": "Enter the name to be assigned to the uec image used for tempest", + "OPTION_LIST": False, + "VALIDATORS": [validators.validate_not_empty], + "DEFAULT_VALUE": UEC_IMAGE_NAME, + "MASK_INPUT": False, + "LOOSE_VALIDATION": True, + "CONF_NAME": "CONFIG_PROVISION_UEC_IMAGE_NAME", + "USE_DEFAULT": False, + "NEED_CONFIRM": False, + "CONDITION": False}, + + {"CMD_OPTION": "provision-uec-kernel-url", + "PROMPT": ("Enter the location of a uec kernel to be loaded " + "into Glance"), + "OPTION_LIST": False, + "VALIDATORS": [validators.validate_not_empty], + "DEFAULT_VALUE": UEC_IMAGE_KERNEL_URL, + "MASK_INPUT": False, + "LOOSE_VALIDATION": True, + "CONF_NAME": "CONFIG_PROVISION_UEC_IMAGE_KERNEL_URL", + "USE_DEFAULT": False, + "NEED_CONFIRM": False, + "CONDITION": False}, + + {"CMD_OPTION": "provision-uec-ramdisk-url", + "PROMPT": ("Enter the location of a uec ramdisk to be loaded " + "into Glance"), + "OPTION_LIST": False, + "VALIDATORS": [validators.validate_not_empty], + "DEFAULT_VALUE": UEC_IMAGE_RAMDISK_URL, + "MASK_INPUT": False, + "LOOSE_VALIDATION": True, + "CONF_NAME": "CONFIG_PROVISION_UEC_IMAGE_RAMDISK_URL", + "USE_DEFAULT": False, + "NEED_CONFIRM": False, + "CONDITION": False}, + + {"CMD_OPTION": "provision-uec-disk-url", + "PROMPT": ("Enter the location of a uec disk image to be loaded " + "into Glance"), + "OPTION_LIST": False, + "VALIDATORS": [validators.validate_not_empty], + "DEFAULT_VALUE": UEC_IMAGE_DISK_URL, + "MASK_INPUT": False, + "LOOSE_VALIDATION": True, + "CONF_NAME": "CONFIG_PROVISION_UEC_IMAGE_DISK_URL", + "USE_DEFAULT": False, + "NEED_CONFIRM": False, + "CONDITION": False}, ], "PROVISION_TEMPEST": [ diff --git a/packstack/puppet/templates/provision_glance.pp b/packstack/puppet/templates/provision_glance.pp index 643f75a89..72699be19 100644 --- a/packstack/puppet/templates/provision_glance.pp +++ b/packstack/puppet/templates/provision_glance.pp @@ -1,6 +1,10 @@ -$image_name = hiera('CONFIG_PROVISION_IMAGE_NAME') -$image_source = hiera('CONFIG_PROVISION_IMAGE_URL') -$image_format = hiera('CONFIG_PROVISION_IMAGE_FORMAT') +$image_name = hiera('CONFIG_PROVISION_IMAGE_NAME') +$image_source = hiera('CONFIG_PROVISION_IMAGE_URL') +$image_format = hiera('CONFIG_PROVISION_IMAGE_FORMAT') +$uec_image_name = hiera('CONFIG_PROVISION_UEC_IMAGE_NAME') +$uec_image_source_kernel = hiera('CONFIG_PROVISION_UEC_IMAGE_KERNEL_URL') +$uec_image_source_ramdisk = hiera('CONFIG_PROVISION_UEC_IMAGE_RAMDISK_URL') +$uec_image_source_disk = hiera('CONFIG_PROVISION_UEC_IMAGE_DISK_URL') glance_image { $image_name: ensure => present, @@ -11,12 +15,44 @@ glance_image { $image_name: } if str2bool(hiera('CONFIG_PROVISION_TEMPEST')) { - $image_name_alt = "${image_name}_alt" - glance_image { $image_name_alt: + $image_name_alt = "${uec_image_name}_alt" + + glance_image{"${uec_image_name}-kernel": ensure => present, is_public => 'yes', - container_format => 'bare', - disk_format => $image_format, - source => $image_source, + container_format => 'aki', + disk_format => 'aki', + source => $uec_image_source_kernel, + id => '146d4a6b-ad1e-4d9f-8b08-98eae3c3dab4' } + + glance_image{"${uec_image_name}-ramdisk": + ensure => present, + is_public => 'yes', + container_format => 'ari', + disk_format => 'ari', + source => $uec_image_source_ramdisk, + id => '0b50e2e5-1440-4654-b568-4e120ddf28c1' + } + + glance_image{$uec_image_name: + ensure => present, + is_public => 'yes', + container_format => 'ami', + disk_format => 'ami', + source => $uec_image_source_disk, + properties => { 'kernel_id' => '146d4a6b-ad1e-4d9f-8b08-98eae3c3dab4', 'ramdisk_id' => '0b50e2e5-1440-4654-b568-4e120ddf28c1' }, + require => [ Glance_image["${uec_image_name}-kernel"], Glance_image["${uec_image_name}-ramdisk"] ] + } + + glance_image{$image_name_alt: + ensure => present, + is_public => 'yes', + container_format => 'ami', + disk_format => 'ami', + source => $uec_image_source_disk, + properties => { 'kernel_id' => '146d4a6b-ad1e-4d9f-8b08-98eae3c3dab4', 'ramdisk_id' => '0b50e2e5-1440-4654-b568-4e120ddf28c1' }, + require => [ Glance_image["${uec_image_name}-kernel"], Glance_image["${uec_image_name}-ramdisk"] ] + } + } diff --git a/packstack/puppet/templates/provision_tempest.pp b/packstack/puppet/templates/provision_tempest.pp index f3debeae6..40e1b1797 100644 --- a/packstack/puppet/templates/provision_tempest.pp +++ b/packstack/puppet/templates/provision_tempest.pp @@ -25,9 +25,9 @@ $configure_images = true $configure_networks = true # Image -$image_name = hiera('CONFIG_PROVISION_IMAGE_NAME') +$uec_image_name = hiera('CONFIG_PROVISION_UEC_IMAGE_NAME') $image_ssh_user = hiera('CONFIG_PROVISION_IMAGE_SSH_USER') -$image_name_alt = "${image_name}_alt" +$image_name_alt = "${uec_image_name}_alt" $image_alt_ssh_user = hiera('CONFIG_PROVISION_IMAGE_SSH_USER') $image_source = hiera('CONFIG_PROVISION_IMAGE_URL') $image_format = hiera('CONFIG_PROVISION_IMAGE_FORMAT') @@ -110,7 +110,7 @@ class { '::tempest': identity_uri_v3 => $identity_uri_v3, image_alt_ssh_user => $image_alt_ssh_user, image_name_alt => $image_name_alt, - image_name => $image_name, + image_name => $uec_image_name, image_ssh_user => $image_ssh_user, log_file => $log_file, neutron_available => $neutron_available, diff --git a/releasenotes/notes/create-uec-image-70073744430d1538.yaml b/releasenotes/notes/create-uec-image-70073744430d1538.yaml new file mode 100644 index 000000000..f65faa5bc --- /dev/null +++ b/releasenotes/notes/create-uec-image-70073744430d1538.yaml @@ -0,0 +1,13 @@ +--- +features: + - | + When tempest provisioning is enabled, three glance images + following uec schema (AKI,ARI,AMI) are created. These + images are used for tempest tests. This is done for issue + in https://bugs.launchpad.net/cirros/+bug/1312199 + Image name and URLs to download images can be modified + with parameters: + * CONFIG_PROVISION_UEC_IMAGE_NAME + * CONFIG_PROVISION_UEC_IMAGE_KERNEL_URL + * CONFIG_PROVISION_UEC_IMAGE_RAMDISK_URL + * CONFIG_PROVISION_UEC_IMAGE_DISK_URL