Merge lp:~dan-prince/nova/bug719093 into lp:~hudson-openstack/nova/trunk

Proposed by Dan Prince
Status: Merged
Approved by: Soren Hansen
Approved revision: 672
Merged at revision: 672
Proposed branch: lp:~dan-prince/nova/bug719093
Merge into: lp:~hudson-openstack/nova/trunk
Diff against target: 42 lines (+6/-3)
3 files modified
nova/api/ec2/cloud.py (+3/-0)
nova/compute/api.py (+2/-2)
nova/image/s3.py (+1/-1)
To merge this branch: bzr merge lp:~dan-prince/nova/bug719093
Reviewer Review Type Date Requested Status
Soren Hansen (community) Approve
Devin Carlen (community) Approve
Review via email: mp+49746@code.launchpad.net

Description of the change

Fixes issues when running euca-run-instances and euca-describe-image-attribute against the latest nova/trunk EC2 API.

I noticed this late this afternoon and saw some IRC traffic with other users hitting the issue as well.

To post a comment you must log in.
Revision history for this message
Devin Carlen (devcamcar) wrote :

lgtm

review: Approve
Revision history for this message
Christian Berendt (berendt) wrote :

I applied the patch to bzr revision 669 in it's working fine here...

Revision history for this message
Soren Hansen (soren) wrote :

Excellent, thanks!

review: Approve
Revision history for this message
Rick Harris (rconradharris) wrote :

I know this has already been merged but I have a question about:

 - kernel_id = image.get('kernelId', None)
23 + kernel_id = image.get('kernel_id', None)
24 if ramdisk_id is None:
25 - ramdisk_id = image.get('ramdiskId', None)
26 + ramdisk_id = image.get('ramdisk_id', None)

Unfortunately 'kernelId' and 'ramdiskId' are specific to the S3ImageService, so this change will break when used with the GlanceImageService. Instead, the S3ImageService, like all ImageServices, should be exposing only the 'base attribute names': 'ramdisk_id' instead of 'ramdiskId'.

S3ImageService has a method called `map_s3_to_base` which should have done the job here. Could you elaborate more on the specific error relating to these fields?

             image = self.image_service.show(context, image_id)
8 + image = self._format_image(context,
9 + self.image_service.show(context,
10 + image_id))

Calls show() twice. The first `image = self.image_...` assignment can go away.

Revision history for this message
Dan Prince (dan-prince) wrote :

Hey Rick.

On your first point. This change was actually fixed what you just wrote. The S3ImageServer now uses 'kernel_id' and 'ramdisk_id' and this change makes it possible to once again create instances when using S3/EC2.

--

On your second point: Good catch on the duplication show calls. I'll fix this in my branch where I'm making it possible to use S3ImageService with the Openstack API. If you interested in that you can follow #709355.

Dan

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'nova/api/ec2/cloud.py'
2--- nova/api/ec2/cloud.py 2011-02-14 10:56:10 +0000
3+++ nova/api/ec2/cloud.py 2011-02-15 01:01:30 +0000
4@@ -883,6 +883,9 @@
5 % attribute)
6 try:
7 image = self.image_service.show(context, image_id)
8+ image = self._format_image(context,
9+ self.image_service.show(context,
10+ image_id))
11 except IndexError:
12 raise exception.ApiError(_('invalid id: %s') % image_id)
13 result = {'image_id': image_id, 'launchPermission': []}
14
15=== modified file 'nova/compute/api.py'
16--- nova/compute/api.py 2011-01-27 18:48:00 +0000
17+++ nova/compute/api.py 2011-02-15 01:01:30 +0000
18@@ -103,9 +103,9 @@
19 if not is_vpn:
20 image = self.image_service.show(context, image_id)
21 if kernel_id is None:
22- kernel_id = image.get('kernelId', None)
23+ kernel_id = image.get('kernel_id', None)
24 if ramdisk_id is None:
25- ramdisk_id = image.get('ramdiskId', None)
26+ ramdisk_id = image.get('ramdisk_id', None)
27 # No kernel and ramdisk for raw images
28 if kernel_id == str(FLAGS.null_kernel):
29 kernel_id = None
30
31=== modified file 'nova/image/s3.py'
32--- nova/image/s3.py 2011-02-13 19:55:50 +0000
33+++ nova/image/s3.py 2011-02-15 01:01:30 +0000
34@@ -94,7 +94,7 @@
35 if FLAGS.connection_type == 'fake':
36 return {'imageId': 'bar'}
37 result = self.index(context)
38- result = [i for i in result if i['imageId'] == image_id]
39+ result = [i for i in result if i['id'] == image_id]
40 if not result:
41 raise exception.NotFound(_('Image %s could not be found')
42 % image_id)