[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
This commit is contained in:
Andrey Shestakov 2015-12-16 23:58:31 +02:00
parent be585ad0db
commit d5699dfa23
4 changed files with 77 additions and 19 deletions

View File

@ -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']

View File

@ -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

View File

@ -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

View File

@ -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