Change in vdsm[master]: v2v: Skip vm if XMLDesc() fails

nsoffer at redhat.com nsoffer at redhat.com
Wed Sep 23 17:59:16 UTC 2015


Nir Soffer has uploaded a new change for review.

Change subject: v2v: Skip vm if XMLDesc() fails
......................................................................

v2v: Skip vm if XMLDesc() fails

The current code assumes that XMLDesc() always succeeds when dealing
foreign vms, which seems to be too optimistic as seen here:

      File "/usr/share/vdsm/v2v.py", line 152, in get_external_vms
        root = ET.fromstring(vm.XMLDesc(0))
      File "/usr/lib64/python2.7/site-packages/libvirt.py", line 478, in XMLDesc
        if ret is None: raise libvirtError ('virDomainGetXMLDesc() failed', dom=self)
    libvirtError: internal error: Invalid or not yet handled value
    'emptyBackingString' for VMX entry 'ide1:0.fileName' for device type
    'cdrom-image'

If XMLDesc() failed, we aborted the entire request, making it impossible
to import good vm if libvirt could not handle another bad vm on the same
server.

Now we log the libvirt error and continue, increasing the chance to
return useful information to engine.

Change-Id: Iab912bc9524b94834d7f54172dd9401ddb4aa45b
Reported-by: Ian Fraser <ian.fraser at asm.org.uk>
Backport-to: 3.6
Signed-off-by: Nir Soffer <nsoffer at redhat.com>
---
M vdsm/v2v.py
1 file changed, 7 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/34/46634/1

diff --git a/vdsm/v2v.py b/vdsm/v2v.py
index 1b812d9..3e964cd 100644
--- a/vdsm/v2v.py
+++ b/vdsm/v2v.py
@@ -149,10 +149,16 @@
     with closing(conn):
         vms = []
         for vm in conn.listAllDomains():
-            root = ET.fromstring(vm.XMLDesc(0))
             params = {}
             _add_vm_info(vm, params)
             try:
+                xml = vm.XMLDesc(0)
+            except libvirt.libvirtError as e:
+                logging.error("error getting domain xml for vm %r: %s",
+                              vm.name(), e)
+                continue
+            root = ET.fromstring(xml)
+            try:
                 _add_general_info(root, params)
             except InvalidVMConfiguration as e:
                 logging.error('error parsing domain xml, msg: %s  xml: %s',


-- 
To view, visit https://gerrit.ovirt.org/46634
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Iab912bc9524b94834d7f54172dd9401ddb4aa45b
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Nir Soffer <nsoffer at redhat.com>


More information about the vdsm-patches mailing list