[Libvirt-cim] [PATCH] Make IsMigratable return "not migratable" instead of error, unless an error

Dan Smith danms at us.ibm.com
Thu Mar 20 18:29:06 UTC 2008


# HG changeset patch
# User Dan Smith <danms at us.ibm.com>
# Date 1206037711 25200
# Node ID 205b3e4958957713fd45a211c6229f09af19e243
# Parent  c8c0e264c75cccccb40ff0de1cfdfc7a14c3d65a
Make IsMigratable return "not migratable" instead of error, unless an error
really occurred.  Log the failure of an individual check for tracking down
an error.  It really seems that a status message return value to indicate
*why* something isn't migratable.

Signed-off-by: Dan Smith <danms at us.ibm.com>

diff -r c8c0e264c75c -r 205b3e495895 src/Virt_VSMigrationService.c
--- a/src/Virt_VSMigrationService.c	Thu Mar 20 10:47:48 2008 -0700
+++ b/src/Virt_VSMigrationService.c	Thu Mar 20 11:28:31 2008 -0700
@@ -523,6 +523,14 @@ static char *get_parms_file(const CMPIOb
                 return NULL;
 }
 
+static void log_status(CMPIStatus *s, const char *prefix)
+{
+        CU_DEBUG("%s: %s", prefix, CMGetCharPtr(s->msg));
+
+        s->rc = CMPI_RC_OK;
+        s->msg = NULL;
+}
+
 static CMPIStatus vs_migratable(const CMPIObjectPath *ref,
                                 CMPIObjectPath *system,
                                 const char *destination,
@@ -557,8 +565,10 @@ static CMPIStatus vs_migratable(const CM
                 goto out;
 
         s = check_hver(conn, dconn);
-        if (s.rc != CMPI_RC_OK)
-                goto out;
+        if (s.rc != CMPI_RC_OK) {
+                log_status(&s, "Hypervisor version check failed");
+                goto out;
+        }
 
         dom = virDomainLookupByName(conn, domain);
         if (dom == NULL) {
@@ -574,13 +584,17 @@ static CMPIStatus vs_migratable(const CM
                 goto out;
 
         s = check_caps(conn, dconn);
-        if (s.rc != CMPI_RC_OK)
-                goto out;
+        if (s.rc != CMPI_RC_OK) {
+                log_status(&s, "Hypervisor capabilities check failed");
+                goto out;
+        }
 
         path = get_parms_file(ref, argsin);
         s = call_external_checks(dom, path);
-        if (s.rc != CMPI_RC_OK)
-                goto out;
+        if (s.rc != CMPI_RC_OK) {
+                log_status(&s, "An external check failed");
+                goto out;
+        }
 
         retcode = CIM_SVPC_RETURN_COMPLETED;
         cu_statusf(_BROKER, &s,




More information about the Libvirt-cim mailing list