Validating plumgrid virtual IP before stopping the plumgrid services

This commit is contained in:
Junaid Ali 2016-03-21 22:13:54 +05:00
parent cf875680fd
commit 41defd62ad
3 changed files with 3 additions and 10 deletions

View File

@ -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()

View File

@ -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():

View File

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