[Libvirt-cim] [PATCH 3 of 3] Expose NetRASD templates with interface model specified

Kaitlin Rupert kaitlin at linux.vnet.ibm.com
Mon Apr 20 18:14:39 UTC 2009


# HG changeset patch
# User Kaitlin Rupert <karupert at us.ibm.com>
# Date 1240250572 25200
# Node ID e5000891e231e6b9896786e48442ef98bfe9f9fd
# Parent  7456dabe495895b047b9308c38506cbba1fc0507
Expose NetRASD templates with interface model specified.

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

diff -r 7456dabe4958 -r e5000891e231 src/Virt_SettingsDefineCapabilities.c
--- a/src/Virt_SettingsDefineCapabilities.c	Mon Apr 20 11:00:16 2009 -0700
+++ b/src/Virt_SettingsDefineCapabilities.c	Mon Apr 20 11:02:52 2009 -0700
@@ -524,6 +524,34 @@
         return ret;
 }
 
+static CMPIStatus set_net_props(int type,
+                                const CMPIObjectPath *ref,
+                                const char *id,
+                                uint64_t num_nics,
+                                const char *model,
+                                struct inst_list *list)
+{
+        CMPIInstance *inst;
+        CMPIStatus s = {CMPI_RC_OK, NULL};
+
+        inst = sdc_rasd_inst(&s, ref, CIM_RES_TYPE_NET);
+        if ((inst == NULL) || (s.rc != CMPI_RC_OK))
+                goto out;
+
+        CMSetProperty(inst, "InstanceID", (CMPIValue *)id, CMPI_chars);
+        CMSetProperty(inst, "VirtualQuantity",
+                      (CMPIValue *)&num_nics, CMPI_uint64);
+
+        if (model != NULL)
+                CMSetProperty(inst, "ResourceSubType", 
+                             (CMPIValue *)model, CMPI_chars);
+
+        inst_list_add(list, inst);
+
+ out:
+        return s;
+}
+
 static CMPIStatus net_template(const CMPIObjectPath *ref,
                                int template_type,
                                struct inst_list *list)
@@ -531,7 +559,6 @@
         bool ret;
         uint64_t num_nics;
         const char *id;
-        CMPIInstance *inst;
         CMPIStatus s = {CMPI_RC_OK, NULL};
 
         switch (template_type) {
@@ -560,15 +587,12 @@
                 goto out;
         }
 
-        inst = sdc_rasd_inst(&s, ref, CIM_RES_TYPE_NET); 
-        if ((inst == NULL) || (s.rc != CMPI_RC_OK))
+        
+        s = set_net_props(template_type, ref, id, num_nics, "e1000", list);
+        if (s.rc != CMPI_RC_OK)
                 goto out;
-
-        CMSetProperty(inst, "InstanceID", (CMPIValue *)id, CMPI_chars);
-        CMSetProperty(inst, "VirtualQuantity", 
-                      (CMPIValue *)&num_nics, CMPI_uint64);
-
-        inst_list_add(list, inst);
+     
+        s = set_net_props(template_type, ref, id, num_nics, NULL, list);
 
  out:
         return s;




More information about the Libvirt-cim mailing list