diff options
| author | Rick Harris <rick.harris@rackspace.com> | 2010-12-30 14:09:16 -0600 |
|---|---|---|
| committer | Rick Harris <rick.harris@rackspace.com> | 2010-12-30 14:09:16 -0600 |
| commit | 601b19291a7cf1bcda7bcd4ebf27e4eefe3e28fd (patch) | |
| tree | 0b02680d340843d5d646ec7d800a672d51ed26b4 /nova | |
| parent | 2a08bed775aef2574d362cee6b7883469bbd2e09 (diff) | |
| download | nova-601b19291a7cf1bcda7bcd4ebf27e4eefe3e28fd.tar.gz nova-601b19291a7cf1bcda7bcd4ebf27e4eefe3e28fd.tar.xz nova-601b19291a7cf1bcda7bcd4ebf27e4eefe3e28fd.zip | |
Calling compute api directly from OpenStack image create
Diffstat (limited to 'nova')
| -rw-r--r-- | nova/api/openstack/images.py | 10 | ||||
| -rw-r--r-- | nova/image/glance.py | 4 |
2 files changed, 5 insertions, 9 deletions
diff --git a/nova/api/openstack/images.py b/nova/api/openstack/images.py index 2ee73480f..867ee5a7e 100644 --- a/nova/api/openstack/images.py +++ b/nova/api/openstack/images.py @@ -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 diff --git a/nova/image/glance.py b/nova/image/glance.py index b61cba10e..cc3192e7c 100644 --- a/nova/image/glance.py +++ b/nova/image/glance.py @@ -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): |
