Support added for metadata

This commit is contained in:
Bilal Baqar 2015-08-09 08:43:08 -07:00
parent e625d03935
commit 1dfdd5098a
8 changed files with 14 additions and 40 deletions

BIN
.coverage

Binary file not shown.

View File

@ -11,7 +11,6 @@ Step by step instructions on using the charm:
juju deploy plumgrid-director
juju add-relation neutron-api neutron-api-plumgrid
juju add-relation neutron-api-plumgrid plumgrid-director
For plumgrid-director to work make the configuration in the neutron-api and neutron-api-plumgrid charms as specified in the configuration section below.
@ -30,7 +29,7 @@ Example Config
neutron-api-plumgrid:
install_sources: 'ppa:plumgrid-team/stable'
install_keys: 'null'
enable-metadata: False
enable-metadata: True
neutron-api:
neutron-plugin: "plumgrid"
plumgrid-virtual-ip: "192.168.100.250"

View File

@ -50,19 +50,6 @@ def install():
add_lcm_key()
@hooks.hook('plumgrid-plugin-relation-joined')
def plumgrid_dir():
'''
This hook is run when relation between neutron-api-plumgrid
and plumgrid-director is made.
'''
ensure_mtu()
ensure_files()
add_lcm_key()
CONFIGS.write_all()
restart_pg()
@hooks.hook('config-changed')
def config_changed():
'''

View File

@ -1 +0,0 @@
pg_dir_hooks.py

View File

@ -1 +0,0 @@
pg_dir_hooks.py

View File

@ -1 +0,0 @@
pg_dir_hooks.py

View File

@ -52,8 +52,7 @@ class PGDirHooksTests(CharmTestCase):
self.configure_sources.assert_called_with(update=True)
self.apt_install.assert_has_calls([
call(_pkgs, fatal=True,
options=['--force-yes',
'--option=Dpkg::Options::=--force-confold']),
options=['--force-yes']),
])
self.load_iovisor.assert_called_with()
self.ensure_mtu.assert_called_with()
@ -68,8 +67,7 @@ class PGDirHooksTests(CharmTestCase):
self.configure_sources.assert_called_with(update=True)
self.apt_install.assert_has_calls([
call(_pkgs, fatal=True,
options=['--force-yes',
'--option=Dpkg::Options::=--force-confold']),
options=['--force-yes']),
])
self.load_iovisor.assert_called_with()
self.ensure_mtu.assert_called_with()
@ -78,13 +76,6 @@ class PGDirHooksTests(CharmTestCase):
self.CONFIGS.write_all.assert_called_with()
self.restart_pg.assert_called_with()
def test_neutron_joined(self):
self._call_hook('plumgrid-plugin-relation-joined')
self.ensure_mtu.assert_called_with()
self.ensure_files.assert_called_with()
self.add_lcm_key.assert_called_with()
self.CONFIGS.write_all.assert_called_with()
self.restart_pg.assert_called_with()
def test_stop(self):
_pkgs = ['plumgrid-lxc', 'iovisor-dkms']

View File

@ -50,9 +50,9 @@ class TestPGDirUtils(CharmTestCase):
self.os_release.return_value = 'trusty'
templating.OSConfigRenderer.side_effect = _mock_OSConfigRenderer
_regconfs = nutils.register_configs()
confs = ['/var/lib/libvirt/filesystems/plumgrid/etc/keepalived/keepalived.conf',
'/var/lib/libvirt/filesystems/plumgrid/opt/pg/etc/plumgrid.conf',
'/var/lib/libvirt/filesystems/plumgrid/opt/pg/sal/nginx/conf.d/default.conf',
confs = ['/var/lib/libvirt/filesystems/plumgrid-data/conf/etc/keepalived.conf',
'/var/lib/libvirt/filesystems/plumgrid-data/conf/pg/plumgrid.conf',
'/var/lib/libvirt/filesystems/plumgrid-data/conf/pg/nginx.conf',
'/var/lib/libvirt/filesystems/plumgrid-data/conf/etc/hostname',
'/var/lib/libvirt/filesystems/plumgrid-data/conf/etc/hosts',
'/var/lib/libvirt/filesystems/plumgrid-data/conf/pg/ifcs.conf']
@ -61,20 +61,20 @@ class TestPGDirUtils(CharmTestCase):
def test_resource_map(self):
_map = nutils.resource_map()
svcs = ['plumgrid']
confs = [nutils.PGKA_CONF]
confs = [nutils.PG_KA_CONF]
[self.assertIn(q_conf, _map.keys()) for q_conf in confs]
self.assertEqual(_map[nutils.PGKA_CONF]['services'], svcs)
self.assertEqual(_map[nutils.PG_KA_CONF]['services'], svcs)
def test_restart_map(self):
_restart_map = nutils.restart_map()
PGKA_CONF = '/var/lib/libvirt/filesystems/plumgrid/etc/keepalived/keepalived.conf'
PG_KA_CONF = '/var/lib/libvirt/filesystems/plumgrid-data/conf/etc/keepalived.conf'
expect = OrderedDict([
(nutils.PG_CONF, ['plumgrid']),
(PGKA_CONF, ['plumgrid']),
(nutils.PGDEF_CONF, ['plumgrid']),
(nutils.PGHN_CONF, ['plumgrid']),
(nutils.PGHS_CONF, ['plumgrid']),
(nutils.PGIFCS_CONF, []),
(PG_KA_CONF, ['plumgrid']),
(nutils.PG_DEF_CONF, ['plumgrid']),
(nutils.PG_HN_CONF, ['plumgrid']),
(nutils.PG_HS_CONF, ['plumgrid']),
(nutils.PG_IFCS_CONF, []),
])
self.assertEqual(expect, _restart_map)
for item in _restart_map: