Merge "Fix update nodes in fencers"

This commit is contained in:
Jenkins 2017-07-20 14:59:28 +00:00 committed by Gerrit Code Review
commit 4962bae5a7
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: '