summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRafi Khardalian <rafi@metacloud.com>2013-01-18 06:23:02 +0000
committerRafi Khardalian <rafi@metacloud.com>2013-01-21 21:20:55 +0000
commitc538024fddc5994afe13f41817b9fe0b8e8f3fdd (patch)
tree9233c276c04124b9e55fadf48e43ff8ee0d0becb
parent341d5b5e33d8e4944f8d79460606fc1dd4b9ef10 (diff)
downloadnova-c538024fddc5994afe13f41817b9fe0b8e8f3fdd.tar.gz
nova-c538024fddc5994afe13f41817b9fe0b8e8f3fdd.tar.xz
nova-c538024fddc5994afe13f41817b9fe0b8e8f3fdd.zip
Allow snapshots of paused and suspended instances
Fixes bug 1100556 Remove the restriction in the API of snapshotting instances which are in paused or suspended states and update the libvirt driver to deal with this accordingly. Other drivers may need to be updated accordingly. Change-Id: Iabeb44f843c3c04f767c4103038fcf6c52966ff3
-rw-r--r--nova/compute/api.py3
-rw-r--r--nova/virt/libvirt/driver.py5
2 files changed, 6 insertions, 2 deletions
diff --git a/nova/compute/api.py b/nova/compute/api.py
index 4b15a3e27..1ff0365d4 100644
--- a/nova/compute/api.py
+++ b/nova/compute/api.py
@@ -1370,7 +1370,8 @@ class API(base.Base):
return image_meta
@wrap_check_policy
- @check_instance_state(vm_state=[vm_states.ACTIVE, vm_states.STOPPED])
+ @check_instance_state(vm_state=[vm_states.ACTIVE, vm_states.STOPPED,
+ vm_states.PAUSED, vm_states.SUSPENDED])
def snapshot(self, context, instance, name, extra_properties=None,
image_id=None):
"""Snapshot the given instance.
diff --git a/nova/virt/libvirt/driver.py b/nova/virt/libvirt/driver.py
index 115c6cd02..e51883843 100644
--- a/nova/virt/libvirt/driver.py
+++ b/nova/virt/libvirt/driver.py
@@ -808,7 +808,7 @@ class LibvirtDriver(driver.ComputeDriver):
# NOTE(dkang): managedSave does not work for LXC
if CONF.libvirt_type != 'lxc':
- if state == power_state.RUNNING:
+ if state == power_state.RUNNING or state == power_state.PAUSED:
virt_dom.managedSave(0)
# Make the snapshot
@@ -832,6 +832,9 @@ class LibvirtDriver(driver.ComputeDriver):
if CONF.libvirt_type != 'lxc':
if state == power_state.RUNNING:
self._create_domain(domain=virt_dom)
+ elif state == power_state.PAUSED:
+ self._create_domain(domain=virt_dom,
+ launch_flags=libvirt.VIR_DOMAIN_START_PAUSED)
# Upload that image to the image service