
# HG changeset patch # User Kaitlin Rupert <karupert@us.ibm.com> # Date 1225319502 25200 # Node ID 0d565002b6b2f75da0aebba6a6686b566e0d0889 # Parent a2adbfbbd6343451bffb739cb503f2e942ad5c94 (#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@us.ibm.com> diff -r a2adbfbbd634 -r 0d565002b6b2 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 @@ -1447,11 +1447,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; } } @@ -1496,6 +1501,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 */ @@ -1512,6 +1524,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) @@ -1569,10 +1587,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; } }