From 77fa1ce7e2864e2fad32cc477a999a40dcf4c37e Mon Sep 17 00:00:00 2001 From: Clayton O'Neill Date: Tue, 22 Apr 2014 16:04:47 +0000 Subject: [PATCH] Allow configuring the rbd keyring name Change-Id: I7342ec1337cf86c0e4bc66b1788e65c53b2878ce (cherry picked from commit cb0b48016a33233abee032bbffa9f9d25bd1119e) --- manifests/compute/rbd.pp | 7 ++++++- spec/classes/nova_compute_rbd_spec.rb | 7 ++++--- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/manifests/compute/rbd.pp b/manifests/compute/rbd.pp index d88a96f32..009833dca 100644 --- a/manifests/compute/rbd.pp +++ b/manifests/compute/rbd.pp @@ -38,12 +38,17 @@ # Required to use cephx. # Default to false. # +# [*rbd_keyring*] +# (optional) The keyring name to use when retrieving the RBD secret +# Default to 'client.nova' +# class nova::compute::rbd ( $libvirt_rbd_user, $libvirt_rbd_secret_uuid = false, $libvirt_images_rbd_pool = 'rbd', $libvirt_images_rbd_ceph_conf = '/etc/ceph/ceph.conf', + $rbd_keyring = 'client.nova', ) { include nova::params @@ -71,7 +76,7 @@ } exec { 'set-secret-value virsh': - command => '/usr/bin/virsh secret-set-value --secret $(cat /etc/nova/virsh.secret) --base64 $(ceph auth get-key client.nova)', + command => "/usr/bin/virsh secret-set-value --secret $(cat /etc/nova/virsh.secret) --base64 $(ceph auth get-key ${rbd_keyring})", require => Exec['get-or-set virsh secret'] } diff --git a/spec/classes/nova_compute_rbd_spec.rb b/spec/classes/nova_compute_rbd_spec.rb index 208fa88e1..1605e3029 100644 --- a/spec/classes/nova_compute_rbd_spec.rb +++ b/spec/classes/nova_compute_rbd_spec.rb @@ -50,7 +50,7 @@ ) end - it 'configure nova.conf with overriden parameters' do + it 'configure nova.conf with overridden parameters' do should contain_nova_config('libvirt/images_type').with_value('rbd') should contain_nova_config('libvirt/images_rbd_pool').with_value('AnotherPool') should contain_nova_config('libvirt/images_rbd_ceph_conf').with_value('/tmp/ceph.conf') @@ -61,7 +61,8 @@ context 'when using cephx' do before :each do params.merge!( - :libvirt_rbd_secret_uuid => 'UUID' + :libvirt_rbd_secret_uuid => 'UUID', + :rbd_keyring => 'client.rbd_test' ) end @@ -84,7 +85,7 @@ :require => 'File[/etc/nova/secret.xml]' ) should contain_exec('set-secret-value virsh').with( - :command => "/usr/bin/virsh secret-set-value --secret $(cat /etc/nova/virsh.secret) --base64 $(ceph auth get-key client.nova)" + :command => "/usr/bin/virsh secret-set-value --secret $(cat /etc/nova/virsh.secret) --base64 $(ceph auth get-key client.rbd_test)" ) end end