[Libvirt-cim] [PATCH 2 of 2] Add lookup of domain to make sure it exists as part of the check

Dan Smith danms at us.ibm.com
Mon Mar 10 18:24:54 UTC 2008


# HG changeset patch
# User Dan Smith <danms at us.ibm.com>
# Date 1205171774 25200
# Node ID 29e665fff096426ced0f3c7c9ddc7c0924927a07
# Parent  05cbd18bf3644b6e1b32b37c30310fb1b1e23a44
Add lookup of domain to make sure it exists as part of the check

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

diff -r 05cbd18bf364 -r 29e665fff096 src/Virt_VSMigrationService.c
--- a/src/Virt_VSMigrationService.c	Mon Mar 10 10:56:14 2008 -0700
+++ b/src/Virt_VSMigrationService.c	Mon Mar 10 10:56:14 2008 -0700
@@ -269,6 +269,7 @@ static CMPIStatus vs_migratable(const CM
         virConnectPtr dconn = NULL;
         uint32_t retcode = 1;
         CMPIBoolean isMigratable = 0;
+        virDomainPtr dom = NULL;
 
         s = get_msd_check_values(ref, destination, argsin, &dconn);
         if (s.rc != CMPI_RC_OK)
@@ -281,6 +282,14 @@ static CMPIStatus vs_migratable(const CM
         s = check_hver(conn, dconn);
         if (s.rc != CMPI_RC_OK)
                 goto out;
+
+        dom = virDomainLookupByName(conn, domain);
+        if (dom == NULL) {
+                cu_statusf(_BROKER, &s,
+                           CMPI_RC_ERR_NOT_FOUND,
+                           "No such domain");
+                goto out;
+        }
 
         s = check_caps(conn, dconn);
         if (s.rc != CMPI_RC_OK)
@@ -297,6 +306,7 @@ static CMPIStatus vs_migratable(const CM
         CMAddArg(argsout, "IsMigratable",
                  (CMPIValue *)&isMigratable, CMPI_boolean);
 
+        virDomainFree(dom);
         virConnectClose(conn);
         virConnectClose(dconn);
 




More information about the Libvirt-cim mailing list