Merge "Fixed wrong exceptions use for decommission errors"

This commit is contained in:
Jenkins 2014-04-21 13:22:27 +00:00 committed by Gerrit Code Review
commit 073ded29bf
3 changed files with 17 additions and 5 deletions

View File

@ -23,6 +23,15 @@ class NodeGroupCannotBeScaled(e.SaharaException):
self.code = "NODE_GROUP_CANNOT_BE_SCALED"
class DecommissionError(e.SaharaException):
code = "DECOMMISSION_ERROR"
message = "Failed to decommission cluster"
def __init__(self, message):
if message:
self.message = message
class ClusterCannotBeScaled(e.SaharaException):
def __init__(self, cluster_name, reason):
self.message = ("Cluster %s cannot be scaled : "

View File

@ -19,6 +19,7 @@ import six
from sahara import context
from sahara.openstack.common import timeutils
from sahara.plugins.general import exceptions as ex
from sahara.plugins.general import utils
from sahara.plugins.vanilla.v1_2_1 import config_helper
from sahara.plugins.vanilla.v1_2_1 import run_scripts as run
@ -73,8 +74,9 @@ def decommission_dn(nn, inst_to_be_deleted, survived_inst):
context.sleep(3)
if not all_found:
raise Exception("Cannot finish decommission in %s seconds" %
timeout)
ex.DecommissionError(
"Cannot finish decommission of cluster %s in %d seconds" %
(nn.node_group.cluster, timeout))
def parse_dfs_report(cmd_output):

View File

@ -14,8 +14,8 @@
# limitations under the License.
from sahara import context
from sahara import exceptions as ex
from sahara.openstack.common import timeutils
from sahara.plugins.general import exceptions as ex
from sahara.plugins.general import utils as u
from sahara.plugins.vanilla.v2_3_0 import config
from sahara.plugins.vanilla.v2_3_0 import run_scripts as run
@ -115,8 +115,9 @@ def _check_decommission(cluster, instances, check_func, timeout):
else:
context.sleep(5)
else:
ex.SaharaException("Cannot finish decommission in %d seconds" %
timeout)
ex.DecommissionError(
"Cannot finish decommission of cluster %s in %d seconds" %
(cluster, timeout))
def _check_nodemanagers_decommission(cluster, instances):