Bug 510179 - libvirt: a guest with the wrong config was defined in domain list
libvirt: a guest with the wrong config was defined in domain list
Status: CLOSED WONTFIX
Product: Red Hat Enterprise Linux 5
Classification: Red Hat
Component: libvirt (Show other bugs)
5.4
All Linux
medium Severity medium
: rc
: ---
Assigned To: Daniel Berrange
Virtualization Bugs
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2009-07-08 03:10 EDT by Alex Jia
Modified: 2009-12-14 16:09 EST (History)
2 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2009-08-04 12:16:52 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Alex Jia 2009-07-08 03:10:15 EDT
Description of problem:
when element "dev"'s value is "xvda",element "bus" will be assigned "xen",if user input dev="xvda" in guest configure file on kvm host,error configure will be generated and defined

Version-Release number of selected component (if applicable):
[root@dhcp-66-70-18 libvirt]# uname -a
Linux dhcp-66-70-18.nay.redhat.com 2.6.18-153.el5 #1 SMP Wed Jun 10 17:53:33 EDT 2009 x86_64 x86_64 x86_64 GNU/Linux
[root@dhcp-66-70-18 libvirt]# lsmod|grep kvm
kvm_intel              85992  0 
kvm                   222368  2 ksm,kvm_intel
[root@dhcp-66-70-18 libvirt]# rpm -qa|grep kvm
kvm-qemu-img-83-76.el5
kvm-83-84.el5
etherboot-zroms-kvm-5.4.4-10.el5
kmod-kvm-83-76.el5
[root@dhcp-66-70-18 libvirt]# rpm -qa|grep libvirt
libvirt-cim-0.5.5-2.el5
libvirt-0.6.3-14.el5
libvirt-python-0.6.3-14.el5
libvirt-debuginfo-0.6.3-14.el5
libvirt-devel-0.6.3-14.el5

How reproducible:
100%

Steps to Reproduce:
1.create a guest xml on kvm host
2.virsh define kvm.xml
or
[root@dhcp-66-70-18 libvirt]# python
Python 2.4.3 (#1, Sep 17 2008, 16:07:08) 
[GCC 4.1.2 20071124 (Red Hat 4.1.2-41)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import libvirt
>>> conn=libvirt.open(None)
>>> fp=open("kvm.xml","r")
>>> xml_desc=fp.read()
>>> print xml_desc
<?xml version='1.0' encoding='UTF-8'?>
<domain type='kvm'>
  <name>RHEL5.3-Server_http.qcow2</name>
  <uuid>af70873a-3e15-4e6b-bfa4-143f303d1941</uuid>
  <memory>1048576</memory>
  <vcpu>1</vcpu>
  <os>
    <type arch='x86_64'>hvm</type>
  </os>
  <on_poweroff>destroy</on_poweroff>
  <on_reboot>restart</on_reboot>
  <on_crash>restart</on_crash>
  <features>
    <acpi/>
    <apic/>
    <pae/>
  </features>
  <devices>
    <emulator>/usr/libexec/qemu-kvm</emulator>
    <disk device='disk' type='file'>
      <source file='/var/lib/libvirt/images/RHEL5.3-Server_http.qcow2'/>
      <target dev='xvda'/>
    </disk>
    <interface type='network'>
      <mac address='80:a6:9c:6e:b3:6d'/>
      <source network='virbr0'/>
    </interface>
    <input bus='ps2' type='mouse'/>
    <graphics keymap='en-us' type='vnc' port='-1'/>
    <console/>
  </devices>
</domain>

>>> dom=conn.defineXML(xml_desc)
>>> print dom.XMLDesc(0)
<domain type='kvm'>
  <name>RHEL5.3-Server_http.qcow2</name>
  <uuid>af70873a-3e15-4e6b-bfa4-143f303d1941</uuid>
  <memory>1048576</memory>
  <currentMemory>1048576</currentMemory>
  <vcpu>1</vcpu>
  <os>
    <type arch='x86_64' machine='pc'>hvm</type>
    <boot dev='hd'/>
  </os>
  <features>
    <acpi/>
    <apic/>
    <pae/>
  </features>
  <clock offset='utc'/>
  <on_poweroff>destroy</on_poweroff>
  <on_reboot>restart</on_reboot>
  <on_crash>restart</on_crash>
  <devices>
    <emulator>/usr/libexec/qemu-kvm</emulator>
    <disk type='file' device='disk'>
      <source file='/var/lib/libvirt/images/RHEL5.3-Server_http.qcow2'/>
      <target dev='xvda' bus='xen'/>
    </disk>
    <interface type='network'>
      <mac address='80:a6:9c:6e:b3:6d'/>
      <source network='virbr0'/>
    </interface>
    <serial type='pty'>
      <target port='0'/>
    </serial>
    <console type='pty'>
      <target port='0'/>
    </console>
    <input type='mouse' bus='ps2'/>
    <graphics type='vnc' port='-1' autoport='yes' keymap='en-us'/>
  </devices>
</domain>

  
Actual results:
a guest with the wrong config was defined.

Expected results:
The guest with wrong xml config should not be defined successfully.

Additional info:
Comment 2 Alex Jia 2009-07-08 22:55:17 EDT
guest with wrong xml config,but can be defined,if use virsh commands to start it,the result must be error,like this:

[root@dhcp-66-70-18 libvirt]# virsh start RHEL5.3-Server_http.qcow2
error: Failed to start domain RHEL5.3-Server_http.qcow2
error: internal error unable to start guest: qemu: 'file=/var/lib/libvirt/images/RHEL5.3-Server_http.qcow2,if=xen,index=0,boot=on' unsupported bus type 'xen'

I think that we should check the syntax of guest xml,guest with wrong config should not be defined
Comment 3 Daniel Berrange 2009-08-04 12:16:52 EDT
Only checking at boot time is intentional behaviour, since that's the point at which the information we need is guarenteed available & accurate. Checking at define time would lead to us rejecting valid configs in some scenarios

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