# HG changeset patch
# User Richard Maciel <rmaciel(a)linux.vnet.ibm.com>
# Date 1235493749 10800
# Node ID ec95377909381bf92beee417b5fce4f699950df5
# Parent 72dc446be12ca8ae1dc60a1aad97ff72eecd7b66
This patch exposes error messages from libvirt calls in VirtualSystemManagementService
#2:
Fixed code-style to match the file
Removed un-needed custatusf() call
Fixed a problem where status variable set by virt_set_status was being overriding by
another call
Added another libvirt error exposition point
Signed-off-by: Richard Maciel <rmaciel(a)linux.vnet.ibm.com>
diff -r 72dc446be12c -r ec9537790938 src/Virt_VirtualSystemManagementService.c
--- a/src/Virt_VirtualSystemManagementService.c Wed Feb 04 08:35:04 2009 -0800
+++ b/src/Virt_VirtualSystemManagementService.c Tue Feb 24 13:42:29 2009 -0300
@@ -963,9 +963,10 @@
dom = virDomainLookupByName(conn, dominfo->name);
if (dom == NULL) {
- cu_statusf(_BROKER, &s,
- CMPI_RC_ERR_NOT_FOUND,
- "Unable to lookup domain `%s'",
dominfo->name);
+ virt_set_status(_BROKER, &s,
+ CMPI_RC_ERR_NOT_FOUND,
+ conn,
+ "Unable to lookup domain `%s'",
dominfo->name);
goto out;
}
@@ -1065,9 +1066,10 @@
dom = virDomainLookupByName(conn, name);
if (dom == NULL) {
- cu_statusf(_BROKER, &s,
- CMPI_RC_ERR_NOT_FOUND,
- "Referenced domain `%s' does not exist", name);
+ virt_set_status(_BROKER, &s,
+ CMPI_RC_ERR_NOT_FOUND,
+ conn,
+ "Referenced domain `%s' does not exist",
name);
goto out;
}
@@ -1274,13 +1276,16 @@
error:
if (rc == IM_RC_SYS_NOT_FOUND)
- cu_statusf(_BROKER, &status,
- CMPI_RC_ERR_FAILED,
- "Failed to find domain");
+ virt_set_status(_BROKER, &status,
+ CMPI_RC_ERR_NOT_FOUND,
+ conn,
+ "Referenced domain `%s' does not exist",
+ dom_name);
else if (rc == IM_RC_FAILED)
- cu_statusf(_BROKER, &status,
- CMPI_RC_ERR_FAILED,
- "Unable to retrieve domain name.");
+ virt_set_status(_BROKER, &status,
+ CMPI_RC_ERR_NOT_FOUND,
+ conn,
+ "Unable to retrieve domain name");
else if (rc == IM_RC_OK) {
status = (CMPIStatus){CMPI_RC_OK, NULL};
trigger_indication(context,
@@ -1320,8 +1325,13 @@
goto out;
dom = virDomainLookupByName(conn, name);
- if (dom == NULL)
+ if (dom == NULL) {
+ virt_set_status(_BROKER, &s,
+ CMPI_RC_ERR_NOT_FOUND,
+ conn,
+ "Referenced domain `%s' does not exist",
name);
goto out;
+ }
if (!get_dominfo(dom, &dominfo)) {
cu_statusf(_BROKER, &s,
@@ -1459,9 +1469,10 @@
dom = virDomainLookupByName(conn, dominfo->name);
if (dom == NULL) {
CU_DEBUG("Failed to lookup VS `%s'", dominfo->name);
- cu_statusf(_BROKER, &s,
- CMPI_RC_ERR_NOT_FOUND,
- "Virtual System `%s' not found",
dominfo->name);
+ virt_set_status(_BROKER, &s,
+ CMPI_RC_ERR_NOT_FOUND,
+ conn,
+ "Virtual System `%s' not found",
dominfo->name);
goto out;
}
@@ -1825,9 +1836,11 @@
dom = virDomainLookupByName(conn, name);
if (dom == NULL) {
- cu_statusf(_BROKER, &s,
- CMPI_RC_ERR_FAILED,
- "Unknown system `%s'", name);
+ virt_set_status(_BROKER, &s,
+ CMPI_RC_ERR_NOT_FOUND,
+ conn,
+ "Referenced domain `%s' does not
exist",
+ name);
goto end;
}