[libvirt] [PATCH] qemu: Allow hotplug of multiple SCSI devices

Martin Kletzander mkletzan at redhat.com
Thu Aug 8 12:27:13 UTC 2013


On 08/08/2013 01:26 PM, Viktor Mihajlovski wrote:
> From: Eric Farman <farman at linux.vnet.ibm.com>
> 
> Hotplugging a single SCSI device works, but adding additional ones
> result in an error from QEMU:
> 
> [root at gpok197 ~]# virsh attach-device guest01 blah.xml
> Device attached successfully
> [root at gpok197 ~]# virsh attach-device guest01 blah2.xml
> error: Failed to attach device from blah2.xml
> error: internal error unable to execute QEMU command 'device_add': Duplicate ID 'hostdev0' for device
> 
> The hostdev ID that is created is always set to zero, regardless
> of the contents of the XML.  Changing the index in the hotplug case
> to a negative one so the next available index is used.
> 
> Signed-off-by: Eric Farman <farman at linux.vnet.ibm.com>
> Reviewed-by: Viktor Mihajlovski <mihajlov at linux.vnet.ibm.com>
> ---
>  src/qemu/qemu_hotplug.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
> index 7a6946e..c9748d9 100644
> --- a/src/qemu/qemu_hotplug.c
> +++ b/src/qemu/qemu_hotplug.c
> @@ -1362,7 +1362,7 @@ qemuDomainAttachHostScsiDevice(virQEMUDriverPtr driver,
>          return -1;
>      }
>  
> -    if (qemuAssignDeviceHostdevAlias(vm->def, hostdev, 0) < 0)
> +    if (qemuAssignDeviceHostdevAlias(vm->def, hostdev, -1) < 0)
>          goto cleanup;
>  
>      if (!(drvstr = qemuBuildSCSIHostdevDrvStr(hostdev, priv->qemuCaps,
> 

ACK and pushed.

Thanks for finding out the problem.

Martin




More information about the libvir-list mailing list