Update Midonet neutron plugin to 5.x

The newly released plugin no longer relies on
a custom DHCP agent to work. Also, instead of
completely overriding the neutron-db-sync we
extend it with a subproject command.

Change-Id: Ibd7cd38b2bcc2a0dc4814fb77cda8f90de7232bb
This commit is contained in:
Alex Ruiz Estradera 2016-08-26 10:39:07 +02:00
parent 7ad7a07e50
commit 6570e84597
4 changed files with 29 additions and 9 deletions

View File

@ -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}")
}

View File

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

View File

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

View File

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