diff options
| author | Brian Waldon <brian.waldon@rackspace.com> | 2011-11-10 21:54:14 -0500 |
|---|---|---|
| committer | Brian Waldon <brian.waldon@rackspace.com> | 2011-11-10 21:54:14 -0500 |
| commit | d29f9e34555c2af2d996cd96e084af4be513a33b (patch) | |
| tree | 278e0f0c5ba4f660f3238fb33b233574a56dd2be /nova/compute | |
| parent | 59dfaf9e02ff0064a6844c9c986737267317776f (diff) | |
Converting snapshot/backup to use instance objects
Related to blueprint internal-uuids
Change-Id: I8d9768524d36f7066cc1550bba01326dc5167a8d
Diffstat (limited to 'nova/compute')
| -rw-r--r-- | nova/compute/api.py | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/nova/compute/api.py b/nova/compute/api.py index 820a7b9b6..8511305ac 100644 --- a/nova/compute/api.py +++ b/nova/compute/api.py @@ -1110,41 +1110,41 @@ class API(base.Base): % instance_id) @scheduler_api.reroute_compute("backup") - def backup(self, context, instance_id, name, backup_type, rotation, + def backup(self, context, instance, name, backup_type, rotation, extra_properties=None): """Backup the given instance - :param instance_id: nova.db.sqlalchemy.models.Instance.Id + :param instance: nova.db.sqlalchemy.models.Instance :param name: name of the backup or snapshot name = backup_type # daily backups are called 'daily' :param rotation: int representing how many backups to keep around; None if rotation shouldn't be used (as in the case of snapshots) :param extra_properties: dict of extra image properties to include """ - recv_meta = self._create_image(context, instance_id, name, 'backup', + recv_meta = self._create_image(context, instance, name, 'backup', backup_type=backup_type, rotation=rotation, extra_properties=extra_properties) return recv_meta @scheduler_api.reroute_compute("snapshot") - def snapshot(self, context, instance_id, name, extra_properties=None): + def snapshot(self, context, instance, name, extra_properties=None): """Snapshot the given instance. - :param instance_id: nova.db.sqlalchemy.models.Instance.Id + :param instance: nova.db.sqlalchemy.models.Instance :param name: name of the backup or snapshot :param extra_properties: dict of extra image properties to include :returns: A dict containing image metadata """ - return self._create_image(context, instance_id, name, 'snapshot', + return self._create_image(context, instance, name, 'snapshot', extra_properties=extra_properties) - def _create_image(self, context, instance_id, name, image_type, + def _create_image(self, context, instance, name, image_type, backup_type=None, rotation=None, extra_properties=None): """Create snapshot or backup for an instance on this host. :param context: security context - :param instance_id: nova.db.sqlalchemy.models.Instance.Id + :param instance: nova.db.sqlalchemy.models.Instance :param name: string for name of the snapshot :param image_type: snapshot | backup :param backup_type: daily | weekly @@ -1153,8 +1153,8 @@ class API(base.Base): :param extra_properties: dict of extra image properties to include """ - instance = self.db.instance_get(context, instance_id) task_state = instance["task_state"] + instance_id = instance['id'] if task_state == task_states.IMAGE_BACKUP: raise exception.InstanceBackingUp(instance_id=instance_id) |
