[Libvirt-cim] [PATCH 2 of 2] Make ComputerSystem.GetInstance() check its reference properly

Dan Smith danms at us.ibm.com
Fri Nov 2 22:31:22 UTC 2007


# HG changeset patch
# User Dan Smith <danms at us.ibm.com>
# Date 1194042669 25200
# Node ID 8ddace706d4a00e3097553e734dd1842aca0a97a
# Parent  6e04d2c0c3a88a4bb991438f9ea02a1ad4596820
Make ComputerSystem.GetInstance() check its reference properly

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

diff -r 6e04d2c0c3a8 -r 8ddace706d4a src/Virt_ComputerSystem.c
--- a/src/Virt_ComputerSystem.c	Fri Nov 02 15:31:08 2007 -0700
+++ b/src/Virt_ComputerSystem.c	Fri Nov 02 15:31:09 2007 -0700
@@ -377,6 +377,12 @@ static CMPIStatus get_domain(const CMPIO
         CMPIInstance *inst[2] = {NULL, NULL};
         CMPIStatus s;
         virConnectPtr conn = NULL;
+        const struct cu_property *prop;
+        static struct cu_property props[] = {
+                {"CreationClassName", 0},
+                {"Name", 1},
+                {NULL, 0}
+        };
 
         conn = lv_connect(_BROKER, &s);
         if (conn == NULL)
@@ -387,6 +393,14 @@ static CMPIStatus get_domain(const CMPIO
                 cu_statusf(_BROKER, &s,
                            CMPI_RC_ERR_FAILED,
                            "Unable to find `%s'", name);
+                goto out;
+        }
+
+        prop = cu_compare_ref(reference, inst[0], props);
+        if (prop != NULL) {
+                cu_statusf(_BROKER, &s,
+                           CMPI_RC_ERR_NOT_FOUND,
+                           "No such instance (%s)", prop->name);
                 goto out;
         }
 




More information about the Libvirt-cim mailing list