diff --git a/.coverage b/.coverage index 7c94385..28653f7 100644 Binary files a/.coverage and b/.coverage differ diff --git a/README.ex b/README.ex index 00ebec1..fc08251 100644 --- a/README.ex +++ b/README.ex @@ -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" diff --git a/hooks/pg_dir_hooks.py b/hooks/pg_dir_hooks.py index 655db3e..53fc93d 100755 --- a/hooks/pg_dir_hooks.py +++ b/hooks/pg_dir_hooks.py @@ -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(): ''' diff --git a/hooks/plumgrid-plugin-relation-joined b/hooks/plumgrid-plugin-relation-joined deleted file mode 120000 index 6530c5a..0000000 --- a/hooks/plumgrid-plugin-relation-joined +++ /dev/null @@ -1 +0,0 @@ -pg_dir_hooks.py \ No newline at end of file diff --git a/hooks/plumgrid-relation-joined b/hooks/plumgrid-relation-joined deleted file mode 120000 index 6530c5a..0000000 --- a/hooks/plumgrid-relation-joined +++ /dev/null @@ -1 +0,0 @@ -pg_dir_hooks.py \ No newline at end of file diff --git a/hooks/start b/hooks/start deleted file mode 120000 index 6530c5a..0000000 --- a/hooks/start +++ /dev/null @@ -1 +0,0 @@ -pg_dir_hooks.py \ No newline at end of file diff --git a/unit_tests/test_pg_dir_hooks.py b/unit_tests/test_pg_dir_hooks.py index e250f06..fe9f21c 100644 --- a/unit_tests/test_pg_dir_hooks.py +++ b/unit_tests/test_pg_dir_hooks.py @@ -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'] diff --git a/unit_tests/test_pg_dir_utils.py b/unit_tests/test_pg_dir_utils.py index bf59add..363f6a8 100644 --- a/unit_tests/test_pg_dir_utils.py +++ b/unit_tests/test_pg_dir_utils.py @@ -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: