[libvirt] [PATCH]: Fix Qemu CD-ROM with no source

The new generic domain re-factor introduced a small regression into the drive handling code. In particular, if you had a section of XML like: <disk type='file' device='cdrom'> <target dev='hdc' bus='ide'/> <readonly/> </disk> This used to work with older libvirt, but now fails. This is because we are actually passing the literal string (null) to the qemu command-line, which qemu barfs on. This patch fixes it up by making it blank, which allows qemu to continue on it's merry way. Signed-off-by: Chris Lalancette <clalance@redhat.com>

On Tue, Jul 29, 2008 at 12:07:37PM +0200, Chris Lalancette wrote:
The new generic domain re-factor introduced a small regression into the drive handling code. In particular, if you had a section of XML like:
<disk type='file' device='cdrom'> <target dev='hdc' bus='ide'/> <readonly/> </disk>
This used to work with older libvirt, but now fails. This is because we are actually passing the literal string (null) to the qemu command-line, which qemu barfs on. This patch fixes it up by making it blank, which allows qemu to continue on it's merry way.
Signed-off-by: Chris Lalancette <clalance@redhat.com>
ACK, looks fine. The other branch for QEMU without -drive, will simply omit the '-cdrom' arg, which is correct behaviour because QEMU adds an implicit CDROM device in that case. Daniel -- |: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :| |: http://libvirt.org -o- http://virt-manager.org -o- http://ovirt.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|

On Tue, Jul 29, 2008 at 11:14:07AM +0100, Daniel P. Berrange wrote:
On Tue, Jul 29, 2008 at 12:07:37PM +0200, Chris Lalancette wrote:
The new generic domain re-factor introduced a small regression into the drive handling code. In particular, if you had a section of XML like:
<disk type='file' device='cdrom'> <target dev='hdc' bus='ide'/> <readonly/> </disk>
This used to work with older libvirt, but now fails. This is because we are actually passing the literal string (null) to the qemu command-line, which qemu barfs on. This patch fixes it up by making it blank, which allows qemu to continue on it's merry way.
Signed-off-by: Chris Lalancette <clalance@redhat.com>
ACK, looks fine. The other branch for QEMU without -drive, will simply omit the '-cdrom' arg, which is correct behaviour because QEMU adds an implicit CDROM device in that case.
Oh, btw, if you have the time, could you also cook up the data files for tests/qemuxml2argvdata/ to allow us to validate this behaviour in the test suite. Daniel -- |: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :| |: http://libvirt.org -o- http://virt-manager.org -o- http://ovirt.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|

Daniel P. Berrange wrote:
On Tue, Jul 29, 2008 at 12:07:37PM +0200, Chris Lalancette wrote:
The new generic domain re-factor introduced a small regression into the drive handling code. In particular, if you had a section of XML like:
<disk type='file' device='cdrom'> <target dev='hdc' bus='ide'/> <readonly/> </disk>
This used to work with older libvirt, but now fails. This is because we are actually passing the literal string (null) to the qemu command-line, which qemu barfs on. This patch fixes it up by making it blank, which allows qemu to continue on it's merry way.
Signed-off-by: Chris Lalancette <clalance@redhat.com>
ACK, looks fine. The other branch for QEMU without -drive, will simply omit the '-cdrom' arg, which is correct behaviour because QEMU adds an implicit CDROM device in that case.
Oh, btw: even qemu with -drive implicitly adds and cdrom drive (ide1 master). Unless you configure something else there of course. So you can end up with two virtual cdrom drives even with only one specified on the command line (happens in case you connect the cdrom to something other than ide1 master). And there are some other implicit block devices (floppy and sd card). Try 'info block' on the monitor ;) Just for completeness, in case anyone cares ... cheers, Gerd -- http://kraxel.fedorapeople.org/xenner/
participants (3)
-
Chris Lalancette
-
Daniel P. Berrange
-
Gerd Hoffmann