# HG changeset patch
# User Richard Maciel <rmaciel(a)linux.vnet.ibm.com>
# Date 1235499824 10800
# Node ID bd4dc02647adb6c7d3644728137674e53b8cf83a
# Parent ec95377909381bf92beee417b5fce4f699950df5
This patch exposes error messages from libvirt calls in ComputerSystem
#2:
Added more points of error exposition
Changed some error messages from "Could not..." to "Unable to..." to
make them more readable
#3:
Changed message virt_set_status message from "Unable to get domain XML
description" to "Unable to get domain information"
Signed-off-by: Richard Maciel <rmaciel(a)linux.vnet.ibm.com>
diff -r ec9537790938 -r bd4dc02647ad src/Virt_ComputerSystem.c
--- a/src/Virt_ComputerSystem.c Tue Feb 24 13:42:29 2009 -0300
+++ b/src/Virt_ComputerSystem.c Tue Feb 24 15:23:44 2009 -0300
@@ -273,7 +273,7 @@
struct infostore_ctx *infostore = NULL;
ret = virDomainGetInfo(dom, &info);
- if (ret != 0)
+ if (ret != 0)
return 0;
info.state = adjust_state_xen(dom, info.state);
@@ -398,19 +398,27 @@
if (get_dominfo(dom, &domain) == 0) {
CU_DEBUG("Unable to get domain information");
- cu_statusf(_BROKER, &s,
- CMPI_RC_ERR_FAILED,
- "Unable to get domain information");
+ virt_set_status(broker, &s,
+ CMPI_RC_ERR_FAILED,
+ virDomainGetConnect(dom),
+ "Unable to get domain information");
goto out;
}
if (!set_name_from_dom(dom, instance)) {
- /* Print trace error */
+ virt_set_status(broker, &s,
+ CMPI_RC_ERR_FAILED,
+ virDomainGetConnect(dom),
+ "Unable to get domain name");
goto out;
}
if (!set_uuid_from_dom(dom, instance, &uuid)) {
- /* Print trace error */
+ virt_set_status(broker, &s,
+ CMPI_RC_ERR_FAILED,
+ virDomainGetConnect(dom),
+ "Unable to get domain UUID");
+
goto out;
}
@@ -420,7 +428,11 @@
}
if (!set_state_from_dom(broker, dom, instance)) {
- /* Print trace error */
+ virt_set_status(broker, &s,
+ CMPI_RC_ERR_FAILED,
+ virDomainGetConnect(dom),
+ "Unable to get domain info");
+
goto out;
}
@@ -570,10 +582,11 @@
dom = virDomainLookupByName(conn, name);
if (dom == NULL) {
- cu_statusf(broker, &s,
- CMPI_RC_ERR_NOT_FOUND,
- "No such instance (%s).",
- name);
+ virt_set_status(broker, &s,
+ CMPI_RC_ERR_NOT_FOUND,
+ conn,
+ "Referenced domain `%s' does not exist",
+ name);
goto out;
}
@@ -790,9 +803,10 @@
xml = virDomainGetXMLDesc(dom, 0);
if (xml == NULL) {
CU_DEBUG("Unable to retrieve domain XML");
- cu_statusf(_BROKER, &s,
- CMPI_RC_ERR_FAILED,
- "Unable to get domain definition");
+ virt_set_status(_BROKER, &s,
+ CMPI_RC_ERR_FAILED,
+ conn,
+ "Unable to get domain definition");
return s;
}
@@ -1003,16 +1017,18 @@
dom = virDomainLookupByName(conn, name);
if (dom == NULL) {
- cu_statusf(_BROKER, &s,
- CMPI_RC_ERR_FAILED,
- "Domain not found");
+ virt_set_status(_BROKER, &s,
+ CMPI_RC_ERR_FAILED,
+ conn,
+ "Domain not found");
goto out;
}
if (virDomainGetInfo(dom, &info) != 0) {
- cu_statusf(_BROKER, &s,
- CMPI_RC_ERR_FAILED,
- "Unable to get current state");
+ virt_set_status(_BROKER, &s,
+ CMPI_RC_ERR_FAILED,
+ conn,
+ "Unable to get current state");
goto out;
}