Validating plumgrid virtual IP before stopping the plumgrid services
This commit is contained in:
parent
cf875680fd
commit
41defd62ad
@ -7,6 +7,7 @@
|
|||||||
|
|
||||||
import sys
|
import sys
|
||||||
import time
|
import time
|
||||||
|
from charmhelpers.core.host import service_running
|
||||||
|
|
||||||
from charmhelpers.core.hookenv import (
|
from charmhelpers.core.hookenv import (
|
||||||
Hooks,
|
Hooks,
|
||||||
@ -21,8 +22,6 @@ from charmhelpers.fetch import (
|
|||||||
configure_sources,
|
configure_sources,
|
||||||
)
|
)
|
||||||
|
|
||||||
from charmhelpers.core.host import service_running
|
|
||||||
|
|
||||||
from pg_dir_utils import (
|
from pg_dir_utils import (
|
||||||
register_configs,
|
register_configs,
|
||||||
restart_pg,
|
restart_pg,
|
||||||
@ -78,15 +77,13 @@ def config_changed():
|
|||||||
if charm_config.changed('plumgrid-license-key'):
|
if charm_config.changed('plumgrid-license-key'):
|
||||||
if post_pg_license():
|
if post_pg_license():
|
||||||
log("PLUMgrid License Posted")
|
log("PLUMgrid License Posted")
|
||||||
if charm_config.changed('network-device-mtu'):
|
|
||||||
ensure_mtu()
|
|
||||||
if charm_config.changed('fabric-interfaces'):
|
if charm_config.changed('fabric-interfaces'):
|
||||||
if not fabric_interface_changed():
|
if not fabric_interface_changed():
|
||||||
log("Fabric interface already set")
|
log("Fabric interface already set")
|
||||||
else:
|
else:
|
||||||
ensure_mtu()
|
|
||||||
stop_pg()
|
stop_pg()
|
||||||
if charm_config.changed('plumgrid-virtual-ip'):
|
if charm_config.changed('plumgrid-virtual-ip'):
|
||||||
|
CONFIGS.write_all()
|
||||||
stop_pg()
|
stop_pg()
|
||||||
if (charm_config.changed('install_sources') or
|
if (charm_config.changed('install_sources') or
|
||||||
charm_config.changed('plumgrid-build') or
|
charm_config.changed('plumgrid-build') or
|
||||||
@ -99,6 +96,7 @@ def config_changed():
|
|||||||
apt_install(pkg, options=['--force-yes'], fatal=True)
|
apt_install(pkg, options=['--force-yes'], fatal=True)
|
||||||
remove_iovisor()
|
remove_iovisor()
|
||||||
load_iovisor()
|
load_iovisor()
|
||||||
|
ensure_mtu()
|
||||||
CONFIGS.write_all()
|
CONFIGS.write_all()
|
||||||
if not service_running('plumgrid'):
|
if not service_running('plumgrid'):
|
||||||
restart_pg()
|
restart_pg()
|
||||||
|
@ -154,7 +154,6 @@ def restart_pg():
|
|||||||
raise ValueError("plumgrid service couldn't be started")
|
raise ValueError("plumgrid service couldn't be started")
|
||||||
else:
|
else:
|
||||||
raise ValueError("libvirt-bin service couldn't be started")
|
raise ValueError("libvirt-bin service couldn't be started")
|
||||||
time.sleep(3)
|
|
||||||
|
|
||||||
|
|
||||||
def stop_pg():
|
def stop_pg():
|
||||||
|
@ -62,10 +62,6 @@ class PGDirHooksTests(CharmTestCase):
|
|||||||
self.load_iovisor.assert_called_with()
|
self.load_iovisor.assert_called_with()
|
||||||
self.ensure_mtu.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):
|
def test_start(self):
|
||||||
self._call_hook('start')
|
self._call_hook('start')
|
||||||
self.test_config.set('plumgrid-license-key', None)
|
self.test_config.set('plumgrid-license-key', None)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user