[Libvirt-cim] [PATCH] (#2) Return an error for type processor in AddResource and RemoveResource

Kaitlin Rupert kaitlin at linux.vnet.ibm.com
Tue Jun 3 18:47:31 UTC 2008


# HG changeset patch
# User Kaitlin Rupert <karupert at us.ibm.com>
# Date 1212518806 25200
# Node ID 4f7942780a4186e3526b0c6435b0b32c05385013
# Parent  0c8d4baf3ee1f6eb96f7d1d49276fa6cc44c4685
(#2) Return an error for type processor in AddResource and RemoveResource.

A user should use ModifyResource to change the number of processors.

Also fix a warning caused by this change.

Update:
 -Fix copy and paste error.

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

diff -r 0c8d4baf3ee1 -r 4f7942780a41 src/Virt_VirtualSystemManagementService.c
--- a/src/Virt_VirtualSystemManagementService.c	Fri May 30 06:57:03 2008 -0700
+++ b/src/Virt_VirtualSystemManagementService.c	Tue Jun 03 11:46:46 2008 -0700
@@ -979,7 +979,7 @@
         CMPIObjectPath *op;
         struct virt_device **_list;
         struct virt_device *list;
-        int *count;
+        int *count = NULL;
         int i;
 
         op = CMGetObjectPath(rasd, &s);
@@ -987,7 +987,8 @@
                 goto out;
 
         _list = find_list(dominfo, type, &count);
-        if ((type == CIM_RES_TYPE_MEM) || (_list != NULL))
+        if ((type == CIM_RES_TYPE_MEM) || (type == CIM_RES_TYPE_PROC) ||
+           (_list != NULL))
                 list = *_list;
         else {
                 cu_statusf(_BROKER, &s,
@@ -1028,14 +1029,15 @@
         struct virt_device **_list;
         struct virt_device *list;
         struct virt_device *dev;
-        int *count;
+        int *count = NULL;
 
         op = CMGetObjectPath(rasd, &s);
         if ((op == NULL) || (s.rc != CMPI_RC_OK))
                 goto out;
 
         _list = find_list(dominfo, type, &count);
-        if ((type == CIM_RES_TYPE_MEM) || (_list == NULL)) {
+        if ((type == CIM_RES_TYPE_MEM) || (type == CIM_RES_TYPE_PROC) ||
+           (_list == NULL)) {
                 cu_statusf(_BROKER, &s,
                            CMPI_RC_ERR_FAILED,
                            "Cannot add resources of type %" PRIu16, type);




More information about the Libvirt-cim mailing list