# HG changeset patch
# User Kaitlin Rupert <karupert(a)us.ibm.com>
# Date 1212425931 25200
# Node ID 7cf0b0142edb638ce43cc8f3209eef12b2f5e04b
# Parent 0c8d4baf3ee1f6eb96f7d1d49276fa6cc44c4685
Fix VSMS resource_add so that and additional tag is not added for processor.
The same is also true for memory. Also, be sure not to increment the count for processor
and memory since a guest will not have muultiple tags for these devices.
Remove check for memory after find_list(). We don't want to skip this becuase
it's possible to update the memory of a defined guest. It is not possible to update
the memory of a running guest, but this case is already handled by attach_device() in
device_parsing.c
Signed-off-by: Kaitlin Rupert <karupert(a)us.ibm.com>
diff -r 0c8d4baf3ee1 -r 7cf0b0142edb src/Virt_VirtualSystemManagementService.c
--- a/src/Virt_VirtualSystemManagementService.c Fri May 30 06:57:03 2008 -0700
+++ b/src/Virt_VirtualSystemManagementService.c Mon Jun 02 09:58:51 2008 -0700
@@ -1035,7 +1035,7 @@
goto out;
_list = find_list(dominfo, type, &count);
- if ((type == CIM_RES_TYPE_MEM) || (_list == NULL)) {
+ if (_list == NULL) {
cu_statusf(_BROKER, &s,
CMPI_RC_ERR_FAILED,
"Cannot add resources of type %" PRIu16, type);
@@ -1052,22 +1052,36 @@
goto out;
}
- list = realloc(*_list, ((*count)+1)*sizeof(struct virt_device));
- if (list == NULL) {
- /* No memory */
- cu_statusf(_BROKER, &s,
+ if ((type == CIM_RES_TYPE_PROC) || (type == CIM_RES_TYPE_MEM)) {
+ if (_list == NULL) {
+ cu_statusf(_BROKER, &s,
+ CMPI_RC_ERR_FAILED,
+ "Cannot modify resource: %" PRIu16, type);
+ goto out;
+ }
+ list = *_list;
+
+ dev = &list[0];
+ } else {
+ list = realloc(*_list, ((*count)+1)*sizeof(struct virt_device));
+ if (list == NULL) {
+ /* No memory */
+ cu_statusf(_BROKER, &s,
CMPI_RC_ERR_FAILED,
"Failed to allocate memory");
- goto out;
+ goto out;
+ }
+
+ *_list = list;
+ memset(&list[*count], 0, sizeof(list[*count]));
+
+ dev = &list[*count];
+ dev->type = type;
+ dev->id = strdup(devid);
}
-
- *_list = list;
- memset(&list[*count], 0, sizeof(list[*count]));
-
- dev = &list[*count];
-
dev->type = type;
dev->id = strdup(devid);
+
rasd_to_vdev(rasd, dominfo, dev, ns);
s = _resource_dynamic(dominfo, dev, RESOURCE_ADD, CLASSNAME(op));
@@ -1077,7 +1091,9 @@
cu_statusf(_BROKER, &s,
CMPI_RC_OK,
"");
- (*count)++;
+
+ if ((type != CIM_RES_TYPE_PROC) && (type != CIM_RES_TYPE_MEM))
+ (*count)++;
out:
return s;
Show replies by date
Kaitlin Rupert wrote:
# HG changeset patch
# User Kaitlin Rupert <karupert(a)us.ibm.com>
# Date 1212425931 25200
# Node ID 7cf0b0142edb638ce43cc8f3209eef12b2f5e04b
# Parent 0c8d4baf3ee1f6eb96f7d1d49276fa6cc44c4685
Fix VSMS resource_add so that and additional tag is not added for processor.
The same is also true for memory. Also, be sure not to increment the count for processor
and memory since a guest will not have muultiple tags for these devices.
Remove check for memory after find_list(). We don't want to skip this becuase
it's possible to update the memory of a defined guest. It is not possible to update
the memory of a running guest, but this case is already handled by attach_device() in
device_parsing.c
Signed-off-by: Kaitlin Rupert <karupert(a)us.ibm.com>
diff -r 0c8d4baf3ee1 -r 7cf0b0142edb src/Virt_VirtualSystemManagementService.c
Please ignore this patch. If we need to modify the memory or processors
of a guest, ModifyResource() should be used.
This patch was to address the problem where AddResource() returns a
success if a user attempts to add processors to a defined guest.
However, the number of processors doesn't change, so an error should be
returned.
Will send a different patch to handle this.
--
Kaitlin Rupert
IBM Linux Technology Center
kaitlin(a)linux.vnet.ibm.com