# HG changeset patch
# User Kaitlin Rupert <karupert(a)us.ibm.com>
# Date 1225319502 25200
# Node ID 2333214c2f14a08cc18e7028830b3fd6f2e0a38d
# Parent 791b8e26b4ab4c2f1141f9bf807ece19fb08238c
(#2) Handle add/remove/modify support for graphics devices
There's not dynamic update support for graphics devices. If a user
add/removes/updates a graphics device while the guest is running, the changes
aren't picked up until the guest is restarted.
Updates from 1 to 2:
-Fix typo in error message
Signed-off-by: Kaitlin Rupert <karupert(a)us.ibm.com>
diff -r 791b8e26b4ab -r 2333214c2f14 src/Virt_VirtualSystemManagementService.c
--- a/src/Virt_VirtualSystemManagementService.c Wed Oct 29 15:31:42 2008 -0700
+++ b/src/Virt_VirtualSystemManagementService.c Wed Oct 29 15:31:42 2008 -0700
@@ -1448,11 +1448,16 @@
struct virt_device *dev = &list[i];
if (STREQ(dev->id, devid)) {
- s = _resource_dynamic(dominfo,
- dev,
- RESOURCE_DEL,
- CLASSNAME(op));
dev->type = CIM_RES_TYPE_UNKNOWN;
+
+ if (type == CIM_RES_TYPE_GRAPHICS)
+ cu_statusf(_BROKER, &s, CMPI_RC_OK, "");
+ else {
+ s = _resource_dynamic(dominfo,
+ dev,
+ RESOURCE_DEL,
+ CLASSNAME(op));
+ }
break;
}
}
@@ -1497,6 +1502,13 @@
goto out;
}
+ if ((type == CIM_RES_TYPE_GRAPHICS) && (*count > 0)) {
+ cu_statusf(_BROKER, &s,
+ CMPI_RC_ERR_FAILED,
+ "A resource already exists for type %" PRIu16,
type);
+ goto out;
+ }
+
list = realloc(*_list, ((*count)+1)*sizeof(struct virt_device));
if (list == NULL) {
/* No memory */
@@ -1513,6 +1525,12 @@
dev->type = type;
rasd_to_vdev(rasd, dominfo, dev, ns);
+
+ if (type == CIM_RES_TYPE_GRAPHICS) {
+ (*count)++;
+ cu_statusf(_BROKER, &s, CMPI_RC_OK, "");
+ goto out;
+ }
s = _resource_dynamic(dominfo, dev, RESOURCE_ADD, CLASSNAME(op));
if (s.rc != CMPI_RC_OK)
@@ -1570,10 +1588,15 @@
if (STREQ(dev->id, devid)) {
rasd_to_vdev(rasd, dominfo, dev, ns);
- s = _resource_dynamic(dominfo,
- dev,
- RESOURCE_MOD,
- CLASSNAME(op));
+
+ if (type == CIM_RES_TYPE_GRAPHICS)
+ cu_statusf(_BROKER, &s, CMPI_RC_OK, "");
+ else {
+ s = _resource_dynamic(dominfo,
+ dev,
+ RESOURCE_MOD,
+ CLASSNAME(op));
+ }
break;
}
}