[libvirt] [PATCH 07/10] Convert USB disks over to -device

Daniel Veillard veillard at redhat.com
Thu Dec 17 09:16:19 UTC 2009


On Tue, Dec 15, 2009 at 03:14:47PM +0000, Daniel P. Berrange wrote:
> The previous syntax was severely limited in its options
> 
>   -usbdevice disk:/home/berrange/output.img
> 
> The new syntax is the same as for other disk types
> 
>   -drive file=/home/berrange/output.img,if=none,id=usb-1,index=1
>   -device usb-storage,drive=usb-1
> 
> Again, the index= arg is wrong here, and will be removed in a
> later merge
> ---
>  src/qemu/qemu_conf.c |    9 +++++++--
>  1 files changed, 7 insertions(+), 2 deletions(-)
> 
> diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c
> index 464f582..7582319 100644
> --- a/src/qemu/qemu_conf.c
> +++ b/src/qemu/qemu_conf.c
> @@ -1447,7 +1447,9 @@ qemuBuildDriveDevStr(virConnectPtr conn,
>      case VIR_DOMAIN_DISK_BUS_VIRTIO:
>          virBufferAddLit(&opt, "virtio-blk-pci");
>          break;
> -
> +    case VIR_DOMAIN_DISK_BUS_USB:
> +        virBufferAddLit(&opt, "usb-storage");
> +        break;
>      default:
>          qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
>                           _("unsupported disk bus '%s' with device setup"), bus);
> @@ -2264,7 +2266,10 @@ int qemudBuildCommandLine(virConnectPtr conn,
>              virDomainDiskDefPtr disk = def->disks[i];
>              int withDeviceArg = 0;
>  
> -            if (disk->bus == VIR_DOMAIN_DISK_BUS_USB) {
> +            /* Unless we have -device, then USB disks need special
> +               handling */
> +            if ((disk->bus == VIR_DOMAIN_DISK_BUS_USB) &&
> +                !(qemuCmdFlags & QEMUD_CMD_FLAG_DEVICE)) {
>                  if (disk->device == VIR_DOMAIN_DISK_DEVICE_DISK) {
>                      ADD_USBDISK(disk->src);
>                  } else {

  ACK

Daniel

-- 
Daniel Veillard      | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
daniel at veillard.com  | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library  http://libvirt.org/




More information about the libvir-list mailing list