diff --git a/hooks/pg_dir_hooks.py b/hooks/pg_dir_hooks.py index 4d24fe2..94b547c 100644 --- a/hooks/pg_dir_hooks.py +++ b/hooks/pg_dir_hooks.py @@ -7,6 +7,7 @@ import sys import time +from charmhelpers.core.host import service_running from charmhelpers.core.hookenv import ( Hooks, @@ -21,8 +22,6 @@ from charmhelpers.fetch import ( configure_sources, ) -from charmhelpers.core.host import service_running - from pg_dir_utils import ( register_configs, restart_pg, @@ -78,15 +77,13 @@ def config_changed(): if charm_config.changed('plumgrid-license-key'): if post_pg_license(): log("PLUMgrid License Posted") - if charm_config.changed('network-device-mtu'): - ensure_mtu() if charm_config.changed('fabric-interfaces'): if not fabric_interface_changed(): log("Fabric interface already set") else: - ensure_mtu() stop_pg() if charm_config.changed('plumgrid-virtual-ip'): + CONFIGS.write_all() stop_pg() if (charm_config.changed('install_sources') or charm_config.changed('plumgrid-build') or @@ -99,6 +96,7 @@ def config_changed(): apt_install(pkg, options=['--force-yes'], fatal=True) remove_iovisor() load_iovisor() + ensure_mtu() CONFIGS.write_all() if not service_running('plumgrid'): restart_pg() diff --git a/hooks/pg_dir_utils.py b/hooks/pg_dir_utils.py index 4023456..697ecbf 100644 --- a/hooks/pg_dir_utils.py +++ b/hooks/pg_dir_utils.py @@ -154,7 +154,6 @@ def restart_pg(): raise ValueError("plumgrid service couldn't be started") else: raise ValueError("libvirt-bin service couldn't be started") - time.sleep(3) def stop_pg(): diff --git a/unit_tests/test_pg_dir_hooks.py b/unit_tests/test_pg_dir_hooks.py index 04065bd..c453ca8 100644 --- a/unit_tests/test_pg_dir_hooks.py +++ b/unit_tests/test_pg_dir_hooks.py @@ -62,10 +62,6 @@ class PGDirHooksTests(CharmTestCase): self.load_iovisor.assert_called_with() self.ensure_mtu.assert_called_with() - def test_config_changed_hook(self): - self.add_lcm_key.return_value = 1 - self._call_hook('config-changed') - def test_start(self): self._call_hook('start') self.test_config.set('plumgrid-license-key', None)