diff --git a/manifests/compute/libvirt/services.pp b/manifests/compute/libvirt/services.pp index 3c61c1565..62827cb69 100644 --- a/manifests/compute/libvirt/services.pp +++ b/manifests/compute/libvirt/services.pp @@ -102,11 +102,12 @@ class nova::compute::libvirt::services ( } service { 'libvirt': - ensure => $libvirt_service_ensure, - enable => $libvirt_service_enable, - name => $libvirt_service_name, - require => Anchor['nova::install::end'], + ensure => $libvirt_service_ensure, + enable => $libvirt_service_enable, + name => $libvirt_service_name, + tag => 'libvirt-service', } + Libvirtd_config<||> ~> Service['libvirt'] # messagebus if($::osfamily == 'RedHat') { @@ -114,8 +115,8 @@ class nova::compute::libvirt::services ( ensure => running, enable => true, name => $::nova::params::messagebus_service_name, + tag => 'libvirt-service', } - Package['libvirt'] -> Service['messagebus'] } } @@ -124,8 +125,8 @@ class nova::compute::libvirt::services ( ensure => running, enable => true, name => $virtlock_service_name, + tag => 'libvirt-service', } - Package<| title == 'libvirt' |> -> Service['virtlockd'] } if $virtlog_service_name { @@ -133,8 +134,9 @@ class nova::compute::libvirt::services ( ensure => running, enable => true, name => $virtlog_service_name, + tag => 'libvirt-service', } - Package<| title == 'libvirt' |> -> Service['virtlogd'] + Virtlogd_config<||> ~> Service['libvirt'] } if ! $modular_libvirt { @@ -157,43 +159,46 @@ class nova::compute::libvirt::services ( if $virtsecret_service_name { package { 'virtsecret': ensure => present, - name => "${::nova::params::libvirt_daemon_package_prefix}driver-secret" + name => "${::nova::params::libvirt_daemon_package_prefix}driver-secret", + tag => ['openstack', 'nova-support-package'], } service { 'virtsecretd': - ensure => running, - enable => true, - name => $virtsecret_service_name, - require => Package['virtsecret'], - tag => 'libvirt-modular-service', + ensure => running, + enable => true, + name => $virtsecret_service_name, + tag => ['libvirt-service', 'libvirt-modular-service'], } + Virtsecretd_config<||> ~> Service['virtlogd'] } if $virtnodedev_service_name { package { 'virtnodedev': ensure => present, - name => "${::nova::params::libvirt_daemon_package_prefix}driver-nodedev" + name => "${::nova::params::libvirt_daemon_package_prefix}driver-nodedev", + tag => ['openstack', 'nova-support-package'], } service { 'virtnodedevd': - ensure => running, - enable => true, - name => $virtnodedev_service_name, - require => Package['virtnodedev'], - tag => 'libvirt-modular-service', + ensure => running, + enable => true, + name => $virtnodedev_service_name, + tag => ['libvirt-service', 'libvirt-modular-service'], } + Virtnodedevd_config<||> ~> Service['virtlogd'] } if $virtqemu_service_name { package { 'virtqemu': ensure => present, - name => "${::nova::params::libvirt_daemon_package_prefix}driver-qemu" + name => "${::nova::params::libvirt_daemon_package_prefix}driver-qemu", + tag => ['openstack', 'nova-support-package'], } service { 'virtqemud': - ensure => running, - enable => true, - name => $virtqemu_service_name, - require => Package['virtqemu'], - tag => 'libvirt-modular-service', + ensure => running, + enable => true, + name => $virtqemu_service_name, + tag => ['libvirt-service', 'libvirt-modular-service'], } + Virtqemud_config<||> ~> Service['virtlogd'] } if $virtproxy_service_name { @@ -201,23 +206,24 @@ class nova::compute::libvirt::services ( ensure => running, enable => true, name => $virtproxy_service_name, - tag => 'libvirt-modular-service', + tag => ['libvirt-service', 'libvirt-modular-service'], } - Package<| title == 'libvirt' |> -> Service['virtproxyd'] + Virtproxyd_config<||> ~> Service['virtlogd'] } if $virtstorage_service_name { package { 'virtstorage': ensure => present, - name => "${::nova::params::libvirt_daemon_package_prefix}driver-storage" + name => "${::nova::params::libvirt_daemon_package_prefix}driver-storage", + tag => ['openstack', 'nova-support-package'], } service { 'virtstoraged': - ensure => running, - enable => true, - name => $virtstorage_service_name, - require => Package['virtstorage'], - tag => 'libvirt-modular-service', + ensure => running, + enable => true, + name => $virtstorage_service_name, + tag => ['libvirt-service', 'libvirt-modular-service'], } + Virtstoraged_config<||> ~> Service['virtlogd'] } } } diff --git a/manifests/compute/libvirt/virtlogd.pp b/manifests/compute/libvirt/virtlogd.pp index 7929e3d14..f11be2068 100644 --- a/manifests/compute/libvirt/virtlogd.pp +++ b/manifests/compute/libvirt/virtlogd.pp @@ -58,8 +58,4 @@ class nova::compute::libvirt::virtlogd ( 'max_size': value => pick($max_size, $::os_service_default); 'max_backups': value => pick($max_backups, $::os_service_default); } - - Anchor['nova::config::begin'] - -> Virtlogd_config<||> - -> Anchor['nova::config::end'] } diff --git a/manifests/compute/libvirt/virtnodedevd.pp b/manifests/compute/libvirt/virtnodedevd.pp index f96530217..f53dd62c9 100644 --- a/manifests/compute/libvirt/virtnodedevd.pp +++ b/manifests/compute/libvirt/virtnodedevd.pp @@ -52,8 +52,4 @@ class nova::compute::libvirt::virtnodedevd ( 'admin_max_clients': value => $admin_max_clients; 'ovs_timeout': value => $ovs_timeout; } - - Anchor['nova::config::begin'] - -> Virtnodedevd_config<||> - -> Anchor['nova::config::end'] } diff --git a/manifests/compute/libvirt/virtproxyd.pp b/manifests/compute/libvirt/virtproxyd.pp index 6ac809ced..8fc388f54 100644 --- a/manifests/compute/libvirt/virtproxyd.pp +++ b/manifests/compute/libvirt/virtproxyd.pp @@ -61,8 +61,4 @@ class nova::compute::libvirt::virtproxyd ( 'ovs_timeout': value => $ovs_timeout; 'tls_priority': value => $tls_priority, quote => true; } - - Anchor['nova::config::begin'] - -> Virtproxyd_config<||> - -> Anchor['nova::config::end'] } diff --git a/manifests/compute/libvirt/virtqemud.pp b/manifests/compute/libvirt/virtqemud.pp index 41df52825..0c640657b 100644 --- a/manifests/compute/libvirt/virtqemud.pp +++ b/manifests/compute/libvirt/virtqemud.pp @@ -53,8 +53,4 @@ class nova::compute::libvirt::virtqemud ( 'admin_max_clients': value => $admin_max_clients; 'ovs_timeout': value => $ovs_timeout; } - - Anchor['nova::config::begin'] - -> Virtqemud_config<||> - -> Anchor['nova::config::end'] } diff --git a/manifests/compute/libvirt/virtsecretd.pp b/manifests/compute/libvirt/virtsecretd.pp index 76e09d7c1..8529b00c9 100644 --- a/manifests/compute/libvirt/virtsecretd.pp +++ b/manifests/compute/libvirt/virtsecretd.pp @@ -52,8 +52,4 @@ class nova::compute::libvirt::virtsecretd ( 'admin_max_clients': value => $admin_max_clients; 'ovs_timeout': value => $ovs_timeout; } - - Anchor['nova::config::begin'] - -> Virtsecretd_config<||> - -> Anchor['nova::config::end'] } diff --git a/manifests/compute/libvirt/virtstoraged.pp b/manifests/compute/libvirt/virtstoraged.pp index 678492080..ccfa496d4 100644 --- a/manifests/compute/libvirt/virtstoraged.pp +++ b/manifests/compute/libvirt/virtstoraged.pp @@ -38,9 +38,5 @@ class nova::compute::libvirt::virtstoraged ( 'log_outputs': value => $log_outputs, quote => true; 'ovs_timeout': value => $ovs_timeout; } - - Anchor['nova::config::begin'] - -> Virtstoraged_config<||> - -> Anchor['nova::config::end'] } diff --git a/manifests/deps.pp b/manifests/deps.pp index 105847f0c..8d0347412 100644 --- a/manifests/deps.pp +++ b/manifests/deps.pp @@ -58,6 +58,20 @@ class nova::deps { -> Package<| tag == 'nova-support-package'|> -> Anchor['nova::install::end'] + # Start libvirt services during the service phase + Anchor['nova::service::begin'] + -> Service<| tag == 'libvirt-service'|> + -> Anchor['nova::service::end'] + + # Manage libvirt configurations during the config phase + Anchor['nova::config::begin'] -> Libvirtd_config<||> -> Anchor['nova::config::end'] + Anchor['nova::config::begin'] -> Virtlogd_config<||> -> Anchor['nova::config::end'] + Anchor['nova::config::begin'] -> Virtnodedevd_config<||> -> Anchor['nova::config::end'] + Anchor['nova::config::begin'] -> Virtproxyd_config<||> -> Anchor['nova::config::end'] + Anchor['nova::config::begin'] -> Virtqemud_config<||> -> Anchor['nova::config::end'] + Anchor['nova::config::begin'] -> Virtsecretd_config<||> -> Anchor['nova::config::end'] + Anchor['nova::config::begin'] -> Virtstoraged_config<||> -> Anchor['nova::config::end'] + # all cache settings should be applied and all packages should be installed # before service startup Oslo::Cache<||> -> Anchor['nova::service::begin'] diff --git a/manifests/migration/libvirt.pp b/manifests/migration/libvirt.pp index f2189a243..d8e4c2f4f 100644 --- a/manifests/migration/libvirt.pp +++ b/manifests/migration/libvirt.pp @@ -221,14 +221,10 @@ class nova::migration::libvirt( if $configure_libvirt { Anchor['nova::config::begin'] - -> Libvirtd_config<||> -> File<| tag == 'libvirt-file'|> -> File_line<| tag == 'libvirt-file_line'|> -> Anchor['nova::config::end'] - Libvirtd_config<||> - ~> Service['libvirt'] - File_line<| tag == 'libvirt-file_line' |> ~> Service['libvirt'] diff --git a/spec/classes/nova_compute_libvirt_spec.rb b/spec/classes/nova_compute_libvirt_spec.rb index 72872b5c9..ec3d92432 100644 --- a/spec/classes/nova_compute_libvirt_spec.rb +++ b/spec/classes/nova_compute_libvirt_spec.rb @@ -159,19 +159,19 @@ describe 'nova::compute::libvirt' do it { is_expected.to contain_nova_config('libvirt/num_memory_encrypted_guests').with_value(255)} it { is_expected.to contain_service('libvirt').with( - :name => 'custom_service', - :enable => true, - :ensure => 'running', - :before => ['Service[nova-compute]'] + :name => 'custom_service', + :enable => true, + :ensure => 'running', + :before => ['Anchor[nova::service::end]', 'Service[nova-compute]'] ) is_expected.to contain_service('virtlockd').with( - :name => 'virtlock', - :enable => true, + :name => 'virtlock', + :enable => true, :ensure => 'running' ) is_expected.to contain_service('virtlogd').with( - :name => 'virtlog', - :enable => true, + :name => 'virtlog', + :enable => true, :ensure => 'running' ) @@ -266,12 +266,12 @@ describe 'nova::compute::libvirt' do :name => 'libvirtd', :enable => true, :ensure => 'running', - :before => ['Service[nova-compute]'], + :before => ['Anchor[nova::service::end]', 'Service[nova-compute]'], )} it { is_expected.to contain_service('messagebus').with( :ensure => 'running', :enable => true, - :before => ['Service[libvirt]'], + :before => ['Anchor[nova::service::end]', 'Service[libvirt]'], :name => 'dbus' ) }