diff --git a/manifests/compute/rbd.pp b/manifests/compute/rbd.pp index 3f86f9625..bf4be970d 100644 --- a/manifests/compute/rbd.pp +++ b/manifests/compute/rbd.pp @@ -30,6 +30,23 @@ # (optional) The path to the ceph configuration file to use. # Defaults to '/etc/ceph/ceph.conf'. # +# [*libvirt_images_rbd_glance_store_name*] +# (optional) Name of the Glance store that represents the local rbd cluster. +# If set, this will allow Nova to request that Glance copy an image from +# an existing non-local store into the one named by this option before +# booting so that proper Copy-on-Write behavior is maintained. +# Defaults to $::os_service_default. +# +# [*libvirt_images_rbd_glance_copy_poll_interval*] +# (optional) The interval in seconds with which to poll Glance after asking +# for it to copy an image to the local rbd store. +# Defaults to $::os_service_default. +# +# [*libvirt_images_rbd_glance_copy_timeout*] +# (optional) The overall maximum time we will wait for Glance to complete +# an image copy to our local rbd store. +# Defaults to $::os_service_default. +# # [*libvirt_rbd_user*] # (Required) The RADOS client name for accessing rbd volumes. # @@ -62,16 +79,20 @@ # (optional) Ensure value for ceph client package. # Defaults to 'present'. + class nova::compute::rbd ( $libvirt_rbd_user, - $libvirt_rbd_secret_uuid = false, - $libvirt_rbd_secret_key = undef, - $libvirt_images_rbd_pool = 'rbd', - $libvirt_images_rbd_ceph_conf = '/etc/ceph/ceph.conf', - $rbd_keyring = 'client.nova', - $ephemeral_storage = true, - $manage_ceph_client = true, - $ceph_client_ensure = 'present', + $libvirt_rbd_secret_uuid = false, + $libvirt_rbd_secret_key = undef, + $libvirt_images_rbd_pool = 'rbd', + $libvirt_images_rbd_ceph_conf = '/etc/ceph/ceph.conf', + $libvirt_images_rbd_glance_store_name = $::os_service_default, + $libvirt_images_rbd_glance_copy_poll_interval = $::os_service_default, + $libvirt_images_rbd_glance_copy_timeout = $::os_service_default, + $rbd_keyring = 'client.nova', + $ephemeral_storage = true, + $manage_ceph_client = true, + $ceph_client_ensure = 'present', ) { include nova::deps @@ -126,14 +147,21 @@ class nova::compute::rbd ( if $ephemeral_storage { nova_config { - 'libvirt/images_type': value => 'rbd'; - 'libvirt/images_rbd_pool': value => $libvirt_images_rbd_pool; - 'libvirt/images_rbd_ceph_conf': value => $libvirt_images_rbd_ceph_conf; + 'libvirt/images_type': value => 'rbd'; + 'libvirt/images_rbd_pool': value => $libvirt_images_rbd_pool; + 'libvirt/images_rbd_ceph_conf': value => $libvirt_images_rbd_ceph_conf; + 'libvirt/images_rbd_glance_store_name': value => $libvirt_images_rbd_glance_store_name; + 'libvirt/images_rbd_glance_copy_poll_interval': value => $libvirt_images_rbd_glance_copy_poll_interval; + 'libvirt/images_rbd_glance_copy_timeout': value => $libvirt_images_rbd_glance_copy_timeout; + } } else { nova_config { - 'libvirt/images_rbd_pool': ensure => absent; - 'libvirt/images_rbd_ceph_conf': ensure => absent; + 'libvirt/images_rbd_pool': ensure => absent; + 'libvirt/images_rbd_ceph_conf': ensure => absent; + 'libvirt/images_rbd_glance_store_name': ensure => absent; + 'libvirt/images_rbd_glance_copy_poll_interval': ensure => absent; + 'libvirt/images_rbd_glance_copy_timeout': ensure => absent; } } diff --git a/releasenotes/notes/glance_image_copy-b4f888c8f981e6b3.yaml b/releasenotes/notes/glance_image_copy-b4f888c8f981e6b3.yaml new file mode 100644 index 000000000..3c5c01ef2 --- /dev/null +++ b/releasenotes/notes/glance_image_copy-b4f888c8f981e6b3.yaml @@ -0,0 +1,8 @@ +--- +features: + - | + Add parameters for Nova/Glance image copy when using multiple RBD Glance stores. + + - ``nova::compute::rbd::libvirt_images_rbd_glance_store_name`` + - ``nova::compute::rbd::libvirt_images_rbd_glance_copy_poll_interval`` + - ``nova::compute::rbd::libvirt_images_rbd_glance_copy_timeout`` diff --git a/spec/classes/nova_compute_rbd_spec.rb b/spec/classes/nova_compute_rbd_spec.rb index dc1b1a2b4..6cfed510b 100644 --- a/spec/classes/nova_compute_rbd_spec.rb +++ b/spec/classes/nova_compute_rbd_spec.rb @@ -23,11 +23,7 @@ require 'spec_helper' describe 'nova::compute::rbd' do let :params do - { :libvirt_rbd_user => 'nova', - :libvirt_rbd_secret_uuid => false, - :libvirt_images_rbd_pool => 'rbd', - :libvirt_images_rbd_ceph_conf => '/etc/ceph/ceph.conf', - :ephemeral_storage => true } + { :libvirt_rbd_user => 'nova' } end shared_examples_for 'nova compute rbd' do @@ -39,6 +35,9 @@ describe 'nova::compute::rbd' do is_expected.to contain_nova_config('libvirt/images_rbd_pool').with_value('rbd') is_expected.to contain_nova_config('libvirt/images_rbd_ceph_conf').with_value('/etc/ceph/ceph.conf') is_expected.to contain_nova_config('libvirt/rbd_user').with_value('nova') + is_expected.to contain_nova_config('libvirt/images_rbd_glance_store_name').with_value('') + is_expected.to contain_nova_config('libvirt/images_rbd_glance_copy_poll_interval').with_value('') + is_expected.to contain_nova_config('libvirt/images_rbd_glance_copy_timeout').with_value('') end it 'installs client package' do @@ -51,10 +50,13 @@ describe 'nova::compute::rbd' do context 'when overriding default parameters' do before :each do params.merge!( - :libvirt_rbd_user => 'joe', - :libvirt_rbd_secret_uuid => false, - :libvirt_images_rbd_pool => 'AnotherPool', - :libvirt_images_rbd_ceph_conf => '/tmp/ceph.conf' + :libvirt_rbd_user => 'joe', + :libvirt_rbd_secret_uuid => false, + :libvirt_images_rbd_pool => 'AnotherPool', + :libvirt_images_rbd_ceph_conf => '/tmp/ceph.conf', + :libvirt_images_rbd_glance_store_name => 'glance_rbd_store', + :libvirt_images_rbd_glance_copy_poll_interval => 30, + :libvirt_images_rbd_glance_copy_timeout => 300 ) end @@ -63,6 +65,9 @@ describe 'nova::compute::rbd' do is_expected.to contain_nova_config('libvirt/images_rbd_pool').with_value('AnotherPool') is_expected.to contain_nova_config('libvirt/images_rbd_ceph_conf').with_value('/tmp/ceph.conf') is_expected.to contain_nova_config('libvirt/rbd_user').with_value('joe') + is_expected.to contain_nova_config('libvirt/images_rbd_glance_store_name').with_value('glance_rbd_store') + is_expected.to contain_nova_config('libvirt/images_rbd_glance_copy_poll_interval').with_value(30) + is_expected.to contain_nova_config('libvirt/images_rbd_glance_copy_timeout').with_value(300) end end @@ -123,8 +128,11 @@ describe 'nova::compute::rbd' do end it 'should only set user and secret_uuid in nova.conf ' do - is_expected.to_not contain_nova_config('libvirt/images_rbd_pool').with_value('rbd') - is_expected.to_not contain_nova_config('libvirt/images_rbd_ceph_conf').with_value('/etc/ceph/ceph.conf') + is_expected.to contain_nova_config('libvirt/images_rbd_pool').with_ensure('absent') + is_expected.to contain_nova_config('libvirt/images_rbd_ceph_conf').with_ensure('absent') + is_expected.to contain_nova_config('libvirt/images_rbd_glance_store_name').with_ensure('absent') + is_expected.to contain_nova_config('libvirt/images_rbd_glance_copy_poll_interval').with_ensure('absent') + is_expected.to contain_nova_config('libvirt/images_rbd_glance_copy_timeout').with_ensure('absent') is_expected.to contain_nova_config('libvirt/rbd_user').with_value('nova') is_expected.to contain_nova_config('libvirt/rbd_secret_uuid').with_value('UUID') end