2012/6/19 Alex Jia <ajia(a)redhat.com>:
On 06/19/2012 02:56 PM, Zhihua Che wrote:
>
> hi,
>
> I compiled the libvirt-0.9.10 and started the libvirtd with sudo.
> Unfortunately, I got an Error, saying 'virDomainDefParseXML unknown OS
> type hvm'. I debugged it and found in function
> virCapabilitiesSupportsGuestOSType, the parameter caps->nguests is 0.
> On the other hand, I tried start the libvirtd with common user, and
> creating domain with virsh, i found the caps->ngusts is 2 and had one
> value 'hvm', so it didn't complain the error above, instead, it
> complained could not load PC BIOS bios.bin.
>
> I'd say I searched a lot and people say it's caused by without loading
> kvm and kvm-intel module. So, I checked and it is loaded. Any tips
> here?
Please check libvirtd.log further, if you saw the following similar error:
xxxx : xxxx : error : qemuCapsComputeCmdFlags:1209 : unsupported
configuration: this qemu binary requires libvirt to be compiled with yajl
xxxx : xxxx : error : virDomainDefParseXML:8312 : internal error No guest
options available for arch 'x86_64'
It means you need to install yajl-devel rpm package, for more, you may run
'./configure -h':
# ./configure -h | grep yajl
--with-yajl use YAJL for JSON parsing/formatting
[default=check]
BTW, If you're compiling a current libvirt upstream, you will get a friendly
reminder, so suggest to try latest libvirt upstream.
>
I hack the code and I guess find the bug... But I wonder how this happened.
First, I'm sorry I forgot to mention that I installed my
qemu-system-x86_64 in a non-default path, that is, NOT in /usr/bin,
/usr/local/bin etc.
In this case, if I started up libvirtd with sudo, qemuCapsInitGuest
failed to add hvm guest os type to driver->capabilities because it
can't find qemu-system-x86_64 by searching environmental variable
PATH!.
But, the most confusing thing happened here. I've added the
qemu-system-x86_64 in PATH by editing the /etc/bash.bashrc. Why can't
it still find the qemu?. I found in
qemuCapsInitGuest->virFindFileInPath(info->binary) that the call to
getenv("PATH") didn't return the path I added myself!