[libvirt] [PATCH 4/4] Fix CDROM media change for QEMU when using -device syntax

Daniel Veillard veillard at redhat.com
Thu Apr 15 16:01:26 UTC 2010


On Thu, Apr 15, 2010 at 11:43:11AM +0100, Daniel P. Berrange wrote:
> Disk devices in QEMU have two parts, the guest device and the host
> backend driver. Historically these two parts have had the same
> "unique" name. With the switch to using -device though, they now
> have separate names. Thus when changing CDROM media, for guests
> using -device syntax, we need to prepend the QEMU_DRIVE_HOST_PREFIX
> constant
> 
> * src/qemu/qemu_conf.c, src/qemu/qemu_conf.h: Add helper function
>   qemuDeviceDriveHostAlias() for building a host backend alias
> * src/qemu/qemu_driver.c: Use qemuDeviceDriveHostAlias() to determine
>   the host backend alias for performing eject/change commands in the
>   monitor
> ---
>  src/qemu/qemu_conf.c   |   20 ++++++++++++++++++++
>  src/qemu/qemu_conf.h   |    3 +++
>  src/qemu/qemu_driver.c |   18 +++++++++++++-----
>  3 files changed, 36 insertions(+), 5 deletions(-)
[...]
> @@ -7443,7 +7451,7 @@ static int qemudDomainAttachDevice(virDomainPtr dom,
>          switch (dev->data.disk->device) {
>          case VIR_DOMAIN_DISK_DEVICE_CDROM:
>          case VIR_DOMAIN_DISK_DEVICE_FLOPPY:
> -            ret = qemudDomainChangeEjectableMedia(driver, vm, dev->data.disk);
> +            ret = qemudDomainChangeEjectableMedia(driver, vm, dev->data.disk, qemuCmdFlags);
>              if (ret == 0)
>                  dev->data.disk = NULL;
>              break;
> @@ -7688,7 +7696,7 @@ static int qemuDomainUpdateDeviceFlags(virDomainPtr dom,
>          switch (dev->data.disk->device) {
>          case VIR_DOMAIN_DISK_DEVICE_CDROM:
>          case VIR_DOMAIN_DISK_DEVICE_FLOPPY:
> -            ret = qemudDomainChangeEjectableMedia(driver, vm, dev->data.disk);
> +            ret = qemudDomainChangeEjectableMedia(driver, vm, dev->data.disk, qemuCmdFlags);
>              if (ret == 0)
>                  dev->data.disk = NULL;
>              break;

  small nit, can we keep those two lines on 80 chars ?

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