Add support for alternate images
Tempest runs can utilise two distinct images in glance. This patch adds the option for a user to specify a second name to be used with the current image_source, or a second name in addition to a second image_source_alt. Change-Id: I8b7d3b77f07d39ee5944e00b47e7ab1af67f7be7
This commit is contained in:
parent
050fa67b23
commit
0f053d68bc
|
@ -66,6 +66,11 @@ class openstack::provision(
|
|||
|
||||
## Tempest
|
||||
$configure_tempest = false,
|
||||
|
||||
$image_name_alt = false,
|
||||
$image_source_alt = false,
|
||||
$image_ssh_user_alt = false,
|
||||
|
||||
$identity_uri = undef,
|
||||
$tempest_repo_uri = 'git://github.com/openstack/tempest.git',
|
||||
$tempest_repo_revision = undef,
|
||||
|
@ -118,6 +123,37 @@ class openstack::provision(
|
|||
source => $image_source,
|
||||
}
|
||||
|
||||
# Support creation of a second glance image
|
||||
# distinct from the first, for tempest. It
|
||||
# doesn't need to be a different image, just
|
||||
# have a different name and ref in glance.
|
||||
if $image_name_alt {
|
||||
$image_name_alt_real = $image_name_alt
|
||||
if ! $image_source_alt {
|
||||
# Use the same source by default
|
||||
$image_source_alt_real = $image_source
|
||||
} else {
|
||||
$image_source_alt_real = $image_source_alt
|
||||
}
|
||||
|
||||
if ! $image_ssh_user_alt {
|
||||
# Use the same user by default
|
||||
$image_alt_ssh_user_real = $image_ssh_user
|
||||
} else {
|
||||
$image_alt_ssh_user_real = $image_ssh_user_alt
|
||||
}
|
||||
|
||||
glance_image { $image_name_alt:
|
||||
ensure => present,
|
||||
is_public => 'yes',
|
||||
container_format => 'bare',
|
||||
disk_format => 'qcow2',
|
||||
source => $image_source_alt_real,
|
||||
}
|
||||
} else {
|
||||
$image_name_alt_real = $image_name
|
||||
}
|
||||
|
||||
## Neutron
|
||||
|
||||
if $neutron_available {
|
||||
|
@ -186,9 +222,9 @@ class openstack::provision(
|
|||
setup_venv => $setup_venv,
|
||||
tempest_repo_revision => $tempest_repo_revision,
|
||||
image_name => $image_name,
|
||||
image_name_alt => $image_name,
|
||||
image_name_alt => $image_name_alt_real,
|
||||
image_ssh_user => $image_ssh_user,
|
||||
image_alt_ssh_user => $image_ssh_user,
|
||||
image_alt_ssh_user => $image_alt_ssh_user_real,
|
||||
identity_uri => $identity_uri,
|
||||
username => $username,
|
||||
password => $password,
|
||||
|
|
|
@ -8,6 +8,52 @@ describe 'openstack::provision' do
|
|||
}
|
||||
end
|
||||
|
||||
describe 'creates a glance image and an alt' do
|
||||
let :params do
|
||||
{
|
||||
:image_name => 'cirros',
|
||||
:image_source => 'http://download.cirros-cloud.net/0.3.1/cirros-0.3.1-x86_64-disk.img',
|
||||
:image_name_alt => 'cirros2',
|
||||
}
|
||||
end
|
||||
|
||||
it { should contain_glance_image(params[:image_name_alt]).with(
|
||||
:ensure => 'present',
|
||||
:is_public => 'yes',
|
||||
:container_format => 'bare',
|
||||
:disk_format => 'qcow2',
|
||||
:source => params[:image_source]
|
||||
)
|
||||
}
|
||||
|
||||
it { should contain_glance_image(params[:image_name]).with(
|
||||
:ensure => 'present',
|
||||
:is_public => 'yes',
|
||||
:container_format => 'bare',
|
||||
:disk_format => 'qcow2',
|
||||
:source => params[:image_source]
|
||||
)
|
||||
}
|
||||
end
|
||||
|
||||
describe 'creates a glance image' do
|
||||
let :params do
|
||||
{
|
||||
:image_name => 'cirros',
|
||||
:image_source => 'http://download.cirros-cloud.net/0.3.1/cirros-0.3.1-x86_64-disk.img',
|
||||
}
|
||||
end
|
||||
|
||||
it { should contain_glance_image(params[:image_name]).with(
|
||||
:ensure => 'present',
|
||||
:is_public => 'yes',
|
||||
:container_format => 'bare',
|
||||
:disk_format => 'qcow2',
|
||||
:source => params[:image_source]
|
||||
)
|
||||
}
|
||||
end
|
||||
|
||||
describe 'should be possible to override resize_available' do
|
||||
let :params do
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue