diff options
| author | Michael Still <mikal@stillhq.com> | 2012-04-08 11:50:12 +1000 |
|---|---|---|
| committer | Michael Still <mikal@stillhq.com> | 2012-05-01 07:12:45 +1000 |
| commit | 58af96d3e01c7fbe993344374190d8afe1a1d0ff (patch) | |
| tree | 476815a477ad76493505c36f0655bbbceca0853d /nova/api | |
| parent | 62bcf379597c15606fca6a0255dc731a048a5029 (diff) | |
Migrate block_device_mapping to use instance uuids.
This started out as wanting cleanup_volumes to take a UUID instead
of an instance ID, and ended up as a wander through the joys of
schema updates. I am assuming that we actually want to transition
these tables across to using the instance UUID instead of just the
ID.
This is my first attempt at a schema update, so please review this
patch with skepticism. Resolves bug 977975. Partially resolves
blueprint finish-uuid-conversion.
Change-Id: Ib5a6f8a872ea0530e201c70e9ac01cd14f82c557
Diffstat (limited to 'nova/api')
| -rw-r--r-- | nova/api/ec2/cloud.py | 8 | ||||
| -rw-r--r-- | nova/api/metadata/handler.py | 2 |
2 files changed, 5 insertions, 5 deletions
diff --git a/nova/api/ec2/cloud.py b/nova/api/ec2/cloud.py index b116249d7..e6eef7794 100644 --- a/nova/api/ec2/cloud.py +++ b/nova/api/ec2/cloud.py @@ -998,7 +998,7 @@ class CloudController(object): def _format_attr_block_device_mapping(instance, result): tmp = {} self._format_instance_root_device_name(instance, tmp) - self._format_instance_bdm(context, instance_id, + self._format_instance_bdm(context, instance['uuid'], tmp['rootDeviceName'], result) def _format_attr_disable_api_termination(instance, result): @@ -1098,13 +1098,13 @@ class CloudController(object): instances_set.append(i) return {'instancesSet': instances_set} - def _format_instance_bdm(self, context, instance_id, root_device_name, + def _format_instance_bdm(self, context, instance_uuid, root_device_name, result): """Format InstanceBlockDeviceMappingResponseItemType""" root_device_type = 'instance-store' mapping = [] for bdm in db.block_device_mapping_get_all_by_instance(context, - instance_id): + instance_uuid): volume_id = bdm['volume_id'] if (volume_id is None or bdm['no_device']): continue @@ -1220,7 +1220,7 @@ class CloudController(object): i['launchTime'] = instance['created_at'] i['amiLaunchIndex'] = instance['launch_index'] self._format_instance_root_device_name(instance, i) - self._format_instance_bdm(context, instance_id, + self._format_instance_bdm(context, instance['uuid'], i['rootDeviceName'], i) host = instance['host'] services = db.service_get_all_by_host(context.elevated(), host) diff --git a/nova/api/metadata/handler.py b/nova/api/metadata/handler.py index 1ad8a5413..9929e6e66 100644 --- a/nova/api/metadata/handler.py +++ b/nova/api/metadata/handler.py @@ -99,7 +99,7 @@ class MetadataRequestHandler(wsgi.Application): # 'ephemeralN', 'swap' and ebs for bdm in db.block_device_mapping_get_all_by_instance( - ctxt, instance_ref['id']): + ctxt, instance_ref['uuid']): if bdm['no_device']: continue |
