Change in vdsm[ovirt-3.6]: v2v: Skip vm if XMLDesc() fails

fromani at redhat.com fromani at redhat.com
Thu Oct 15 10:44:11 UTC 2015


Francesco Romani 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>
Bug-Url: https://bugzilla.redhat.com/1266088
Backport-to: 3.6
Signed-off-by: Nir Soffer <nsoffer at redhat.com>
Reviewed-on: https://gerrit.ovirt.org/46634
Continuous-Integration: Jenkins CI
Reviewed-by: Francesco Romani <fromani at redhat.com>
---
M vdsm/v2v.py
1 file changed, 7 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/63/47363/1

diff --git a/vdsm/v2v.py b/vdsm/v2v.py
index 56340e8..5daa4f0 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/47363
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Iab912bc9524b94834d7f54172dd9401ddb4aa45b
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: ovirt-3.6
Gerrit-Owner: Francesco Romani <fromani at redhat.com>


More information about the vdsm-patches mailing list