diff --git a/nova/tests/unit/volume/test_cinder.py b/nova/tests/unit/volume/test_cinder.py index 7b325a3a60c4..c7d059aa545e 100644 --- a/nova/tests/unit/volume/test_cinder.py +++ b/nova/tests/unit/volume/test_cinder.py @@ -201,6 +201,9 @@ class CinderApiTestCase(test.NoDBTestCase): 'attach_status': 'detached', 'availability_zone': 'zone2'} instance = fake_instance_obj(self.ctx) + # Simulate _provision_instances in the compute API; the instance is not + # created in the API so the instance will not have an id attribute set. + delattr(instance, 'id') self.assertRaises(exception.InvalidVolume, self.api.check_availability_zone, diff --git a/nova/volume/cinder.py b/nova/volume/cinder.py index 91195efdb454..bd99dacd28ea 100644 --- a/nova/volume/cinder.py +++ b/nova/volume/cinder.py @@ -278,7 +278,7 @@ class API(object): msg = _("Instance %(instance)s and volume %(vol)s are not in " "the same availability_zone. Instance is in " "%(ins_zone)s. Volume is in %(vol_zone)s") % { - "instance": instance['id'], + "instance": instance.uuid, "vol": volume['id'], 'ins_zone': instance_az, 'vol_zone': volume['availability_zone']}