[Libvirt-cim] [PATCH] Update template RASD in SettingsDefineCapabilities

Sharad Mishra snmishra at us.ibm.com
Wed Jun 24 00:22:20 UTC 2009


# HG changeset patch
# User snmishra at us.ibm.com
# Date 1245802726 25200
# Node ID f01f53df87f130915c6152c3a2c97eb9412853b3
# Parent  4bd5db5f544279f099b4d7565157c675cf072936
Update template RASD in SettingsDefineCapabilities.

This patch completes the work required to support
bridge NICs.

Signed-off-by: Sharad Mishra <snmishra at us.ibm.com>

diff -r 4bd5db5f5442 -r f01f53df87f1 src/Virt_SettingsDefineCapabilities.c
--- a/src/Virt_SettingsDefineCapabilities.c	Mon Jun 22 11:17:56 2009 -0700
+++ b/src/Virt_SettingsDefineCapabilities.c	Tue Jun 23 17:18:46 2009 -0700
@@ -538,6 +538,8 @@
 static CMPIStatus set_net_props(int type,
                                 const CMPIObjectPath *ref,
                                 const char *id,
+                                const char *net_type,
+                                const char *net_name,
                                 uint64_t num_nics,
                                 const char *model,
                                 struct inst_list *list)
@@ -549,6 +551,10 @@
         if ((inst == NULL) || (s.rc != CMPI_RC_OK))
                 goto out;
 
+        CMSetProperty(inst, "NetworkType", (CMPIValue *)net_type, CMPI_chars);
+	if (net_name != NULL)
+                CMSetProperty(inst, "NetworkName",
+                      (CMPIValue *)net_name, CMPI_chars);
         CMSetProperty(inst, "InstanceID", (CMPIValue *)id, CMPI_chars);
         CMSetProperty(inst, "VirtualQuantity",
                       (CMPIValue *)&num_nics, CMPI_uint64);
@@ -571,6 +577,9 @@
         uint64_t num_nics;
         const char *id;
         CMPIStatus s = {CMPI_RC_OK, NULL};
+        int i,j;
+        const char *type[] = {"network", "bridge"};
+        const char *model[] = {"e1000", NULL};
 
         switch (template_type) {
         case SDC_RASD_MIN:
@@ -599,12 +608,14 @@
         }
 
         
-        s = set_net_props(template_type, ref, id, num_nics, "e1000", list);
-        if (s.rc != CMPI_RC_OK)
-                goto out;
-     
-        s = set_net_props(template_type, ref, id, num_nics, NULL, list);
-
+        for (i = 0; i < 2; i++) {
+                for (j = 0; j < 2; j++) {
+                        s = set_net_props(template_type, ref, id, type[i], NULL, num_nics, model[j], list);
+                        if (s.rc != CMPI_RC_OK)
+                                goto out;
+                }
+        }
+        
  out:
         return s;
 }




More information about the Libvirt-cim mailing list