[Libvirt-cim] [PATCH 1 of 2] Add function to validate the client given object path

Heidi Eckhart heidieck at linux.vnet.ibm.com
Wed Jan 9 08:05:07 UTC 2008


# HG changeset patch
# User Heidi Eckhart <heidieck at linux.vnet.ibm.com>
# Date 1199869322 -3600
# Node ID ee811a7e50179f019cda5267e27f44faa4a1f353
# Parent  10d141f683370b6f04637bb9ad059bbd92051ce0
Add function to validate the client given object path

Signed-off-by: Heidi Eckhart <heidieck at linux.vnet.ibm.com>

diff -r 10d141f68337 -r ee811a7e5017 src/Virt_HostSystem.c
--- a/src/Virt_HostSystem.c	Tue Jan 08 10:51:44 2008 -0800
+++ b/src/Virt_HostSystem.c	Wed Jan 09 10:02:02 2008 +0100
@@ -35,6 +35,25 @@
 #include "Virt_HostSystem.h"
 
 const static CMPIBroker *_BROKER;
+
+CMPIStatus validate_host_ref(const CMPIBroker *broker,
+                             const CMPIObjectPath *ref)
+{
+        CMPIStatus s = {CMPI_RC_OK, NULL};
+        CMPIInstance *inst;
+        const char *prop;
+        
+        s = get_host_cs(broker, ref, &inst);
+        
+        prop = cu_compare_ref(ref, inst);
+        if (prop != NULL) {
+                cu_statusf(broker, &s,
+                           CMPI_RC_ERR_NOT_FOUND,
+                           "No such instance (%s)", prop);
+        }
+        
+        return s;
+}
 
 static int set_host_system_properties(CMPIInstance *instance)
 {
diff -r 10d141f68337 -r ee811a7e5017 src/Virt_HostSystem.h
--- a/src/Virt_HostSystem.h	Tue Jan 08 10:51:44 2008 -0800
+++ b/src/Virt_HostSystem.h	Wed Jan 09 10:02:02 2008 +0100
@@ -29,4 +29,8 @@ CMPIStatus get_host_system_properties(co
                                       const char **ccname,
                                       const CMPIObjectPath *ref,
                                       const CMPIBroker *broker);
+
+CMPIStatus validate_host_ref(const CMPIBroker *broker,
+                             const CMPIObjectPath *ref);
+
 #endif




More information about the Libvirt-cim mailing list