diff --git a/manifests/agents/dhcp.pp b/manifests/agents/dhcp.pp index c4e1e6d45..46d3a28d6 100644 --- a/manifests/agents/dhcp.pp +++ b/manifests/agents/dhcp.pp @@ -110,9 +110,6 @@ class neutron::agents::dhcp ( Package[$::neutron::params::dnsmasq_packages] -> Package<| title == 'neutron-dhcp-agent' |> ensure_packages($::neutron::params::dnsmasq_packages) } - /^midonet.*/: { - ensure_packages($::neutron::params::midonet_server_package) - } default: { fail("Unsupported dhcp_driver ${dhcp_driver}") } diff --git a/manifests/plugins/midonet.pp b/manifests/plugins/midonet.pp index 7def16a3f..6d81e0ff4 100644 --- a/manifests/plugins/midonet.pp +++ b/manifests/plugins/midonet.pp @@ -30,6 +30,10 @@ # in the midonet config. # Defaults to false. # +# [*package_ensure*] +# Whether to install the latest package, or a version for midonet plugin +# Defaults to 'present'. +# # === Examples # # An example call would be: @@ -79,6 +83,7 @@ class neutron::plugins::midonet ( $keystone_tenant = 'services', $sync_db = false, $purge_config = false, + $package_ensure = 'present' ) { include ::neutron::deps @@ -95,6 +100,12 @@ class neutron::plugins::midonet ( purge => $purge_config, } + package { 'python-networking-midonet': + ensure => $package_ensure, + name => $::neutron::params::midonet_server_package, + tag => ['neutron-package', 'openstack'], + } + neutron_plugin_midonet { 'MIDONET/midonet_uri': value => "http://${midonet_api_ip}:${midonet_api_port}/midonet-api"; 'MIDONET/username': value => $keystone_username; @@ -125,17 +136,18 @@ class neutron::plugins::midonet ( } if $sync_db { + Package<| title == 'python-networking-midonet' |> ~> Exec['midonet-db-sync'] exec { 'midonet-db-sync': - command => 'midonet-db-manage --config-file /etc/neutron/neutron.conf --config-file /etc/neutron/plugin.ini upgrade head', + command => 'neutron-db-manage --subproject networking-midonet upgrade head', path => '/usr/bin', subscribe => [ Anchor['neutron::install::end'], Anchor['neutron::config::end'], - Anchor['neutron::dbsync::begin'] + Anchor['neutron::dbsync::begin'], + Exec['neutron-db-sync'] ], notify => Anchor['neutron::dbsync::end'], refreshonly => true } } } - diff --git a/releasenotes/notes/update-midonet-neutron-plugin-to-v5-3111ed272c7d91e2.yaml b/releasenotes/notes/update-midonet-neutron-plugin-to-v5-3111ed272c7d91e2.yaml new file mode 100644 index 000000000..19317c2fe --- /dev/null +++ b/releasenotes/notes/update-midonet-neutron-plugin-to-v5-3111ed272c7d91e2.yaml @@ -0,0 +1,7 @@ +--- +features: + - Midonet v5.x plugin doesn't rely anymore + on a custom DHCP agent, also it only uses + a subproject for db sync instead of the old + method of overriding the neutron-db-sync + completelly. diff --git a/spec/classes/neutron_plugins_midonet_spec.rb b/spec/classes/neutron_plugins_midonet_spec.rb index 5d4b0de33..2bf9ad4b7 100644 --- a/spec/classes/neutron_plugins_midonet_spec.rb +++ b/spec/classes/neutron_plugins_midonet_spec.rb @@ -4,8 +4,7 @@ describe 'neutron::plugins::midonet' do let :pre_condition do "class { 'neutron::server': password => 'password' } - class { 'neutron': rabbit_password => 'passw0rd' } - package { 'python-networking-midonet': }" + class { 'neutron': rabbit_password => 'passw0rd' }" end let :default_params do @@ -15,7 +14,7 @@ describe 'neutron::plugins::midonet' do :keystone_username => 'neutron', :keystone_password => 'test_midonet', :keystone_tenant => 'services', - :purge_config => false, + :purge_config => false, } end @@ -35,6 +34,11 @@ describe 'neutron::plugins::midonet' do params.merge!(default_params) end + it 'should install package python-networking-midonet' do + is_expected.to contain_package('python-networking-midonet').with( + :ensure => 'present') + end + it 'should create plugin symbolic link' do is_expected.to contain_file('/etc/neutron/plugin.ini').with( :ensure => 'link',