if (virConnectGetVersion(dconn, &remote)) {
- cu_statusf(_BROKER, &s,
- CMPI_RC_ERR_FAILED,
- "Unable to get remote hypervisor version");
+ virt_set_status(_BROKER, &s,
+ CMPI_RC_ERR_FAILED,
+ conn,
This needs to be dconn, not conn.
+ "Unable to get remote
Hypervisor version");
goto out;
}
@@ -1005,9 +1027,14 @@
*xml = virDomainGetXMLDesc(dom, 0);
if (*xml == NULL) {
- cu_statusf(_BROKER, &s,
- CMPI_RC_ERR_FAILED,
- "Unable to retrieve domain XML.");
+
+ virConnectPtr conn = virDomainGetConnect(dom);
+
+ virt_set_status(_BROKER, &s,
+ CMPI_RC_ERR_FAILED,
+ conn,
This can just be virDomainGetConnect(dom) instead of conn, since conn
isn't needed elsewhere in the function.
+ "Unable to retrieve domain
XML");
+
goto out;
}
@@ -1025,6 +1052,7 @@
virDomainPtr dom;
int i;
int ret;
+ virConnectPtr lconn = virDomainGetConnect(ldom);
for (i = 0; i < MIGRATE_SHUTDOWN_TIMEOUT; i++) {
if ((i % 30) == 0) {
@@ -1032,10 +1060,17 @@
virDomainGetName(ldom));
}
- dom = virDomainLookupByName(virDomainGetConnect(ldom),
+ dom = virDomainLookupByName(lconn,
virDomainGetName(ldom));
if (dom == NULL) {
CU_DEBUG("Unable to re-lookup domain");
+
+ virt_set_status(_BROKER, &s,
+ CMPI_RC_ERR_NOT_FOUND,
+ lconn,
+ "Domain `%s' not found",
+ virDomainGetName(ldom));
+
Setting an error here isn't necessary. We're polling to make sure the
guest is undefined - we want the guest to disappear from the system. If
we can't find the guest before the undefine call, it means the guest is
already gone - which isn't an error.
ret = -1;
break;
}
@@ -1055,9 +1090,10 @@
newdom = virDomainDefineXML(rconn, xml);
if (newdom == NULL) {
- cu_statusf(_BROKER, &s,
- CMPI_RC_ERR_FAILED,
- "Failed to define domain");
+ virt_set_status(_BROKER, &s,
+ CMPI_RC_ERR_FAILED,
+ lconn,
You're defining the XML on the remote system - this needs to be rconn,
not lconn.
+ "Failed to define
domain");
goto out;
}
@@ -1067,9 +1103,11 @@
CU_DEBUG("Restarting domain on remote host");
if (virDomainCreate(newdom) != 0) {
CU_DEBUG("Failed to start domain on remote host");
- cu_statusf(_BROKER, &s,
- CMPI_RC_ERR_FAILED,
- "Failed to start domain on remote host");
+ virt_set_status(_BROKER, &s,
+ CMPI_RC_ERR_FAILED,
+ lconn,
You're starting the guest on the remote system - this needs to be rconn,
not lconn.
+ "Failed to start domain
on remote \
+ host");
}
}
out:
@@ -1086,9 +1124,13 @@
ret = virDomainGetInfo(dom, &info);
if (ret == -1) {
- cu_statusf(_BROKER, &s,
- CMPI_RC_ERR_FAILED,
- "Error getting domain info");
+ virConnectPtr conn = virDomainGetConnect(dom);
+
+ virt_set_status(_BROKER, &s,
+ CMPI_RC_ERR_FAILED,
+ conn,
Just use virDomainGetConnect(dom) here - conn isn't used elsewhere in
the function.
+ "Error getting domain
info");
+
goto out;
}
--
Kaitlin Rupert
IBM Linux Technology Center
kaitlin(a)linux.vnet.ibm.com