diff options
| author | Derek Higgins <derekh@redhat.com> | 2012-09-04 11:50:36 +0100 |
|---|---|---|
| committer | Derek Higgins <derekh@redhat.com> | 2012-09-05 23:36:51 +0100 |
| commit | aeacea16a30f85dfb307803a4b46a602cabc8eb5 (patch) | |
| tree | 35819f424cae7ec550014bd3470f05cd034472b5 /nova/virt | |
| parent | 06dec8ec1e518c33d00df2e88ffea92cf236a8dc (diff) | |
Fixing call to hasManagedSaveImage
Fixes bug #1044090
hasManagedSaveImage is not implmented in the LXC libvirt driver, resulting
in the following error when a vm is deleted "Error from libvirt during saved
instance removal. Code=3 Error=this function is not supported by the
connection driver: virDomainHasManagedSaveImage"
This commit replaces the use of hasManagedSaveImage, managedSaveRemove and
undefine with undefineFlags which does the work of all 3 calls and is
implemented in versions of libvirt > 0.9.4. We also revert back to calling
undefine if undefineFlags raises an error.
Change-Id: Ib8d451aeff7767f835c3c1aab99ee4ab5e299852
Diffstat (limited to 'nova/virt')
| -rw-r--r-- | nova/virt/libvirt/driver.py | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/nova/virt/libvirt/driver.py b/nova/virt/libvirt/driver.py index 693590b38..d7339d4da 100644 --- a/nova/virt/libvirt/driver.py +++ b/nova/virt/libvirt/driver.py @@ -483,18 +483,13 @@ class LibvirtDriver(driver.ComputeDriver): virt_dom = None if virt_dom: try: - # NOTE(derekh): we can switch to undefineFlags and - # VIR_DOMAIN_UNDEFINE_MANAGED_SAVE once we require 0.9.4 - if virt_dom.hasManagedSaveImage(0): - virt_dom.managedSaveRemove(0) - except libvirt.libvirtError as e: - errcode = e.get_error_code() - LOG.error(_("Error from libvirt during saved instance " - "removal. Code=%(errcode)s Error=%(e)s") % - locals(), instance=instance) - try: - # NOTE(justinsb): We remove the domain definition. - virt_dom.undefine() + try: + virt_dom.undefineFlags( + libvirt.VIR_DOMAIN_UNDEFINE_MANAGED_SAVE) + except libvirt.libvirtError as e: + LOG.debug(_("Error from libvirt during undefineFlags." + " Retrying with undefine"), instance=instance) + virt_dom.undefine() except libvirt.libvirtError as e: errcode = e.get_error_code() LOG.error(_("Error from libvirt during undefine. " |
