[Libvirt-cim] [PATCH] Fix qos bug when retrieving SettingsDefineCapabilites RASDs for primordial Network/0 pool

Gareth S. Bestor bestor at us.ibm.com
Mon Oct 31 08:37:07 UTC 2011


# HG changeset patch
# User Gareth S. Bestor <bestor at us.ibm.com>
# Date 1320049754 25200
# Node ID e1660ac9b5fc44b863b438b6b483edf66784453e
# Parent  862bcd60ae449932205b15ba42b37e06e6834de4
Fix qos bug when retrieving SettingsDefineCapabilites RASDs for primordial Network/0 pool
For some reason, when retreiving at SettingsDefinesCapabilites for only the
primordial network pool 'Network/0' the qos code is called for the
'Minimum' RASDs (?!), which because the associated ID is a constant causes
the string substitution code for renaming the qos 'Point/...' RASDs to
crash. This patch fixes this qos code so that the InstanceID string is only
manipulated for Point RASDs.
"Signed-off-by: Gareth S. Bestor <bestor at us.ibm.com>"

diff -r 862bcd60ae44 -r e1660ac9b5fc src/Virt_SettingsDefineCapabilities.c
--- a/src/Virt_SettingsDefineCapabilities.c	Wed Oct 26 03:41:56 2011 -0700
+++ b/src/Virt_SettingsDefineCapabilities.c	Mon Oct 31 01:29:14 2011 -0700
@@ -756,34 +756,37 @@
                 if ((inst == NULL) || (s.rc != CMPI_RC_OK))
                         goto out;
 
+                if (strncmp("Point", id, 5) != 0)
+                        CMSetProperty(inst, "InstanceID", (CMPIValue *)id, CMPI_chars);
+                else {
+                        tmp_str = strtok(id, " ");
+                        if (tmp_str == NULL) {
+                                CU_DEBUG("Cannot set InstanceID");
+                                goto out;
+                        }
 
-                tmp_str = strtok(id, " ");
-                if (tmp_str == NULL) {
-                        CU_DEBUG("Cannot set InstanceID");
-                        goto out;
+                        CU_DEBUG("InstanceID = %s", tmp_str);
+
+                        CMSetProperty(inst, "InstanceID", (CMPIValue *)tmp_str, 
+                                      CMPI_chars);
+                        tmp_str = strtok('\0', " ");
+                        if (tmp_str == NULL) {
+                                CU_DEBUG("Cannot set Reservation");
+                                goto out;
+                        }
+
+                        CU_DEBUG("Reservation = %s", tmp_str);
+
+                        uint64_t val = atoi(tmp_str);
+
+                        CMSetProperty(inst, "Reservation",
+                                      (CMPIValue *)&val, CMPI_uint64);
+
+                        CMSetProperty(inst, "AllocationUnits",
+                                      (CMPIValue *)"Kilobits per Second", 
+                                      CMPI_chars);
                 }
 
-                CU_DEBUG("InstanceID = %s", tmp_str);
-
-                CMSetProperty(inst, "InstanceID", (CMPIValue *)tmp_str, 
-                              CMPI_chars);
-                tmp_str = strtok('\0', " ");
-                if (tmp_str == NULL) {
-                        CU_DEBUG("Cannot set Reservation");
-                        goto out;
-                }
-
-                CU_DEBUG("Reservation = %s", tmp_str);
-
-                uint64_t val = atoi(tmp_str);
-
-                CMSetProperty(inst, "Reservation",
-                              (CMPIValue *)&val, CMPI_uint64);
-
-                CMSetProperty(inst, "AllocationUnits",
-                              (CMPIValue *)"Kilobits per Second", 
-                              CMPI_chars);
-
                 CMSetProperty(inst, "Address",
                               (CMPIValue *)addr, CMPI_chars);
 




More information about the Libvirt-cim mailing list