diff options
| author | Soren Hansen <soren@linux2go.dk> | 2011-03-14 17:50:33 +0000 |
|---|---|---|
| committer | Tarmac <> | 2011-03-14 17:50:33 +0000 |
| commit | e787e03d944d96cd51f203045179430bb89bb933 (patch) | |
| tree | 4fe7be686f35edd8aa2e9d5685b6c0988ad538ed /nova | |
| parent | 7fde254ec53aeb88301e5592853961b2b9c87ef4 (diff) | |
| parent | d250d522b5d6c164435fc254223ff9a0f055cf05 (diff) | |
| download | nova-e787e03d944d96cd51f203045179430bb89bb933.tar.gz nova-e787e03d944d96cd51f203045179430bb89bb933.tar.xz nova-e787e03d944d96cd51f203045179430bb89bb933.zip | |
Only include kernel and ramdisk ID in meta-data output if they are actually set.
Diffstat (limited to 'nova')
| -rw-r--r-- | nova/api/ec2/cloud.py | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/nova/api/ec2/cloud.py b/nova/api/ec2/cloud.py index cadda97db..40a9da0e7 100644 --- a/nova/api/ec2/cloud.py +++ b/nova/api/ec2/cloud.py @@ -147,8 +147,6 @@ class CloudController(object): instance_ref['id']) ec2_id = ec2utils.id_to_ec2_id(instance_ref['id']) image_ec2_id = self._image_ec2_id(instance_ref['image_id'], 'machine') - k_ec2_id = self._image_ec2_id(instance_ref['kernel_id'], 'kernel') - r_ec2_id = self._image_ec2_id(instance_ref['ramdisk_id'], 'ramdisk') data = { 'user-data': base64.b64decode(instance_ref['user_data']), 'meta-data': { @@ -167,8 +165,6 @@ class CloudController(object): 'instance-type': instance_ref['instance_type'], 'local-hostname': hostname, 'local-ipv4': address, - 'kernel-id': k_ec2_id, - 'ramdisk-id': r_ec2_id, 'placement': {'availability-zone': availability_zone}, 'public-hostname': hostname, 'public-ipv4': floating_ip or '', @@ -176,6 +172,13 @@ class CloudController(object): 'reservation-id': instance_ref['reservation_id'], 'security-groups': '', 'mpi': mpi}} + + for image_type in ['kernel', 'ramdisk']: + if '%s_id' % image_type in instance_ref: + ec2_id = self._image_ec2_id(instance_ref['%s_id' % image_type], + image_type) + data['meta-data']['%s-id' % image_type] = ec2_id + if False: # TODO(vish): store ancestor ids data['ancestor-ami-ids'] = [] if False: # TODO(vish): store product codes |
