From d5699dfa23521727c3561333ebd610970fbce9c9 Mon Sep 17 00:00:00 2001 From: Andrey Shestakov Date: Wed, 16 Dec 2015 23:58:31 +0200 Subject: [PATCH] [Ironic] move ironic-compute to controller Until Ironic cannot works with multiple nova-compute services, ironic-specific nova-compute should runs in active/backup mode. This change introdues CS resource for ironic's nova-compute on controller, which replaces nova-computes on ironic's nodes. Closes-bug: #1522361 Change-Id: Ibd021656cae1e5755db33d3c44ddc68f1940465a --- .../{roles => ironic}/ironic-compute.pp | 36 +++++++++++++++++-- .../osnailyfacter/modular/ironic/tasks.yaml | 16 +++++++++ .../osnailyfacter/modular/roles/tasks.yaml | 15 -------- .../{roles => ironic}/ironic-compute_spec.rb | 29 ++++++++++++++- 4 files changed, 77 insertions(+), 19 deletions(-) rename deployment/puppet/osnailyfacter/modular/{roles => ironic}/ironic-compute.pp (82%) rename tests/noop/spec/hosts/{roles => ironic}/ironic-compute_spec.rb (51%) diff --git a/deployment/puppet/osnailyfacter/modular/roles/ironic-compute.pp b/deployment/puppet/osnailyfacter/modular/ironic/ironic-compute.pp similarity index 82% rename from deployment/puppet/osnailyfacter/modular/roles/ironic-compute.pp rename to deployment/puppet/osnailyfacter/modular/ironic/ironic-compute.pp index 1e4f804877..0d22f001ca 100644 --- a/deployment/puppet/osnailyfacter/modular/roles/ironic-compute.pp +++ b/deployment/puppet/osnailyfacter/modular/ironic/ironic-compute.pp @@ -40,6 +40,10 @@ $memcached_port = hiera('memcache_server_port', '11211') $memcached_addresses = suffix($memcached_servers, ":${memcached_port}") $notify_on_state_change = 'vm_and_task_state' +####### Disable upstart startup on install ####### +tweaks::ubuntu_service_override { 'nova-compute': + package_name => "nova-compute", +} class { '::nova': install_utilities => false, @@ -66,7 +70,7 @@ class { '::nova': class { '::nova::compute': ensure_package => installed, - enabled => true, + enabled => false, vnc_enabled => false, force_config_drive => $nova_hash['force_config_drive'], #NOTE(bogdando) default became true in 4.0.0 puppet-nova (was false) @@ -74,6 +78,7 @@ class { '::nova::compute': default_availability_zone => $nova_hash['default_availability_zone'], default_schedule_zone => $nova_hash['default_schedule_zone'], reserved_host_memory => '0', + compute_manager => 'ironic.nova.compute.manager.ClusteredComputeManager', } @@ -91,8 +96,33 @@ class { 'nova::network::neutron': neutron_admin_auth_url => "http://${service_endpoint}:35357/v2.0", } +cs_resource { "p_nova_compute_ironic": + ensure => present, + primitive_class => 'ocf', + provided_by => 'fuel', + primitive_type => 'nova-compute', + metadata => { + resource-stickiness => '1' + }, + parameters => { + config => "/etc/nova/nova.conf", + pid => "/var/run/nova/nova-compute-ironic.pid", + additional_parameters => "--config-file=/etc/nova/nova-compute.conf", + }, + operations => { + monitor => { timeout => '30', interval => '60' }, + start => { timeout => '30' }, + stop => { timeout => '30' } + } +} + +service { "p_nova_compute_ironic": + ensure => running, + enable => true, + provider => 'pacemaker', +} + file { '/etc/nova/nova-compute.conf': content => "[DEFAULT]\nhost=ironic-compute", require => Package['nova-compute'], -} ~> Service['nova-compute'] - +} ~> Service['p_nova_compute_ironic'] diff --git a/deployment/puppet/osnailyfacter/modular/ironic/tasks.yaml b/deployment/puppet/osnailyfacter/modular/ironic/tasks.yaml index 63e7c17ff9..cd41d92146 100644 --- a/deployment/puppet/osnailyfacter/modular/ironic/tasks.yaml +++ b/deployment/puppet/osnailyfacter/modular/ironic/tasks.yaml @@ -35,3 +35,19 @@ puppet_manifest: /etc/puppet/modules/osnailyfacter/modular/ironic/keystone.pp puppet_modules: /etc/puppet/modules timeout: 1800 + +- id: ironic-compute + type: puppet + version: 2.0.0 + groups: [primary-controller, controller] + required_for: [deploy_end] + requires: [openstack-controller, ironic-api] + refresh_on: [nova_config, nova_paste_api_ini] + cross-depends: + - name: /(primary-)?rabbitmq/ + - name: openstack-controller + - name: ironic-api + parameters: + puppet_manifest: /etc/puppet/modules/osnailyfacter/modular/ironic/ironic-compute.pp + puppet_modules: /etc/puppet/modules + timeout: 3600 diff --git a/deployment/puppet/osnailyfacter/modular/roles/tasks.yaml b/deployment/puppet/osnailyfacter/modular/roles/tasks.yaml index 9f1e19a0e3..1aff78fa46 100644 --- a/deployment/puppet/osnailyfacter/modular/roles/tasks.yaml +++ b/deployment/puppet/osnailyfacter/modular/roles/tasks.yaml @@ -72,18 +72,3 @@ puppet_manifest: /etc/puppet/modules/osnailyfacter/modular/roles/ironic-conductor.pp puppet_modules: /etc/puppet/modules timeout: 3600 - -- id: ironic-compute - type: puppet - version: 2.0.0 - groups: [ironic] - required_for: [deploy_end] - requires: [hosts, firewall, ironic-conductor] - cross-depends: - - name: /(primary-)?rabbitmq/ - - name: ironic-conductor - role: self - parameters: - puppet_manifest: /etc/puppet/modules/osnailyfacter/modular/roles/ironic-compute.pp - puppet_modules: /etc/puppet/modules - timeout: 3600 diff --git a/tests/noop/spec/hosts/roles/ironic-compute_spec.rb b/tests/noop/spec/hosts/ironic/ironic-compute_spec.rb similarity index 51% rename from tests/noop/spec/hosts/roles/ironic-compute_spec.rb rename to tests/noop/spec/hosts/ironic/ironic-compute_spec.rb index 45651a73ab..9015b97886 100644 --- a/tests/noop/spec/hosts/roles/ironic-compute_spec.rb +++ b/tests/noop/spec/hosts/ironic/ironic-compute_spec.rb @@ -29,9 +29,10 @@ describe manifest do end if ironic_enabled - it 'nova config should have correct nova_user_password' do + it 'nova config should have correct ironic settings' do should contain_nova_config('ironic/admin_password').with(:value => ironic_user_password) should contain_nova_config('DEFAULT/compute_driver').with(:value => 'ironic.IronicDriver') + should contain_nova_config('DEFAULT/compute_manager').with(:value => 'ironic.nova.compute.manager.ClusteredComputeManager') end it 'nova config should have reserved_host_memory_mb set to 0' do @@ -47,6 +48,32 @@ describe manifest do it 'nova-compute.conf should have host set to "ironic-compute"' do should contain_file('/etc/nova/nova-compute.conf').with('content' => "[DEFAULT]\nhost=ironic-compute") end + + it 'nova-compute should manages by pacemaker, and should be disabled as system service' do + expect(subject).to contain_cs_resource('p_nova_compute_ironic').with( + :name => "p_nova_compute_ironic", + :ensure => "present", + :primitive_class => "ocf", + :provided_by => "pacemaker", + :primitive_type => "nova-compute", + :metadata => {"resource-stickiness" => "1"}, + :parameters => {"config" => "/etc/nova/nova.conf", + "pid" => "/var/run/nova/nova-compute-ironic.pid", + "additional_parameters" => "--config-file=/etc/nova/nova-compute.conf" + }, + ) + expect(subject).to contain_service('p_nova_compute_ironic').with( + :name => "p_nova_compute_ironic", + :ensure => "running", + :enable => true, + :provider => "pacemaker", + ) + expect(subject).to contain_service('nova-compute').with( + :name => "nova-compute", + :ensure => "stopped", + :enable => false, + ) + end end end