Fix update nodes in fencers

Update nodes allows the evacuators to initialize the fencers with
fake nodes then update it with correct one and fence.

Change-Id: I9fc54a99b6782138c6c9a76c9cec99e26b638777
This commit is contained in:
Saad Zaher 2017-07-18 15:38:55 +01:00
parent 56efab7b54
commit b1116e787b
3 changed files with 9 additions and 10 deletions

View File

@ -64,8 +64,7 @@ class StandardEvacuator(EvacuatorBaseDriver):
nodes = succeeded_nodes
if enable_fencing:
self.fencer.update_nodes(nodes)
nodes = self.fencer.fence()
nodes = self.fencer.fence(nodes=nodes)
"""
@todo this code needs to be commented for the time being till we fix
nova bug found in state, which always go up afer enable or disable. We

View File

@ -35,20 +35,16 @@ class FencerBaseDriver(object):
file in /etc/freezer/dr.conf (default).
:param nodes: A list of failed nodes to be fenced!
:param fencer_conf: dict contains configuration options loaded
:param fencer_conf: dict contains configuration options loaded
from the config file.
"""
self.nodes = nodes
self.fencer_conf = fencer_conf
def update_nodes(self, nodes):
"""Allows changing the nodes during the evacuation..."""
self.nodes = nodes
@abc.abstractmethod
def fence(self):
"""This function to be implemented by each driver. Each driver will
implement its own fencing logic and the manager will just load it and
"""This function to be implemented by each driver. Each driver will
implement its own fencing logic and the manager will just load it and
call the fence function"""
@abc.abstractmethod

View File

@ -26,14 +26,18 @@ class FencerManager(object):
self.fencer_conf = CONF.get('fencer')
self.nodes = nodes
def fence(self):
def fence(self, nodes=None):
"""
Try to shutdown nodes and wait for configurable amount of times
:return: list of nodes and either they are shutdown or failed
"""
# update the list of nodes if required!
if nodes:
self.nodes = nodes
driver_name = self.fencer_conf['driver']
driver = importutils.import_object(
driver_name,
self.nodes,
self.fencer_conf
)
LOG.debug('Loaded fencing driver {0} with config: '