[Libvirt-cim] [PATCH 5 of 5] Fix _get_vsms() call so other providers can call it

Kaitlin Rupert kaitlin at linux.vnet.ibm.com
Thu Nov 8 23:48:51 UTC 2007


# HG changeset patch
# User Kaitlin Rupert <karupert at us.ibm.com>
# Date 1194558013 28800
# Node ID 1fc24e24237efa5ea495b48c2beb8bb10afc2270
# Parent  34e8e0d331e42f42545342dd765d35ee66aabd56
Fix _get_vsms() call so other providers can call it.

Remove static from _get_vsms(), rename function, add support for a broker from another provider, and add the function declartion to a header file.  This will allow other providers to call this function as needed.

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

diff -r 34e8e0d331e4 -r 1fc24e24237e src/Virt_VirtualSystemManagementService.c
--- a/src/Virt_VirtualSystemManagementService.c	Thu Nov 08 13:40:08 2007 -0800
+++ b/src/Virt_VirtualSystemManagementService.c	Thu Nov 08 13:40:13 2007 -0800
@@ -41,6 +41,7 @@
 #include "std_indication.h"
 #include "misc_util.h"
 
+#include "Virt_VirtualSystemManagementService.h"
 #include "Virt_ComputerSystem.h"
 #include "Virt_ComputerSystemIndication.h"
 #include "Virt_RASD.h"
@@ -992,25 +993,26 @@ STDIM_MethodMIStub(, Virt_VirtualSystemM
 STDIM_MethodMIStub(, Virt_VirtualSystemManagementService,
                    _BROKER, CMNoHook, my_handlers);
 
-static CMPIStatus _get_vsms(const CMPIObjectPath *reference,
-                            CMPIInstance **_inst,
-                            int name_only)
+CMPIStatus get_vsms(const CMPIObjectPath *reference,
+                    CMPIInstance **_inst,
+                    const CMPIBroker *broker,
+                    int name_only)
 {
         CMPIStatus s;
         CMPIInstance *inst;
         CMPIInstance *host;
         char *val = NULL;
 
-        s = get_host_cs(_BROKER, reference, &host);
+        s = get_host_cs(broker, reference, &host);
         if (s.rc != CMPI_RC_OK)
                 goto out;
 
-        inst = get_typed_instance(_BROKER,
+        inst = get_typed_instance(broker,
                                   "VirtualSystemManagementService",
                                   NAMESPACE(reference));
         if (inst == NULL) {
                 CU_DEBUG("Failed to get typed instance");
-                cu_statusf(_BROKER, &s,
+                cu_statusf(broker, &s,
                            CMPI_RC_ERR_FAILED,
                            "Failed to create instance");
                 goto out;
@@ -1020,7 +1022,7 @@ static CMPIStatus _get_vsms(const CMPIOb
                       (CMPIValue *)"Management Service", CMPI_chars);
 
         if (cu_get_str_prop(host, "Name", &val) != CMPI_RC_OK) {
-                cu_statusf(_BROKER, &s,
+                cu_statusf(broker, &s,
                            CMPI_RC_ERR_FAILED,
                            "Unable to get name of System");
                 goto out;
@@ -1031,7 +1033,7 @@ static CMPIStatus _get_vsms(const CMPIOb
         free(val);
 
         if (cu_get_str_prop(host, "CreationClassName", &val) != CMPI_RC_OK) {
-                cu_statusf(_BROKER, &s,
+                cu_statusf(broker, &s,
                            CMPI_RC_ERR_FAILED,
                            "Unable to get creation class of system");
                 goto out;
@@ -1055,7 +1057,7 @@ static CMPIStatus return_vsms(const CMPI
         CMPIInstance *inst;
         CMPIStatus s;
 
-        s = _get_vsms(reference, &inst, name_only);
+        s = get_vsms(reference, &inst, _BROKER, name_only);
         if (s.rc != CMPI_RC_OK)
                 goto out;
 
@@ -1097,7 +1099,7 @@ static CMPIStatus GetInstance(CMPIInstan
         CMPIStatus s;
         const char *prop;
 
-        s = _get_vsms(ref, &inst, 0);
+        s = get_vsms(ref, &inst, _BROKER, 0);
         if (s.rc != CMPI_RC_OK)
                 return s;
 
diff -r 34e8e0d331e4 -r 1fc24e24237e src/Virt_VirtualSystemManagementService.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/Virt_VirtualSystemManagementService.h	Thu Nov 08 13:40:13 2007 -0800
@@ -0,0 +1,25 @@
+/*
+ * Copyright IBM Corp. 2007
+ *
+ * Authors:
+ *  Kaitlin Rupert <karupert at us.ibm.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
+ */
+
+CMPIStatus get_vsms(const CMPIObjectPath *reference,
+                    CMPIInstance **_inst,
+                    const CMPIBroker *broker,
+                    int name_only);




More information about the Libvirt-cim mailing list