Allow the evacuator to enable passing shared storage parameter to nova
Boolean flag will be set to True in case of compute nodes are running on a shared storage and will be False otherwise Depends-On: Ie6f3f12efafbca530271d6771fac83480ee19000 Change-Id: I46e9eb2e1ace17959a02b3107e5ad3e85e2cd851 implements: blueprint dr-enable-shared-storage
This commit is contained in:
parent
60459fd6e3
commit
3c6c6b8697
|
@ -130,6 +130,11 @@ _EVACUATION = [
|
||||||
help='Number of retries to put node in maintenance mode before '
|
help='Number of retries to put node in maintenance mode before '
|
||||||
'reporting failure to evacuate the node',
|
'reporting failure to evacuate the node',
|
||||||
dest='retries'),
|
dest='retries'),
|
||||||
|
cfg.BoolOpt('shared-storage',
|
||||||
|
default=False,
|
||||||
|
help='Set this option to True in case your compute nodes are '
|
||||||
|
'running on a shared storage or False if not',
|
||||||
|
dest='shared_storage'),
|
||||||
cfg.DictOpt(
|
cfg.DictOpt(
|
||||||
'options',
|
'options',
|
||||||
default={},
|
default={},
|
||||||
|
|
|
@ -114,11 +114,13 @@ class OSClient:
|
||||||
|
|
||||||
return neutron_agents
|
return neutron_agents
|
||||||
|
|
||||||
def evacuate(self, nodes):
|
def evacuate(self, nodes, shared_storage=False):
|
||||||
"""
|
"""
|
||||||
Will get the hypervisors and list all running VMs on it and then start
|
Will get the hypervisors and list all running VMs on it and then start
|
||||||
Evacuating one by one ...
|
Evacuating one by one ...
|
||||||
:param nodes: List of nodes to be evacuated !
|
:param nodes: List of nodes to be evacuated !
|
||||||
|
:param shared_storage: Boolean, True if your compute nodes are running
|
||||||
|
under shared storage and False otherwise
|
||||||
:return: List of nodes with VMs that were running on that node
|
:return: List of nodes with VMs that were running on that node
|
||||||
"""
|
"""
|
||||||
auth_session = session.Session(auth=self.auth_session.auth)
|
auth_session = session.Session(auth=self.auth_session.auth)
|
||||||
|
@ -134,7 +136,7 @@ class OSClient:
|
||||||
for server in hypervisor.servers:
|
for server in hypervisor.servers:
|
||||||
try:
|
try:
|
||||||
nova.servers.evacuate(server.get('uuid'),
|
nova.servers.evacuate(server.get('uuid'),
|
||||||
on_shared_storage=True)
|
on_shared_storage=shared_storage)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
LOG.error(e)
|
LOG.error(e)
|
||||||
host = {'host': node.get(
|
host = {'host': node.get(
|
||||||
|
|
|
@ -22,19 +22,22 @@ class EvacuatorBaseDriver(object):
|
||||||
a unified interface
|
a unified interface
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, wait, retries, **kwargs):
|
def __init__(self, wait, retries, shared_storage, **kwargs):
|
||||||
"""
|
"""
|
||||||
Initialize Evacuation driver with the config args
|
Initialize Evacuation driver with the config args
|
||||||
:param wait: time in seconds that the evcauator should wait before
|
:param wait: time in seconds that the evcauator should wait before
|
||||||
retrying to disable the node
|
retrying to disable the node
|
||||||
:param retries: Number of times the evacuator will try to disable the
|
:param retries: Number of times the evacuator will try to disable the
|
||||||
compute node
|
compute node
|
||||||
|
:param shared_storage: Boolean; True if the compute nodes are running
|
||||||
|
on shared storage and False otherwise
|
||||||
:param kwargs: Dict of arguments that any future driver may need to
|
:param kwargs: Dict of arguments that any future driver may need to
|
||||||
load it from the config file
|
load it from the config file
|
||||||
:return: None
|
:return: None
|
||||||
"""
|
"""
|
||||||
self.wait = wait
|
self.wait = wait
|
||||||
self.retries = retries
|
self.retries = retries
|
||||||
|
self.shared_storage = shared_storage
|
||||||
self.options = kwargs
|
self.options = kwargs
|
||||||
|
|
||||||
@abc.abstractmethod
|
@abc.abstractmethod
|
||||||
|
|
|
@ -30,6 +30,7 @@ class EvacuationManager(object):
|
||||||
evcuation_conf.get('driver'),
|
evcuation_conf.get('driver'),
|
||||||
evcuation_conf.get('wait'),
|
evcuation_conf.get('wait'),
|
||||||
evcuation_conf.get('retries'),
|
evcuation_conf.get('retries'),
|
||||||
|
evcuation_conf.get('shared_storage'),
|
||||||
**evcuation_conf.get('options')
|
**evcuation_conf.get('options')
|
||||||
)
|
)
|
||||||
self.enable_fencing = enable_fencing
|
self.enable_fencing = enable_fencing
|
||||||
|
|
|
@ -21,8 +21,9 @@ LOG = log.getLogger(__name__)
|
||||||
|
|
||||||
class StandardEvacuator(EvacuatorBaseDriver):
|
class StandardEvacuator(EvacuatorBaseDriver):
|
||||||
|
|
||||||
def __init__(self, wait, retires, **kwargs):
|
def __init__(self, wait, retires, shared_storage, **kwargs):
|
||||||
super(StandardEvacuator, self).__init__(wait, retires, **kwargs)
|
super(StandardEvacuator, self).__init__(wait, retires, shared_storage,
|
||||||
|
**kwargs)
|
||||||
self.client = get_os_client()
|
self.client = get_os_client()
|
||||||
|
|
||||||
def get_node_instances(self, node):
|
def get_node_instances(self, node):
|
||||||
|
@ -38,7 +39,7 @@ class StandardEvacuator(EvacuatorBaseDriver):
|
||||||
return self.client.get_node_status(node)
|
return self.client.get_node_status(node)
|
||||||
|
|
||||||
def evacuate_nodes(self, nodes):
|
def evacuate_nodes(self, nodes):
|
||||||
return self.client.evacuate(nodes)
|
return self.client.evacuate(nodes, shared_storage=self.shared_storage)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -16,11 +16,12 @@ from freezer_dr.evacuators.common.driver import EvacuatorBaseDriver
|
||||||
|
|
||||||
class DummyEvacuator(EvacuatorBaseDriver):
|
class DummyEvacuator(EvacuatorBaseDriver):
|
||||||
""" Evacuation driver that does nothing. Useful for testing other parts
|
""" Evacuation driver that does nothing. Useful for testing other parts
|
||||||
of OSHA.
|
of Freezer-DR.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, wait, retires, **kwargs):
|
def __init__(self, wait, retires, shared_storage, **kwargs):
|
||||||
super(DummyEvacuator, self).__init__(wait, retires, **kwargs)
|
super(DummyEvacuator, self).__init__(wait, retires, shared_storage,
|
||||||
|
**kwargs)
|
||||||
|
|
||||||
def disable_node(self, node):
|
def disable_node(self, node):
|
||||||
return True
|
return True
|
||||||
|
|
Loading…
Reference in New Issue