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

Dan Smith danms at us.ibm.com
Mon Mar 10 21:21:56 UTC 2008


# HG changeset patch
# User Dan Smith <danms at us.ibm.com>
# Date 1205184038 25200
# Node ID 991f50b2c972bf02ab61f5696c25f5194bc4d640
# Parent  4ed1813a93d4a45af23cec8619f96fce22b12ed5
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 4ed1813a93d4 -r 991f50b2c972 src/Virt_VSMigrationService.c
--- a/src/Virt_VSMigrationService.c	Mon Mar 10 14:20:37 2008 -0700
+++ b/src/Virt_VSMigrationService.c	Mon Mar 10 14:20:38 2008 -0700
@@ -275,6 +275,7 @@ static CMPIStatus vs_migratable(const CM
         uint32_t retcode = 1;
         CMPIBoolean isMigratable = 0;
         uint16_t type;
+        virDomainPtr dom = NULL;
 
         s = get_msd_values(ref, destination, argsin, &type, &dconn);
         if (s.rc != CMPI_RC_OK)
@@ -287,6 +288,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)
@@ -303,6 +312,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