From c309df02a2f75484f8e2672d8c37af8a421b4436 Mon Sep 17 00:00:00 2001 From: Francesco Santoro Date: Tue, 3 May 2016 14:53:50 +0200 Subject: [PATCH] 6wind-virtual-accelerator-plugin: use service instead of exec This patch reworks the scripts to use the puppet service resource instead of calling services using exec. Change-Id: Ib28ca7100a24a57f1b9074ef7eee6d079308233b Signed-off-by: Francesco Santoro --- .../virtual_accelerator/manifests/config.pp | 4 +- .../manifests/neutron_conf.pp | 16 ++++--- .../virtual_accelerator/manifests/service.pp | 46 ++++++++++++------- 3 files changed, 41 insertions(+), 25 deletions(-) diff --git a/deployment_scripts/puppet/modules/virtual_accelerator/manifests/config.pp b/deployment_scripts/puppet/modules/virtual_accelerator/manifests/config.pp index 54ba9f2..12cf95b 100644 --- a/deployment_scripts/puppet/modules/virtual_accelerator/manifests/config.pp +++ b/deployment_scripts/puppet/modules/virtual_accelerator/manifests/config.pp @@ -18,8 +18,8 @@ class virtual_accelerator::config inherits virtual_accelerator { mode => 0644, source => 'puppet:///modules/virtual_accelerator/cpu-cgroup.conf', } -> - exec {'mount_cgroup': - command => "service cpu-cgroup start", + service { 'cpu-cgroup': + ensure => 'running', } $fp_mem = $virtual_accelerator::fp_mem diff --git a/deployment_scripts/puppet/modules/virtual_accelerator/manifests/neutron_conf.pp b/deployment_scripts/puppet/modules/virtual_accelerator/manifests/neutron_conf.pp index 25ff100..d6d2f5a 100644 --- a/deployment_scripts/puppet/modules/virtual_accelerator/manifests/neutron_conf.pp +++ b/deployment_scripts/puppet/modules/virtual_accelerator/manifests/neutron_conf.pp @@ -16,13 +16,17 @@ class virtual_accelerator::neutron_conf inherits virtual_accelerator { } -> exec { 'disable_ipset': command => "crudini --set ${OVS_CONF_FILE} securitygroup enable_ipset False", - } -> - exec { 'restart_ovs': - command => 'service openvswitch-switch restart', - } -> - exec { 'restart_ovs_agent': - command => 'service neutron-plugin-openvswitch-agent restart', + notify => Service['openvswitch-switch'], } + + service { 'openvswitch-switch': + ensure => 'running', + notify => Service['neutron-plugin-openvswitch-agent'], + } + + service { 'neutron-plugin-openvswitch-agent': + ensure => 'running', + } } } diff --git a/deployment_scripts/puppet/modules/virtual_accelerator/manifests/service.pp b/deployment_scripts/puppet/modules/virtual_accelerator/manifests/service.pp index 9cb51d1..bb0345f 100644 --- a/deployment_scripts/puppet/modules/virtual_accelerator/manifests/service.pp +++ b/deployment_scripts/puppet/modules/virtual_accelerator/manifests/service.pp @@ -6,25 +6,37 @@ class virtual_accelerator::service inherits virtual_accelerator { $NOVA_CONF_FILE = "/etc/nova/nova.conf" exec { 'vcpu_pin': - command => "crudini --set ${NOVA_CONF_FILE} DEFAULT vcpu_pin_set $(python /usr/local/bin/get_vcpu_pin_set.py)", - } -> + command => "crudini --set ${NOVA_CONF_FILE} DEFAULT vcpu_pin_set $(python /usr/local/bin/get_vcpu_pin_set.py)", + notify => Service['virtual-accelerator'], + } + service { 'virtual-accelerator': - ensure => 'running', - } -> - exec { 'restart_ovs': - command => 'service openvswitch-switch restart', - } -> - exec { 'restart_ovs_agent': - command => 'service neutron-plugin-openvswitch-agent restart', - } -> + ensure => 'running', + notify => Service['openvswitch-switch'], + } + + service { 'openvswitch-switch': + ensure => 'running', + notify => Service['neutron-plugin-openvswitch-agent'], + } + + service { 'neutron-plugin-openvswitch-agent': + ensure => 'running', + notify => Service['libvirt-bin'], + } + service { 'libvirt-bin': - ensure => 'stopped', - } -> - exec { 'restart_libvirt': - command => 'service libvirtd restart', - } -> - exec { 'restart_nova': - command => 'service nova-compute restart', + ensure => 'stopped', + notify => Service['libvirtd'], + } + + service { 'libvirtd': + ensure => 'running', + notify => Service['nova-compute'], + } + + service { 'nova-compute': + ensure => 'running', } }