Bug 509337 - "error: unknown OS type hvm " is threw out occasionally when defining domain
"error: unknown OS type hvm " is threw out occasionally when defining domain
Product: Red Hat Enterprise Linux 5
Classification: Red Hat
Component: libvirt (Show other bugs)
All Linux
medium Severity medium
: rc
: ---
Assigned To: Daniel Berrange
Virtualization Bugs
Depends On:
  Show dependency treegraph
Reported: 2009-07-02 06:15 EDT by Edward Wang
Modified: 2012-11-22 05:59 EST (History)
6 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2012-11-22 05:59:18 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)
domain xml (939 bytes, text/plain)
2009-07-02 06:19 EDT, Edward Wang
no flags Details

  None (edit)
Description Edward Wang 2009-07-02 06:15:27 EDT
Description of problem:
Sometimes, when I try to create a domain on kvm hypervisor by command "virsh define xxx.xml", error message "error: unknown OS type hvm" will be threw out. Then, I checked the service libvirtd status and find that it is running. But, if I restart libvirtd service by command "service libvirtd restart", the domain can be defined successfully.

Version-Release number of selected component (if applicable):
libvirt: libvirt-0.6.3-13.el5
kvm: kvm-83-82.el5
kernel: 2.6.18-155.el5

How reproducible:

Steps to Reproduce:
1. define domain by command "virsh define rhel5u3.xml" on kvm hypervisor
sometimes, error message "error: unknown OS type hvm" will be threw out
2. check libvirtd status by command "service libvirtd status", find it is running actually
3. restart service libvirtd by command "service libvirtd restart"
4. repeat step 1 again, find the domain can be defined successfully again.
Actual results:
error message in step 1 will be threw out occasionally

Expected results:
error message should not be threw out in step 1

Additional info:
1, please check attachment rhel5u3.xml, it is the domain xml I've used.
2, never hit this issue on xen hypervisor
Comment 1 Edward Wang 2009-07-02 06:19:41 EDT
Created attachment 350258 [details]
domain xml
Comment 5 Theophanis Kontogiannis 2010-03-03 11:12:53 EST
I saw the same behaviour with 100% success even with service libvirtd restart.
However it turned out in my case that the reason was that the kvm_intel module was not loaded.

Just a note if it helps...
Comment 6 Cole Robinson 2010-03-04 11:27:41 EST
What's happening here is that libvirt is generating empty capabilities when it doesn't detect /dev/kvm or any qemu binaries. Then, when the we read in the XML configs at daemon start up, we check the requested <os><type> against caps, and throw "error: unknown OS type hvm"

This is confusing and not very transparent: users will then run 'virsh list --all' and not see any of there VMs! We should find a way to avoid this validation on libvirtd startup, even if capabilities are incorrectly detected. Then maybe move this check to VM start time so the user gets a proper error.
Comment 7 Daniel Berrange 2010-03-04 11:39:26 EST
I don't think we can avoid this use of the capabilities in the parsing stage, because lots of other things depend on this lookup having been done. In particular this lets us ensure that the 'emulator' and 'machine type' fields are non-NULL for all parsed guests. Plenty of code in libvirt now assumes that is true, so changing it to allow NULLs is very risky. In addition, we also use the capabilities to canonicalize the machine type from 'pc' to 'pc-0.12' (or whatever is declared), and to determine whether the emulator supports static PCI address assignment.

Note You need to log in before you can comment on or make changes to this bug.