Add more log info around 'not found' error

Currently log message on nova api does not
have enough info to debug this problem.

Now, with this patch we included more log
messages to print more info.

Change-Id: I73d80500ebbbe3f896658037e104be15024658ec
Closes-Bug: #1278849
This commit is contained in:
Amandeep 2015-03-03 14:14:13 +05:30
parent a07bf6dc8f
commit 291b4a31c7
1 changed files with 5 additions and 0 deletions

View File

@ -1939,14 +1939,19 @@ class API(base.Base):
# NOTE(ameade): we still need to support integer ids for ec2
try:
if uuidutils.is_uuid_like(instance_id):
LOG.debug("Fetching instance by UUID",
instance_uuid=instance_id)
instance = objects.Instance.get_by_uuid(
context, instance_id, expected_attrs=expected_attrs)
elif strutils.is_int_like(instance_id):
LOG.debug("Fetching instance by numeric id %s", instance_id)
instance = objects.Instance.get_by_id(
context, instance_id, expected_attrs=expected_attrs)
else:
LOG.debug("Failed to fetch instance by id %s", instance_id)
raise exception.InstanceNotFound(instance_id=instance_id)
except exception.InvalidID:
LOG.debug("Invalid instance id %s", instance_id)
raise exception.InstanceNotFound(instance_id=instance_id)
if not self.skip_policy_check: