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(a)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