
+static char *add_device_nodup(struct virt_device *dev, + struct virt_device *list, + int max, + int *index) +{ + int i; + + for (i = 0; i < *index; i++) { + struct virt_device *ptr = &list[i]; + + if (STREQC(ptr->id, dev->id)) { + CU_DEBUG("Overriding device %s from refconf", ptr->id); + cleanup_virt_device(ptr); + memcpy(ptr, dev, sizeof(*ptr)); + return NULL; + } + } + + if (*index == max) + return "Internal error: no more device slots";
I don't think this handles the case where the user supplies a disk/net RASD for the ResourceSettings that is different from the disk/net device specified in the ReferencedConfiguration guest. Let say the user only specifies the RefConfig plus an additional net device for the ResourceSettings. The value for count is 1 (because that's the size of the array passed in). The net device isn't a dup, so the value of index is bumped up to 1, and we return an error. Some debug I added: Virt_VirtualSystemManagementService.c(643): trying to add aa:aa:aa:00:00:00 - the value of refconf dev id is 11:22:33:aa:bb:cc Virt_VirtualSystemManagementService.c(652): *index is 1, max is 1 Virt_VirtualSystemManagementService.c(983): Failed to classify resources: Internal error: no more device slots -- Kaitlin Rupert IBM Linux Technology Center kaitlin@linux.vnet.ibm.com