[replying to myself]
On 01/18/2011 08:16 AM, Eric Blake wrote:
On 01/17/2011 10:39 PM, Wen Congyang wrote:
>> + cmd = virCommandNewArgList(qemu,
>> + "-device", "pci-assign,?",
>> + NULL);
>
> The qemu that I used does not support '-device pci-assign,?'...
> So, I can not start the guest with this patch.
>
> The qemu is cloned from here:
>
http://git.qemu.org/git/qemu.git
What do the following commands produce (assuming that both qemu and
qemu-kvm on your PATH are the binaries that you are testing with)?
qemu -version
qemu-kvm -version
qemu -device '?'
echo $?
qemu -device 'pci-assign,?'
echo $?
qemu -device '?' -device 'pci-assign,?'
echo $?
qemu-kvm -device '?'
echo $?
qemu-kvm -device 'pci-assign,?'
echo $?
qemu-kvm -device '?' -device 'pci-assign,?'
echo $?
I may have reproduced your problem. With a Fedora 13 VM (no nested kvm
support), I see:
$ qemu -version
QEMU PC emulator version 0.12.5 (qemu-kvm-0.12.5), Copyright (c)
2003-2008 Fabrice Bellard
$ qemu-kvm -device pci-assign,?
open /dev/kvm: No such file or directory
Could not initialize KVM, will disable KVM support
property "pci-assign.?" not found
can't set property "?" to "on" for "pci-assign"
$ echo $?
1
$ qemu -device pci-assign,?
The pci-assign device has not been found
$ echo $?
1
$ qemu -device ?
name "pci-bridge", bus PCI
...
name "isabus-bridge", bus System, no-user
$ echo ?
1
$ qemu -device pci-bridge,?
property "pci-bridge.?" not found
can't set property "?" to "on" for "pci-bridge"
$ echo ?
1
Looks like -device was added in qemu 0.12.x, but device-specific
property parsing via -device name,? wasn't added until 0.13.x.
Furthermore, -device ? works in both versions to list available devices,
but in 0.12.x it always makes qemu fail with non-zero status (which we
can probably safely ignore). Thankfully, this is reflected in -help output:
0.12.5:
-device driver[,options] add device
-name ...
0.13.0:
-device driver[,prop[=value][,...]]
add device (based on driver)
prop=value,... sets driver properties
use -device ? to print all possible drivers
use -device driver,? to print all possible properties
File ...
In fact, rather than keying off of QEMUD_CMD_FLAG_DEVICE (which is
whether -device is present at all) to call qemuCapsExtractDeviceStr, it
may be as simple as keying off of "-device driver,?" in the -help
output. Patch coming up shortly...
--
Eric Blake eblake(a)redhat.com +1-801-349-2682
Libvirt virtualization library
http://libvirt.org