Merge "Define a new InstanceNotMapped exception"
This commit is contained in:
commit
81fc8ac6a8
@ -447,6 +447,11 @@ class InstanceNotFound(ComputeResourceNotFound):
|
||||
msg_fmt = _("The instance '%(name)s' could not be found")
|
||||
|
||||
|
||||
class InstanceNotMapped(ComputeResourceNotFound):
|
||||
msg_fmt = _("The mapped compute node for instance '%(uuid)s' "
|
||||
"could not be found.")
|
||||
|
||||
|
||||
class ComputeNodeNotFound(ComputeResourceNotFound):
|
||||
msg_fmt = _("The compute node %(name)s could not be found")
|
||||
|
||||
|
@ -170,7 +170,7 @@ class ModelRoot(nx.DiGraph, base.Model):
|
||||
node = self._get_by_uuid(node_uuid)
|
||||
if isinstance(node, element.ComputeNode):
|
||||
return node
|
||||
raise exception.ComputeNodeNotFound(name=instance_uuid)
|
||||
raise exception.InstanceNotMapped(uuid=instance_uuid)
|
||||
|
||||
@lockutils.synchronized("model_root")
|
||||
def get_all_instances(self):
|
||||
@ -211,7 +211,7 @@ class ModelRoot(nx.DiGraph, base.Model):
|
||||
key=lambda inst: inst.uuid):
|
||||
try:
|
||||
self.get_node_by_instance_uuid(instance.uuid)
|
||||
except (exception.InstanceNotFound, exception.ComputeNodeNotFound):
|
||||
except exception.ComputeResourceNotFound:
|
||||
root.append(instance.as_xml_element())
|
||||
|
||||
return etree.tostring(root, pretty_print=True).decode('utf-8')
|
||||
|
@ -160,7 +160,7 @@ class NovaNotification(base.NotificationEndpoint):
|
||||
current_node = (
|
||||
self.cluster_data_model.get_node_by_instance_uuid(
|
||||
instance.uuid))
|
||||
except exception.ComputeNodeNotFound as exc:
|
||||
except exception.ComputeResourceNotFound as exc:
|
||||
LOG.exception(exc)
|
||||
# If we can't create the node,
|
||||
# we consider the instance as unmapped
|
||||
|
Loading…
x
Reference in New Issue
Block a user