On 08/12/2015 10:52 AM, Ján Tomko wrote: > We only support hotplugging SCSI controllers, > USB and virtio-serial related code is useless here. > --- > src/qemu/qemu_hotplug.c | 18 ------------------ > 1 file changed, 18 deletions(-) > It's true that we only call this from two places currently: 1. qemuDomainAttachDeviceControllerLive (static) -> Only when cont->type == VIR_DOMAIN_CONTROLLER_TYPE_SCSI 2. qemuDomainFindOrCreateSCSIDiskController (static) -> Only via qemuDomainAttachSCSIDisk which only gets called when (disk->bus == VIR_DOMAIN_DISK_BUS_SCSI However, this is a global (ok somewhat global) function and thus could erroneously be called by something else not realizing it's only supported for SCSI. So it seems to me perhaps the check and message from qemuDomainAttachDeviceControllerLive could be moved to the top of this function... > diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c > index aabdb78..8e38153 100644 > --- a/src/qemu/qemu_hotplug.c > +++ b/src/qemu/qemu_hotplug.c > @@ -432,7 +432,6 @@ int qemuDomainAttachControllerDevice(virQEMUDriverPtr driver, > char *devstr = NULL; > qemuDomainObjPrivatePtr priv = vm->privateData; > bool releaseaddr = false; > - bool addedToAddrSet = false; > e.g. right here: if (cont->type != VIR_DOMAIN_CONTROLLER_TYPE_SCSI) { virReportError(VIR_ERR_OPERATION_UNSUPPORTED, _("'%s' controller cannot be hot plugged."), virDomainControllerTypeToString(cont->type)); return -1; } Then the other code just becomes: return qemuDomainAttachControllerDevice(driver, vm, cont); With the rest of this as is. John > if (virDomainControllerFind(vm->def, controller->type, controller->idx) >= 0) { > virReportError(VIR_ERR_OPERATION_FAILED, > @@ -463,20 +462,6 @@ int qemuDomainAttachControllerDevice(virQEMUDriverPtr driver, > if (qemuAssignDeviceControllerAlias(vm->def, priv->qemuCaps, controller) < 0) > goto cleanup; > > - if (controller->type == VIR_DOMAIN_CONTROLLER_TYPE_USB && > - controller->model == -1 && > - !virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_PIIX3_USB_UHCI)) { > - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", > - _("USB controller hotplug unsupported in this QEMU binary")); > - goto cleanup; > - } > - > - if (controller->type == VIR_DOMAIN_CONTROLLER_TYPE_VIRTIO_SERIAL && > - virDomainVirtioSerialAddrSetAddController(priv->vioserialaddrs, > - controller) < 0) > - goto cleanup; > - addedToAddrSet = true; > - > if (!(devstr = qemuBuildControllerDevStr(vm->def, controller, priv->qemuCaps, NULL))) > goto cleanup; > } > @@ -505,9 +490,6 @@ int qemuDomainAttachControllerDevice(virQEMUDriverPtr driver, > } > > cleanup: > - if (ret != 0 && addedToAddrSet) > - virDomainVirtioSerialAddrSetRemoveController(priv->vioserialaddrs, > - controller); > if (ret != 0 && releaseaddr) > qemuDomainReleaseDeviceAddress(vm, &controller->info, NULL); > > -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list