Francesco Romani has uploaded a new change for review.

Change subject: vm: consolidate error checking in getVmPolicy
......................................................................

vm: consolidate error checking in getVmPolicy

Uniform the error checking in getVmPolicy with what
is done into the sampling thread, making it suitable
to be used everywhere.

Change-Id: I8759c2ec2cd4caf3536e4b17d68e8ee31d9a0445
Signed-off-by: Francesco Romani <[email protected]>
---
M vdsm/virt/vm.py
1 file changed, 10 insertions(+), 4 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/31/29931/1

diff --git a/vdsm/virt/vm.py b/vdsm/virt/vm.py
index 3fde1f7..bb69792 100644
--- a/vdsm/virt/vm.py
+++ b/vdsm/virt/vm.py
@@ -3746,15 +3746,21 @@
         :return: XML DOM object representing the root qos element
         """
 
-        metadata_xml = "<qos></qos>"
-
         try:
             metadata_xml = self._dom.metadata(
                 libvirt.VIR_DOMAIN_METADATA_ELEMENT,
                 METADATA_VM_TUNE_URI, 0)
         except libvirt.libvirtError as e:
-            if e.get_error_code() != libvirt.VIR_ERR_NO_DOMAIN_METADATA:
-                self.log.exception("getVmPolicy failed")
+            # Non-existing VM and no metadata block are expected
+            # conditions and no reasons for concern here.
+            # All other errors should be reported.
+            if e.get_error_code() == libvirt.VIR_ERR_NO_DOMAIN_METADATA:
+                metadata_xml = "<qos></qos>"  # new empty DOM tree
+            elif e.get_error_code() == libvirt.VIR_ERR_NO_DOMAIN:
+                return None  # need to bail out
+            else:
+                self.log.warn("Failed to retrieve QoS metadata because of %s",
+                              e)
                 return None
 
         metadata = xml.dom.minidom.parseString(metadata_xml)


-- 
To view, visit http://gerrit.ovirt.org/29931
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I8759c2ec2cd4caf3536e4b17d68e8ee31d9a0445
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Francesco Romani <[email protected]>
_______________________________________________
vdsm-patches mailing list
[email protected]
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches

Reply via email to