[Libvirt-cim] [PATCH 1 of 4] Add function to HostSystem that returns the host instance attribute values

Kaitlin Rupert kaitlin at linux.vnet.ibm.com
Mon Dec 17 18:25:20 UTC 2007


# HG changeset patch
# User Kaitlin Rupert <karupert at us.ibm.com>
# Date 1197915789 28800
# Node ID e147f8dd86aa3422d81610b5d9e659f7f5aada70
# Parent  72b93a4339e1c13080d6a6d80a580a7742c0b851
Add function to HostSystem that returns the host instance attribute values.

Add get_host_system_properties(const char *name, const char *ccname) which gets the Name and the CreationClassName attributes from the host instance.

Signed-off-by: Kaitlin Rupert <karupert at us.ibm.com>

diff -r 72b93a4339e1 -r e147f8dd86aa src/Virt_HostSystem.c
--- a/src/Virt_HostSystem.c	Fri Dec 14 10:37:01 2007 +0100
+++ b/src/Virt_HostSystem.c	Mon Dec 17 10:23:09 2007 -0800
@@ -110,6 +110,36 @@ static CMPIStatus return_host_cs(const C
         return s;
 }
 
+CMPIStatus get_host_system_properties(const char **name,
+                                      const char **ccname,
+                                      const CMPIObjectPath *ref,
+                                      const CMPIBroker *broker)
+{
+        CMPIStatus s = {CMPI_RC_OK, NULL};
+        CMPIInstance *host = NULL;
+
+        s = get_host_cs(broker, ref, &host);
+        if (s.rc != CMPI_RC_OK)
+                goto out;
+
+        if (cu_get_str_prop(host, "Name", name) != CMPI_RC_OK) {
+                cu_statusf(broker, &s,
+                           CMPI_RC_ERR_FAILED,
+                           "Unable to get name of HostSystem");
+                goto out;
+        }
+
+        if (cu_get_str_prop(host, "CreationClassName", ccname) != CMPI_RC_OK) {
+                cu_statusf(broker, &s,
+                           CMPI_RC_ERR_FAILED,
+                           "Unable to get creation class of HostSystem");
+                goto out;
+        }
+
+ out:
+        return s;
+}
+
 static CMPIStatus EnumInstanceNames(CMPIInstanceMI *self,
                                     const CMPIContext *context,
                                     const CMPIResult *results,
diff -r 72b93a4339e1 -r e147f8dd86aa src/Virt_HostSystem.h
--- a/src/Virt_HostSystem.h	Fri Dec 14 10:37:01 2007 +0100
+++ b/src/Virt_HostSystem.h	Mon Dec 17 10:23:09 2007 -0800
@@ -25,4 +25,8 @@ CMPIStatus get_host_cs(const CMPIBroker 
                        const CMPIObjectPath *reference,
                        CMPIInstance **instance);
 
+CMPIStatus get_host_system_properties(const char **name,
+                                      const char **ccname,
+                                      const CMPIObjectPath *ref,
+                                      const CMPIBroker *broker);
 #endif




More information about the Libvirt-cim mailing list