summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRafi Khardalian <rafi@metacloud.com>2013-06-21 23:02:03 +0000
committerRafi Khardalian <rafi@metacloud.com>2013-06-21 23:27:15 +0000
commitc6a120417e68c7423ad4898eb5e0567e0f22e0f3 (patch)
treec9d157e0099020a326f658181e2399ba5fc3b337
parent1b46e583c3eefccdfe1102fa068611b8e0f004f5 (diff)
downloadnova-c6a120417e68c7423ad4898eb5e0567e0f22e0f3.tar.gz
nova-c6a120417e68c7423ad4898eb5e0567e0f22e0f3.tar.xz
nova-c6a120417e68c7423ad4898eb5e0567e0f22e0f3.zip
Perform additional check before live snapshotting
Bug 1193146 Move blockJobAbort() out of the _live_snapshot function, such that it continues to terminate existing jobs, while also doubling as a method for confirming that our version of Qemu/KVM is new enough to execute a _live_snapshot. Change-Id: Ife5d2fd768a34dabf25a1bfc24e54bd6db762c89
-rwxr-xr-xnova/virt/libvirt/driver.py19
1 files changed, 12 insertions, 7 deletions
diff --git a/nova/virt/libvirt/driver.py b/nova/virt/libvirt/driver.py
index 3b70952d7..6a93d92ae 100755
--- a/nova/virt/libvirt/driver.py
+++ b/nova/virt/libvirt/driver.py
@@ -1208,6 +1208,18 @@ class LibvirtDriver(driver.ComputeDriver):
REQ_HYPERVISOR_LIVESNAPSHOT) \
and not source_format == "lvm":
live_snapshot = True
+ # Abort is an idempotent operation, so make sure any block
+ # jobs which may have failed are ended. This operation also
+ # confims the running instance, as opposed to the system as a
+ # whole, has a new enough version of the hypervisor (bug 1193146).
+ try:
+ virt_dom.blockJobAbort(disk_path, 0)
+ except libvirt.libvirtError as ex:
+ error_code = ex.get_error_code()
+ if error_code == libvirt.VIR_ERR_CONFIG_UNSUPPORTED:
+ live_snapshot = False
+ else:
+ pass
else:
live_snapshot = False
@@ -1279,13 +1291,6 @@ class LibvirtDriver(driver.ComputeDriver):
# Save a copy of the domain's running XML file
xml = domain.XMLDesc(0)
- # Abort is an idempotent operation, so make sure any block
- # jobs which may have failed are ended.
- try:
- domain.blockJobAbort(disk_path, 0)
- except Exception:
- pass
-
def _wait_for_block_job(domain, disk_path):
status = domain.blockJobInfo(disk_path, 0)
try: