rbd: make sure libvirt is run before get-or-set virsh secret
If we try to get-or-set virsh secret before starting libvirt, we got this: Failed to connect socket to '/var/run/libvirt/libvirt-sock' Also, drop the requirement on nova::config::end Anchor for libvirt service, that already needs to run before nova-compute service. It's created a dependency cycle: Anchor[nova::config::end] => Service[libvirt] => Exec[get-or-set virsh secret] => Exec[set-secret-value virsh] => Anchor[nova::config::end] Also, stop requiring ceph-client-package Package resource in the 'get-or-set virsh secret' Exec, since the resource is not required in this class. This patch is an attempt to prevent this situation and allow to deploy nova-compute with RBD in a single Puppet run. Change-Id: I69a7d40e7d1847be06a843986ace4f0602272fe1
This commit is contained in:
@@ -191,7 +191,6 @@ class nova::compute::libvirt (
|
|||||||
enable => true,
|
enable => true,
|
||||||
name => $libvirt_service_name,
|
name => $libvirt_service_name,
|
||||||
provider => $::nova::params::special_service_provider,
|
provider => $::nova::params::special_service_provider,
|
||||||
require => Anchor['nova::config::end'],
|
|
||||||
}
|
}
|
||||||
|
|
||||||
nova_config {
|
nova_config {
|
||||||
|
@@ -103,7 +103,7 @@ class nova::compute::rbd (
|
|||||||
exec { 'get-or-set virsh secret':
|
exec { 'get-or-set virsh secret':
|
||||||
command => '/usr/bin/virsh secret-define --file /etc/nova/secret.xml | /usr/bin/awk \'{print $2}\' | sed \'/^$/d\' > /etc/nova/virsh.secret',
|
command => '/usr/bin/virsh secret-define --file /etc/nova/secret.xml | /usr/bin/awk \'{print $2}\' | sed \'/^$/d\' > /etc/nova/virsh.secret',
|
||||||
creates => '/etc/nova/virsh.secret',
|
creates => '/etc/nova/virsh.secret',
|
||||||
require => [File['/etc/nova/secret.xml'], Package['ceph-client-package']],
|
require => [File['/etc/nova/secret.xml'], Service['libvirt']],
|
||||||
}
|
}
|
||||||
|
|
||||||
if $libvirt_rbd_secret_key {
|
if $libvirt_rbd_secret_key {
|
||||||
|
@@ -35,8 +35,6 @@ describe 'nova::compute::libvirt' do
|
|||||||
:ensure => 'running',
|
:ensure => 'running',
|
||||||
:provider => 'upstart',
|
:provider => 'upstart',
|
||||||
)
|
)
|
||||||
|
|
||||||
is_expected.to contain_service('libvirt').that_requires('Anchor[nova::config::end]')
|
|
||||||
}
|
}
|
||||||
|
|
||||||
it { is_expected.to contain_nova_config('DEFAULT/compute_driver').with_value('libvirt.LibvirtDriver')}
|
it { is_expected.to contain_nova_config('DEFAULT/compute_driver').with_value('libvirt.LibvirtDriver')}
|
||||||
@@ -94,7 +92,6 @@ describe 'nova::compute::libvirt' do
|
|||||||
:ensure => 'running',
|
:ensure => 'running',
|
||||||
:before => ['Service[nova-compute]']
|
:before => ['Service[nova-compute]']
|
||||||
)
|
)
|
||||||
is_expected.to contain_service('libvirt').that_requires('Anchor[nova::config::end]')
|
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -190,7 +187,6 @@ describe 'nova::compute::libvirt' do
|
|||||||
:enable => true,
|
:enable => true,
|
||||||
:ensure => 'running',
|
:ensure => 'running',
|
||||||
:provider => 'init',
|
:provider => 'init',
|
||||||
:require => 'Anchor[nova::config::end]',
|
|
||||||
:before => ['Service[nova-compute]'],
|
:before => ['Service[nova-compute]'],
|
||||||
)}
|
)}
|
||||||
it { is_expected.to contain_service('messagebus').with(
|
it { is_expected.to contain_service('messagebus').with(
|
||||||
@@ -320,7 +316,6 @@ describe 'nova::compute::libvirt' do
|
|||||||
:enable => true,
|
:enable => true,
|
||||||
:ensure => 'running',
|
:ensure => 'running',
|
||||||
:provider => nil,
|
:provider => nil,
|
||||||
:require => 'Anchor[nova::config::end]',
|
|
||||||
:before => ['Service[nova-compute]']
|
:before => ['Service[nova-compute]']
|
||||||
)}
|
)}
|
||||||
|
|
||||||
|
@@ -90,7 +90,7 @@ describe 'nova::compute::rbd' do
|
|||||||
is_expected.to contain_exec('get-or-set virsh secret').with(
|
is_expected.to contain_exec('get-or-set virsh secret').with(
|
||||||
:command => '/usr/bin/virsh secret-define --file /etc/nova/secret.xml | /usr/bin/awk \'{print $2}\' | sed \'/^$/d\' > /etc/nova/virsh.secret',
|
:command => '/usr/bin/virsh secret-define --file /etc/nova/secret.xml | /usr/bin/awk \'{print $2}\' | sed \'/^$/d\' > /etc/nova/virsh.secret',
|
||||||
:creates => '/etc/nova/virsh.secret',
|
:creates => '/etc/nova/virsh.secret',
|
||||||
:require => ['File[/etc/nova/secret.xml]', 'Package[ceph-client-package]']
|
:require => ['File[/etc/nova/secret.xml]', 'Service[libvirt]'],
|
||||||
)
|
)
|
||||||
is_expected.to contain_exec('set-secret-value virsh').with(
|
is_expected.to contain_exec('set-secret-value virsh').with(
|
||||||
:command => "/usr/bin/virsh secret-set-value --secret UUID --base64 $(ceph auth get-key client.rbd_test)"
|
:command => "/usr/bin/virsh secret-set-value --secret UUID --base64 $(ceph auth get-key client.rbd_test)"
|
||||||
@@ -141,7 +141,7 @@ describe 'nova::compute::rbd' do
|
|||||||
is_expected.to contain_exec('get-or-set virsh secret').with(
|
is_expected.to contain_exec('get-or-set virsh secret').with(
|
||||||
:command => '/usr/bin/virsh secret-define --file /etc/nova/secret.xml | /usr/bin/awk \'{print $2}\' | sed \'/^$/d\' > /etc/nova/virsh.secret',
|
:command => '/usr/bin/virsh secret-define --file /etc/nova/secret.xml | /usr/bin/awk \'{print $2}\' | sed \'/^$/d\' > /etc/nova/virsh.secret',
|
||||||
:creates => '/etc/nova/virsh.secret',
|
:creates => '/etc/nova/virsh.secret',
|
||||||
:require => ['File[/etc/nova/secret.xml]', 'Package[ceph-client-package]'],
|
:require => ['File[/etc/nova/secret.xml]', 'Service[libvirt]'],
|
||||||
)
|
)
|
||||||
is_expected.to contain_exec('set-secret-value virsh').with(
|
is_expected.to contain_exec('set-secret-value virsh').with(
|
||||||
:command => "/usr/bin/virsh secret-set-value --secret UUID --base64 $(ceph auth get-key client.rbd_test)"
|
:command => "/usr/bin/virsh secret-set-value --secret UUID --base64 $(ceph auth get-key client.rbd_test)"
|
||||||
|
Reference in New Issue
Block a user