
On 11/21/2013 04:36 AM, Eric Farman wrote:
For systems without a PCI bus, attaching a SCSI controller fails:
[root@xxxxxxxx ~]# cat controller.xml <controller type='scsi' model='virtio-scsi' index='0' /> [root@xxxxxxxx ~]# virsh attach-device guest01 controller.xml error: Failed to attach device from controller.xml error: XML error: No PCI buses available
A similar problem occurs with the detach of a controller:
[root@xxxxxxxx ~]# virsh detach-device guest01 controller.xml error: Failed to detach device from controller.xml error: operation failed: controller scsi:0 not found
The qemuDomainXXtachPciControllerDevice routines made assumptions that any caller had a PCI bus. These routines now selectively calls PCI functions where necessary, and assigns the device information type to one appropriate for the bus in use.
Signed-off-by: Eric Farman <farman@linux.vnet.ibm.com> --- src/qemu/qemu_hotplug.c | 41 +++++++++++++++++++++++++++++++++-------- 1 file changed, 33 insertions(+), 8 deletions(-)
ACK and I've pushed the series with the following changes:
+ + if (controller->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE || + controller->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI) { + if (qemuDomainPCIAddressEnsureAddr(priv->pciaddrs, &controller->info) < 0) + goto cleanup; + } else if (controller->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_CCW) {
+ if (qemuDomainCCWAddressAssign(&controller->info, priv->ccwaddrs, true) < 0)
I have changed this to: if (qemuDomainCCWAddressAssign(&controller->info, priv->ccwaddrs, !controller->info.addr.ccw.assigned) < 0) to prevent overwriting the user-requested address and match the other CCWAddressAssign calls
+ goto cleanup; + } releaseaddr = true; if (qemuAssignDeviceControllerAlias(controller) < 0) goto cleanup;
+ } + + if (detach->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI &&
s/!=/==/
+ qemuIsMultiFunctionDevice(vm->def, &detach->info)) { virReportError(VIR_ERR_OPERATION_FAILED, _("cannot hot unplug multifunction PCI device: %s"), dev->data.disk->dst);
Jan