[Libvirt-cim] [PATCH V3 08/11] device parsing, add debug print

Wenchao Xia xiawenc at linux.vnet.ibm.com
Tue Dec 18 10:17:37 UTC 2012


  Sometime libvirt will fail in these API when there are low level error,
what we saw is libvirt can't got xml for some domain. This patch add
debug log when met this error, so in future we can know where is wrong
better.

v2:
  Rebased.

Signed-off-by: Wenchao Xia <xiawenc at linux.vnet.ibm.com>
---
 libxkutil/device_parsing.c |   11 +++++++++--
 1 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/libxkutil/device_parsing.c b/libxkutil/device_parsing.c
index ceb4552..2841662 100644
--- a/libxkutil/device_parsing.c
+++ b/libxkutil/device_parsing.c
@@ -1251,12 +1251,19 @@ int get_dominfo(virDomainPtr dom, struct domain **dominfo)
         xml = virDomainGetXMLDesc(dom,
                 VIR_DOMAIN_XML_INACTIVE | VIR_DOMAIN_XML_SECURE);
 
-        if (xml == NULL)
+        if (xml == NULL) {
+                CU_DEBUG("Failed to get dom xml with libvirt API.");
                 return 0;
+        }
 
         ret = get_dominfo_from_xml(xml, dominfo);
-        if (virDomainGetAutostart(dom,  &start) !=  0)
+        if (ret != 1) {
+                CU_DEBUG("Failed to translate xml into struct domain");
+        }
+        if (virDomainGetAutostart(dom,  &start) !=  0) {
+                CU_DEBUG("Failed to get dom autostart with libvirt API.");
                 return 0;
+        }
 
         (*dominfo)->autostrt = start;
 
-- 
1.7.1




More information about the Libvirt-cim mailing list