summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRick Harris <rick.harris@rackspace.com>2011-02-25 02:51:14 +0000
committerRick Harris <rick.harris@rackspace.com>2011-02-25 02:51:14 +0000
commite3d6dc70a6b77d80afcf87473bc79549540ac4ce (patch)
tree74ab6350de46b15f7b39a54d7f0718f4e0d9c71a
parentec9ede003c839248ca9593c03160a23ff8ec0db1 (diff)
downloadnova-e3d6dc70a6b77d80afcf87473bc79549540ac4ce.tar.gz
nova-e3d6dc70a6b77d80afcf87473bc79549540ac4ce.tar.xz
nova-e3d6dc70a6b77d80afcf87473bc79549540ac4ce.zip
Removing unecessary nokernel stuff
-rw-r--r--nova/api/openstack/servers.py51
-rw-r--r--plugins/xenserver/xenapi/etc/xapi.d/plugins/glance4
2 files changed, 29 insertions, 26 deletions
diff --git a/nova/api/openstack/servers.py b/nova/api/openstack/servers.py
index c8c94f1fd..f51da0cdd 100644
--- a/nova/api/openstack/servers.py
+++ b/nova/api/openstack/servers.py
@@ -136,28 +136,6 @@ class Controller(wsgi.Controller):
return faults.Fault(exc.HTTPNotFound())
return exc.HTTPAccepted()
- def _get_kernel_ramdisk_from_image(self, req, image_id):
- """
- Machine images are associated with Kernels and Ramdisk images via
- metadata stored in Glance as 'image_properties'
- """
- # FIXME(sirp): Currently Nova requires us to specify the `null_kernel`
- # identifier ('nokernel') to indicate a RAW (or VHD) image. It would
- # be better if we could omit the kernel_id and ramdisk_id properties
- # on the image
- def lookup(image, param):
- _image_id = image['id']
- try:
- return image['properties'][param]
- except KeyError:
- LOG.debug(
- _("%(param)s property not found for image %(_image_id)s") %
- locals())
- return None
-
- image = self._image_service.show(req.environ['nova.context'], image_id)
- return lookup(image, 'kernel_id'), lookup(image, 'ramdisk_id')
-
def create(self, req):
""" Creates a new server for a given user """
env = self._deserialize(req.body, req)
@@ -367,3 +345,32 @@ class Controller(wsgi.Controller):
action=item.action,
error=item.error))
return dict(actions=actions)
+
+ def _get_kernel_ramdisk_from_image(self, req, image_id):
+ """Retrevies kernel and ramdisk IDs from Glance
+
+ Only 'machine' (ami) type use kernel and ramdisk outside of the
+ image.
+ """
+ # FIXME(sirp): Since we're retrieving the kernel_id from an
+ # image_property, this means only Glance is supported.
+ # The BaseImageService needs to expose a consistent way of accessing
+ # kernel_id and ramdisk_id
+ image = self._image_service.show(req.environ['nova.context'], image_id)
+
+ if image['type'] != 'machine':
+ return None, None
+
+ try:
+ kernel_id = image['properties']['kernel_id']
+ except KeyError:
+ raise exception.NotFound(
+ _("Kernel not found for image %(image_id)s") % locals())
+
+ try:
+ ramdisk_id = image['properties']['ramdisk_id']
+ except KeyError:
+ raise exception.NotFound(
+ _("Ramdisk not found for image %(image_id)s") % locals())
+
+ return kernel_id, ramdisk_id
diff --git a/plugins/xenserver/xenapi/etc/xapi.d/plugins/glance b/plugins/xenserver/xenapi/etc/xapi.d/plugins/glance
index 869d46e70..18e4866f7 100644
--- a/plugins/xenserver/xenapi/etc/xapi.d/plugins/glance
+++ b/plugins/xenserver/xenapi/etc/xapi.d/plugins/glance
@@ -200,8 +200,6 @@ def _upload_tarball(staging_path, image_id, glance_host, glance_port):
# to request
conn.putrequest('PUT', '/images/%s' % image_id)
- # FIXME(sirp): nokernel signals Nova to use a raw image. This is defined by
- # FLAGS.null_kernel. Is there a way to get rid of this?
# TODO(sirp): make `store` configurable
headers = {
'content-type': 'application/octet-stream',
@@ -210,8 +208,6 @@ def _upload_tarball(staging_path, image_id, glance_host, glance_port):
'x-image-meta-status': 'queued',
'x-image-meta-store': 'file',
'x-image-meta-type': 'vhd',
- 'x-image-meta-property-kernel-id': 'nokernel',
- 'x-image-meta-property-ramdisk-id': 'noramdisk',
'x-image-meta-property-container-format': 'tarball',
}
for header, value in headers.iteritems():