Specific exception for stale cluster state was added.
Specific exception should be thrown when cluster state is stale. Current usage is to raise this exception if compute_model.state is True. Bug was describeid by Jean-Emile DARTOIS. Change-Id: Iaddb4cc8007c51bb14759c9da829751e834499d0 Closes-Bug: #1621855
This commit is contained in:
@@ -340,6 +340,10 @@ class MetricCollectorNotDefined(WatcherException):
|
|||||||
msg_fmt = _("The metrics resource collector is not defined")
|
msg_fmt = _("The metrics resource collector is not defined")
|
||||||
|
|
||||||
|
|
||||||
|
class ClusterStateStale(WatcherException):
|
||||||
|
msg_fmt = _("The cluster state is stale")
|
||||||
|
|
||||||
|
|
||||||
class ClusterDataModelCollectionError(WatcherException):
|
class ClusterDataModelCollectionError(WatcherException):
|
||||||
msg_fmt = _("The cluster data model '%(cdm)s' could not be built")
|
msg_fmt = _("The cluster data model '%(cdm)s' could not be built")
|
||||||
|
|
||||||
|
|||||||
@@ -185,6 +185,9 @@ class BaseStrategy(loadable.Loadable):
|
|||||||
if not self._compute_model:
|
if not self._compute_model:
|
||||||
raise exception.ClusterStateNotDefined()
|
raise exception.ClusterStateNotDefined()
|
||||||
|
|
||||||
|
if self._compute_model.stale:
|
||||||
|
raise exception.ClusterStateStale()
|
||||||
|
|
||||||
return self._compute_model
|
return self._compute_model
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
|
|||||||
@@ -384,12 +384,16 @@ class BasicConsolidation(base.ServerConsolidationBaseStrategy):
|
|||||||
|
|
||||||
def pre_execute(self):
|
def pre_execute(self):
|
||||||
LOG.info(_LI("Initializing Server Consolidation"))
|
LOG.info(_LI("Initializing Server Consolidation"))
|
||||||
|
|
||||||
if not self.compute_model:
|
if not self.compute_model:
|
||||||
raise exception.ClusterStateNotDefined()
|
raise exception.ClusterStateNotDefined()
|
||||||
|
|
||||||
if len(self.compute_model.get_all_compute_nodes()) == 0:
|
if len(self.compute_model.get_all_compute_nodes()) == 0:
|
||||||
raise exception.ClusterEmpty()
|
raise exception.ClusterEmpty()
|
||||||
|
|
||||||
|
if self.compute_model.stale:
|
||||||
|
raise exception.ClusterStateStale()
|
||||||
|
|
||||||
LOG.debug(self.compute_model.to_string())
|
LOG.debug(self.compute_model.to_string())
|
||||||
|
|
||||||
def do_execute(self):
|
def do_execute(self):
|
||||||
|
|||||||
@@ -230,6 +230,9 @@ class OutletTempControl(base.ThermalOptimizationBaseStrategy):
|
|||||||
if not self.compute_model:
|
if not self.compute_model:
|
||||||
raise wexc.ClusterStateNotDefined()
|
raise wexc.ClusterStateNotDefined()
|
||||||
|
|
||||||
|
if self.compute_model.stale:
|
||||||
|
raise wexc.ClusterStateStale()
|
||||||
|
|
||||||
LOG.debug(self.compute_model.to_string())
|
LOG.debug(self.compute_model.to_string())
|
||||||
|
|
||||||
def do_execute(self):
|
def do_execute(self):
|
||||||
|
|||||||
@@ -293,6 +293,9 @@ class UniformAirflow(base.BaseStrategy):
|
|||||||
if not self.compute_model:
|
if not self.compute_model:
|
||||||
raise wexc.ClusterStateNotDefined()
|
raise wexc.ClusterStateNotDefined()
|
||||||
|
|
||||||
|
if self.compute_model.stale:
|
||||||
|
raise wexc.ClusterStateStale()
|
||||||
|
|
||||||
LOG.debug(self.compute_model.to_string())
|
LOG.debug(self.compute_model.to_string())
|
||||||
|
|
||||||
def do_execute(self):
|
def do_execute(self):
|
||||||
|
|||||||
@@ -487,6 +487,9 @@ class VMWorkloadConsolidation(base.ServerConsolidationBaseStrategy):
|
|||||||
if not self.compute_model:
|
if not self.compute_model:
|
||||||
raise exception.ClusterStateNotDefined()
|
raise exception.ClusterStateNotDefined()
|
||||||
|
|
||||||
|
if self.compute_model.stale:
|
||||||
|
raise exception.ClusterStateStale()
|
||||||
|
|
||||||
LOG.debug(self.compute_model.to_string())
|
LOG.debug(self.compute_model.to_string())
|
||||||
|
|
||||||
def do_execute(self):
|
def do_execute(self):
|
||||||
|
|||||||
@@ -283,6 +283,9 @@ class WorkloadBalance(base.WorkloadStabilizationBaseStrategy):
|
|||||||
if not self.compute_model:
|
if not self.compute_model:
|
||||||
raise wexc.ClusterStateNotDefined()
|
raise wexc.ClusterStateNotDefined()
|
||||||
|
|
||||||
|
if self.compute_model.stale:
|
||||||
|
raise wexc.ClusterStateStale()
|
||||||
|
|
||||||
LOG.debug(self.compute_model.to_string())
|
LOG.debug(self.compute_model.to_string())
|
||||||
|
|
||||||
def do_execute(self):
|
def do_execute(self):
|
||||||
|
|||||||
@@ -420,6 +420,9 @@ class WorkloadStabilization(base.WorkloadStabilizationBaseStrategy):
|
|||||||
if not self.compute_model:
|
if not self.compute_model:
|
||||||
raise exception.ClusterStateNotDefined()
|
raise exception.ClusterStateNotDefined()
|
||||||
|
|
||||||
|
if self.compute_model.stale:
|
||||||
|
raise exception.ClusterStateStale()
|
||||||
|
|
||||||
self.weights = self.input_parameters.weights
|
self.weights = self.input_parameters.weights
|
||||||
self.metrics = self.input_parameters.metrics
|
self.metrics = self.input_parameters.metrics
|
||||||
self.thresholds = self.input_parameters.thresholds
|
self.thresholds = self.input_parameters.thresholds
|
||||||
|
|||||||
Reference in New Issue
Block a user