diff options
| author | Rick Harris <rick.harris@rackspace.com> | 2011-01-06 21:37:33 -0600 |
|---|---|---|
| committer | Rick Harris <rick.harris@rackspace.com> | 2011-01-06 21:37:33 -0600 |
| commit | 3bf9bc6f6c0fbf90e3f4eab68a9bd99d85fcc422 (patch) | |
| tree | fb87ea36fb400d76698d498319d8e95092f258d7 /nova/compute | |
| parent | dd1e36b9690a2c2de18c565c496b25295a13d0aa (diff) | |
| download | nova-3bf9bc6f6c0fbf90e3f4eab68a9bd99d85fcc422.tar.gz nova-3bf9bc6f6c0fbf90e3f4eab68a9bd99d85fcc422.tar.xz nova-3bf9bc6f6c0fbf90e3f4eab68a9bd99d85fcc422.zip | |
Reserving image before uploading
Diffstat (limited to 'nova/compute')
| -rw-r--r-- | nova/compute/api.py | 10 | ||||
| -rw-r--r-- | nova/compute/manager.py | 4 |
2 files changed, 11 insertions, 3 deletions
diff --git a/nova/compute/api.py b/nova/compute/api.py index 07c69bd31..5bb6fac91 100644 --- a/nova/compute/api.py +++ b/nova/compute/api.py @@ -263,10 +263,18 @@ class ComputeAPI(base.Base): """Snapshot the given instance.""" instance = self.db.instance_get_by_internal_id(context, instance_id) host = instance['host'] + + image_service = utils.import_object(FLAGS.image_service) + + data = {'name': name, 'is_public': True} + image_meta = image_service.create(context, data) rpc.cast(context, self.db.queue_get_for(context, FLAGS.compute_topic, host), {"method": "snapshot_instance", - "args": {"instance_id": instance['id'], "name": name}}) + "args": {"instance_id": instance['id'], + "image_id": image_meta['id']}}) + + return image_meta def reboot(self, context, instance_id): """Reboot the given instance.""" diff --git a/nova/compute/manager.py b/nova/compute/manager.py index 6e8f34347..27e07ed59 100644 --- a/nova/compute/manager.py +++ b/nova/compute/manager.py @@ -225,7 +225,7 @@ class ComputeManager(manager.Manager): self._update_state(context, instance_id) @exception.wrap_exception - def snapshot_instance(self, context, instance_id, name): + def snapshot_instance(self, context, instance_id, image_id): """Snapshot an instance on this server.""" context = context.elevated() instance_ref = self.db.instance_get(context, instance_id) @@ -243,7 +243,7 @@ class ComputeManager(manager.Manager): instance_ref['state'], power_state.RUNNING) - self.driver.snapshot(instance_ref, name) + self.driver.snapshot(instance_ref, image_id) @exception.wrap_exception def rescue_instance(self, context, instance_id): |
