[Libvirt-cim] [PATCH] Add domain ref checking to isMigratable

Dan Smith danms at us.ibm.com
Wed Mar 12 16:49:26 UTC 2008


# HG changeset patch
# User Dan Smith <danms at us.ibm.com>
# Date 1205340424 25200
# Node ID 42b808d88849cbc642af67b2769b120624f66a42
# Parent  b739fc9b13320e07a39f3932396c8411c2d4ad75
Add domain ref checking to isMigratable

Tested by adding an invalid key to the ComputerSystem REF, which would
pass before.  It now fails and points out the offending key, as expected.

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

diff -r b739fc9b1332 -r 42b808d88849 src/Virt_VSMigrationService.c
--- a/src/Virt_VSMigrationService.c	Tue Mar 11 13:28:04 2008 -0700
+++ b/src/Virt_VSMigrationService.c	Wed Mar 12 09:47:04 2008 -0700
@@ -38,6 +38,7 @@
 
 #include "Virt_VSMigrationService.h"
 #include "Virt_HostSystem.h"
+#include "Virt_ComputerSystem.h"
 #include "Virt_VSMigrationSettingData.h"
 
 #define CIM_JOBSTATE_STARTING 3
@@ -276,6 +277,7 @@ static CMPIStatus vs_migratable(const CM
         CMPIBoolean isMigratable = 0;
         uint16_t type;
         virDomainPtr dom = NULL;
+        CMPIInstance *dominst;
 
         s = get_msd_values(ref, destination, argsin, &type, &dconn);
         if (s.rc != CMPI_RC_OK)
@@ -296,6 +298,10 @@ static CMPIStatus vs_migratable(const CM
                            "No such domain");
                 goto out;
         }
+
+        s = get_domain_by_ref(_BROKER, ref, &dominst);
+        if (s.rc != CMPI_RC_OK)
+                goto out;
 
         s = check_caps(conn, dconn);
         if (s.rc != CMPI_RC_OK)




More information about the Libvirt-cim mailing list