From 9a90457919915ec82db87b0998dc41e6f4e45838 Mon Sep 17 00:00:00 2001 From: Emilien Macchi Date: Mon, 10 Feb 2014 22:36:46 +0100 Subject: [PATCH] compute/hypervisor: configure RBD only if Ceph is enabled Close bug #87 Signed-off-by: Emilien Macchi --- manifests/compute/hypervisor.pp | 32 +++++++++---------- spec/classes/cloud_compute_hypervisor_spec.rb | 11 +++++++ 2 files changed, 27 insertions(+), 16 deletions(-) diff --git a/manifests/compute/hypervisor.pp b/manifests/compute/hypervisor.pp index a970d7d0..0a13737f 100644 --- a/manifests/compute/hypervisor.pp +++ b/manifests/compute/hypervisor.pp @@ -97,23 +97,23 @@ Host * class { 'nova::compute::neutron': } - # TODO(EmilienM) Temporary, while https://review.openstack.org/#/c/72440 got merged - nova_config { - 'DEFAULT/libvirt_images_type': value => 'rbd'; - 'DEFAULT/libvirt_images_rbd_pool': value => 'nova'; - 'DEFAULT/libvirt_images_rbd_ceph_conf': value => '/etc/ceph/ceph.conf'; - 'DEFAULT/rbd_user': value => 'nova'; - 'DEFAULT/rbd_secret_uuid': value => 'secrete'; - } - - # Extra config for nova-compute - nova_config { - 'DEFAULT/libvirt_inject_key': value => false; - 'DEFAULT/libvirt_inject_partition': value => '-2'; - 'DEFAULT/live_migration_flag': value => 'VIR_MIGRATE_UNDEFINE_SOURCE,VIR_MIGRATE_PEER2PEER,VIR_MIGRATE_LIVE,VIR_MIGRATE_PERSIST_DEST'; - } - if $has_ceph { + # TODO(EmilienM) Temporary, while https://review.openstack.org/#/c/72440 got merged + nova_config { + 'DEFAULT/libvirt_images_type': value => 'rbd'; + 'DEFAULT/libvirt_images_rbd_pool': value => 'nova'; + 'DEFAULT/libvirt_images_rbd_ceph_conf': value => '/etc/ceph/ceph.conf'; + 'DEFAULT/rbd_user': value => 'nova'; + 'DEFAULT/rbd_secret_uuid': value => 'secrete'; + } + + # Extra config for nova-compute + nova_config { + 'DEFAULT/libvirt_inject_key': value => false; + 'DEFAULT/libvirt_inject_partition': value => '-2'; + 'DEFAULT/live_migration_flag': value => 'VIR_MIGRATE_UNDEFINE_SOURCE,VIR_MIGRATE_PEER2PEER,VIR_MIGRATE_LIVE,VIR_MIGRATE_PERSIST_DEST'; + } + File <<| tag == 'ceph_compute_secret_file' |>> Exec <<| tag == 'get_or_set_virsh_secret' |>> Exec <<| tag == 'set_secret_value_virsh' |>> diff --git a/spec/classes/cloud_compute_hypervisor_spec.rb b/spec/classes/cloud_compute_hypervisor_spec.rb index 5da641b1..41b2ea02 100644 --- a/spec/classes/cloud_compute_hypervisor_spec.rb +++ b/spec/classes/cloud_compute_hypervisor_spec.rb @@ -40,6 +40,7 @@ describe 'cloud::compute::hypervisor' do let :params do { :libvirt_type => 'kvm', :api_eth => '10.0.0.1', + :has_ceph => true, :nova_ssh_private_key => 'secrete', :nova_ssh_public_key => 'public', :ks_nova_internal_proto => 'http', @@ -107,6 +108,16 @@ describe 'cloud::compute::hypervisor' do should contain_nova_config('DEFAULT/libvirt_inject_partition').with('value' => '-2') should contain_nova_config('DEFAULT/live_migration_flag').with('value' => 'VIR_MIGRATE_UNDEFINE_SOURCE,VIR_MIGRATE_PEER2PEER,VIR_MIGRATE_LIVE,VIR_MIGRATE_PERSIST_DEST') end + + context 'without RBD backend' do + before :each do + params.merge!( :has_ceph => false ) + end + + it 'should not configure nova-compute for RBD backend' do + should_not contain_nova_config('DEFAULT/rbd_user').with('value' => 'nova') + end + end end context 'on Debian platforms' do