diff options
| author | Rick Harris <rick.harris@rackspace.com> | 2010-12-30 21:09:27 +0000 |
|---|---|---|
| committer | Tarmac <> | 2010-12-30 21:09:27 +0000 |
| commit | ac6fd2290febed0238b67ac0cd83b220cdbd3efc (patch) | |
| tree | 0b02680d340843d5d646ec7d800a672d51ed26b4 /nova/api | |
| parent | 0880026253d0de67afd7c80415b332f72764457d (diff) | |
| parent | 601b19291a7cf1bcda7bcd4ebf27e4eefe3e28fd (diff) | |
| download | nova-ac6fd2290febed0238b67ac0cd83b220cdbd3efc.tar.gz nova-ac6fd2290febed0238b67ac0cd83b220cdbd3efc.tar.xz nova-ac6fd2290febed0238b67ac0cd83b220cdbd3efc.zip | |
This patch is beginning of XenServer snapshots in nova. It adds:
1. A snapshot() method to the compute API
2. Snapshot to the compute drivers(), stubs for libvirt and fake, and an implementation for xenapi_conn.
3. A `glance` XenServer plugin (modeled after the current `objectstore` plugin).
To test functionally you will need to be running both the Glance API and the Glance Registry.
In order to use the cloudservers tool-chain (cloudservers command-line utility, openstack-api, etc), you will need create a project called 'openstack' or override FLAGS.default_project.
You can verify that snapshots work by using the cloudservers command-line utility to run:
cloudservers image-create <instance-id> <my snapshot name>
The utility itself will generate an exception since we're not returning the appropriate metadata yet (that will be a future commit); however, you can confirm that the snapshot worked by checking the compute-service logs, and verifying the snapshot resides in the glance fs-store directory.
Diffstat (limited to 'nova/api')
| -rw-r--r-- | nova/api/openstack/auth.py | 3 | ||||
| -rw-r--r-- | nova/api/openstack/images.py | 10 |
2 files changed, 8 insertions, 5 deletions
diff --git a/nova/api/openstack/auth.py b/nova/api/openstack/auth.py index e24e58fd3..1dfdd5318 100644 --- a/nova/api/openstack/auth.py +++ b/nova/api/openstack/auth.py @@ -55,7 +55,8 @@ class AuthMiddleware(wsgi.Middleware): if not user: return faults.Fault(webob.exc.HTTPUnauthorized()) - req.environ['nova.context'] = context.RequestContext(user, user) + project = self.auth.get_project(FLAGS.default_project) + req.environ['nova.context'] = context.RequestContext(user, project) return self.application def has_authentication(self, req): diff --git a/nova/api/openstack/images.py b/nova/api/openstack/images.py index ba35fbc78..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,9 +127,11 @@ class Controller(wsgi.Controller): raise faults.Fault(exc.HTTPNotFound()) def create(self, req): - # Only public images are supported for now, so a request to - # make a backup of a server cannot be supproted. - raise faults.Fault(exc.HTTPNotFound()) + context = req.environ['nova.context'] + env = self._deserialize(req.body, req) + 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 |
