[Libvirt-cim] [PATCH V5 10/15] device parsing, add debug print
Wenchao Xia
xiawenc at linux.vnet.ibm.com
Thu Mar 21 03:39:13 UTC 2013
Sometimes libvirt will fail in these APIs if there is low level error,
what we saw is libvirt can't got xml for some domain. This patch adds
debug log when met this error, so in future we can know what is wrong.
Signed-off-by: Wenchao Xia <xiawenc at linux.vnet.ibm.com>
---
libxkutil/device_parsing.c | 16 +++++++++++++---
1 files changed, 13 insertions(+), 3 deletions(-)
diff --git a/libxkutil/device_parsing.c b/libxkutil/device_parsing.c
index ceb4552..845a953 100644
--- a/libxkutil/device_parsing.c
+++ b/libxkutil/device_parsing.c
@@ -1251,15 +1251,25 @@ 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)
- return 0;
+ if (ret != 1) {
+ CU_DEBUG("Failed to translate xml into struct domain");
+ goto out;
+ }
+ if (virDomainGetAutostart(dom, &start) != 0) {
+ CU_DEBUG("Failed to get dom autostart with libvirt API.");
+ ret = 0;
+ goto out;
+ }
(*dominfo)->autostrt = start;
+ out:
free(xml);
return ret;
--
1.7.1
More information about the Libvirt-cim
mailing list