[Libvirt-cim] [PATCH 4 of 6] Add NetworkPort functionality to SettingsDefineCapabilities. All static, max may become dynamic

Jay Gagnon grendel at linux.vnet.ibm.com
Thu Nov 8 20:51:24 UTC 2007


# HG changeset patch
# User Jay Gagnon <grendel at linux.vnet.ibm.com>
# Date 1194557377 18000
# Node ID 0ed8747c1dfbf14ff7f6e23ff792a35852294fa6
# Parent  94308147bed1693443d0741de6a30c5b0f77b0f1
Add NetworkPort functionality to SettingsDefineCapabilities.  All static, max may become dynamic.

Signed-off-by: Jay Gagnon <grendel at linux.vnet.ibm.com>

diff -r 94308147bed1 -r 0ed8747c1dfb src/Virt_SettingsDefineCapabilities.c
--- a/src/Virt_SettingsDefineCapabilities.c	Thu Nov 08 16:29:18 2007 -0500
+++ b/src/Virt_SettingsDefineCapabilities.c	Thu Nov 08 16:29:37 2007 -0500
@@ -195,6 +195,85 @@ static struct sdc_rasd_prop *mem_inc(con
         return rasd;
 }
 
+static struct sdc_rasd_prop *net_min(const CMPIObjectPath *ref,
+                                     CMPIStatus *s)
+{
+        bool ret;
+        uint16_t num_nics = 0;
+        struct sdc_rasd_prop *rasd = NULL;
+ 
+        struct sdc_rasd_prop tmp[] = {
+                {"InstanceID", (CMPIValue *)"Minimum", CMPI_chars},
+                {"VirtualQuantity", (CMPIValue *)&num_nics, CMPI_uint16},
+                PROP_END
+        };
+ 
+        ret = dup_rasd_prop_list(tmp, &rasd);
+        if (ret)
+                return rasd;
+        else
+                return NULL;
+}
+ 
+static struct sdc_rasd_prop *net_max(const CMPIObjectPath *ref,
+                                     CMPIStatus *s)
+{
+        bool ret;
+        uint16_t num_nics = 6;
+        struct sdc_rasd_prop *rasd = NULL;
+ 
+        struct sdc_rasd_prop tmp[] = {
+                {"InstanceID", (CMPIValue *)"Maximum", CMPI_chars},
+                {"VirtualQuantity", (CMPIValue *)&num_nics, CMPI_uint16},
+                PROP_END
+        };
+ 
+        ret = dup_rasd_prop_list(tmp, &rasd);
+        if (ret)
+                return rasd;
+        else
+                return NULL;
+}
+static struct sdc_rasd_prop *net_def(const CMPIObjectPath *ref,
+                                     CMPIStatus *s)
+{
+        bool ret;
+        uint16_t num_nics = 1;
+        struct sdc_rasd_prop *rasd = NULL;
+ 
+        struct sdc_rasd_prop tmp[] = {
+                {"InstanceID", (CMPIValue *)"Default", CMPI_chars},
+                {"VirtualQuantity", (CMPIValue *)&num_nics, CMPI_uint16},
+                PROP_END
+        };
+ 
+        ret = dup_rasd_prop_list(tmp, &rasd);
+        if (ret)
+                return rasd;
+        else
+                return NULL;
+}
+ 
+static struct sdc_rasd_prop *net_inc(const CMPIObjectPath *ref,
+                                     CMPIStatus *s)
+{
+        bool ret;
+        uint16_t num_nics = 1;
+        struct sdc_rasd_prop *rasd = NULL;
+ 
+        struct sdc_rasd_prop tmp[] = {
+                {"InstanceID", (CMPIValue *)"Increment", CMPI_chars},
+                {"VirtualQuantity", (CMPIValue *)&num_nics, CMPI_uint16},
+                PROP_END
+        };
+ 
+        ret = dup_rasd_prop_list(tmp, &rasd);
+        if (ret)
+                return rasd;
+        else
+                return NULL;
+}
+
 static struct sdc_rasd_prop *disk_min(const CMPIObjectPath *ref,
                                       CMPIStatus *s)
 {
@@ -334,6 +413,14 @@ static struct sdc_rasd mem = {
         .inc = mem_inc
 };
 
+static struct sdc_rasd network = {
+        .resource_type = CIM_RASD_TYPE_NET,
+        .min = net_min,
+        .max = net_max,
+        .def = net_def,
+        .inc = net_inc
+};
+
 static struct sdc_rasd disk = {
         .resource_type = CIM_RASD_TYPE_DISK,
         .min = disk_min,
@@ -344,6 +431,7 @@ static struct sdc_rasd disk = {
 
 static struct sdc_rasd *sdc_rasd_list[] = {
         &mem,
+        &network,
         &disk,
         NULL
 };




More information about the Libvirt-cim mailing list