Calling compute api directly from OpenStack image create

This commit is contained in:
Rick Harris
2010-12-30 14:09:16 -06:00
parent 2a08bed775
commit 601b19291a
2 changed files with 5 additions and 9 deletions
+5 -5
View File
@@ -25,7 +25,7 @@ import nova.image.service
from nova.api.openstack import common
from nova.api.openstack import faults
from nova.compute import api as compute_api
FLAGS = flags.FLAGS
@@ -127,11 +127,11 @@ class Controller(wsgi.Controller):
raise faults.Fault(exc.HTTPNotFound())
def create(self, req):
ctxt = req.environ['nova.context']
context = req.environ['nova.context']
env = self._deserialize(req.body, req)
data = {'instance_id': env["image"]["serverId"],
'name': env["image"]["name"]}
return dict(image=self._service.create(ctxt, data))
instance_id = env["image"]["serverId"]
name = env["image"]["name"]
return compute_api.ComputeAPI().snapshot(context, instance_id, name)
def update(self, req, id):
# Users may not modify public images, and that's all that
-4
View File
@@ -203,10 +203,6 @@ class GlanceImageService(nova.image.service.BaseImageService):
:raises AlreadyExists if the image already exist.
"""
instance_id = data["instance_id"]
name = data["name"]
compute_api.ComputeAPI().snapshot(context, instance_id, name)
# FIXME(sirp): This needs to be reworked for new-style glance
return self.parallax.add_image_metadata(data)
def update(self, context, image_id, data):