[libvirt] [PATCH] Allow changing ejectable device in domains using default qemu emulator

Stuart Jansen sjansen at gurulabs.com
Thu Oct 23 17:30:59 UTC 2008


When a qemu domain is launched but an emulator is not explicitly
defined, the default emulator is used. Attempts to attach ejectable
devices to a domains using the default emulator fail with the error:
"Error Connecting CDROM: internal error\nCannot determine QEMU argv
syntax (null)".

The following patch is based on similar code in qemudStartVMDaemon() and
qemudBuildCommandLine(). I've tested it and it works.

Honestly, though, I think this patch is just a band-aid. I'd like to
supply a better patch, but I don't have enough experience to judge
certain side effects.

Instead of requiring functions to determine the emulator that will be
used to launch the next qemu domain, qemudStartVMDaemon() should record
the emulator that was used to start the current domain. It should also
record the emulator's capabilities.

This would make it unnecessary to call virDomainDefDefaultEmulator() in
qemudDomainChangeEjectableMedia(). It would also make it possible to
remove the virDomainDefDefaultEmulator() call from
qemudBuildCommandLine().

However, testCompareXMLToArgvFiles() will fail because
qemudBuildCommandLine() needs to know vm->def->emulator and
virDomainDefParseFile() doesn't set vm->def->emulator to a default
value. I don't know if this is a real problem, or if it just means the
test needs to be updated.

In addition, if we simply set vm->dev->emulator =
strdup(virDomainDefDefaultEmulator()) in qemudStartVMDaemon() then
virDomainDefFormat() will dump <emulator>...</emulator> for domains that
did't actually have it explicitly defined. I don't know if this is a bug
or improvement, but it is a change in behavior.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Allow-changing-ejectable-device-in-domains-using-def.patch
Type: application/mbox
Size: 1935 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20081023/76eb5708/attachment-0001.mbox>


More information about the libvir-list mailing list