Bug 584777 - Problems converting an XM configuration to libvirt XML
Problems converting an XM configuration to libvirt XML
Status: CLOSED CURRENTRELEASE
Product: Virtualization Tools
Classification: Community
Component: libvirt (Show other bugs)
unspecified
All Linux
low Severity medium
: ---
: ---
Assigned To: Libvirt Maintainers
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2010-04-22 07:51 EDT by Pierre Riteau
Modified: 2016-04-15 08:42 EDT (History)
2 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2016-04-14 15:59:44 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 Pierre Riteau 2010-04-22 07:51:06 EDT
Description of problem:

I'm trying to convert the following XM configuration, which works fine with Xen 3.2.1:

kernel      = '/boot/vmlinuz-2.6.26-2-xen-amd64'
ramdisk     = '/boot/initrd.img-2.6.26-2-xen-amd64'
memory      = '128'
root        = '/dev/xvda2 ro'
disk        = [
                  'file:/opt/xen/domains/domU/swap.img,xvda1,w',
                  'file:/opt/xen/domains/domU/disk.img,xvda2,w',
              ]
name        = 'domU'
dhcp        = 'dhcp'
vif = [ 'mac=00:16:3E:70:61:00,bridge=xenbr0' ]
on_poweroff = 'destroy'
on_reboot   = 'restart'
on_crash    = 'restart'

Version-Release number of selected component (if applicable):

0.8.0

How reproducible:

Steps to Reproduce:
1. Copy the above configuration to domU.cfg
2. Run: virsh domxml-from-native xen-xm domU.cfg
  
Actual results:

virsh prints:
error: Unknown failure

Expected results:

A libvirt domain XML 

Additional info:

By tracing the code I found that this can be avoided by adding a uuid field in the XM configuration file.
In this case, the XML produced is the following:

<domain type='xen'>
  <name>domU</name>
  <uuid>1e164e3e-880f-2b9f-4247-3d1f0ec6399a</uuid>
  <memory>131072</memory>
  <currentMemory>131072</currentMemory>
  <vcpu>1</vcpu>
  <os>
    <type arch='x86_64' machine='xenpv'>linux</type>
    <kernel>/boot/vmlinuz-2.6.26-2-xen-amd64</kernel>
    <initrd>/boot/initrd.img-2.6.26-2-xen-amd64</initrd>
  </os>
  <clock offset='utc'/>
  <on_poweroff>destroy</on_poweroff>
  <on_reboot>restart</on_reboot>
  <on_crash>restart</on_crash>
  <devices>
    <disk type='file' device='disk'>
      <driver name='file'/>
      <source file='/opt/xen/domains/domU/swap.img'/>
      <target dev='xvda1' bus='xen'/>
    </disk>
    <disk type='file' device='disk'>
      <driver name='file'/>
      <source file='/opt/xen/domains/domU/disk.img'/>
      <target dev='xvda2' bus='xen'/>
    </disk>
    <interface type='bridge'>
      <mac address='00:16:3e:70:61:00'/>
      <source bridge='xenbr0'/>
    </interface>
    <console type='pty'>
      <target port='0'/>
    </console>
  </devices>
</domain>

However, this is still unusable since it is missing the "root" information from the XM file. I need to add the following for the VM to boot successfully:
<cmdline>root=/dev/xvda2 ro</cmdline>
Comment 1 Cole Robinson 2016-04-14 15:59:44 EDT
Sorry this never received a timely response, but I just tested your config and it appears fixed:

# sudo virsh domxml-from-native xen-xm f
<domain type='xen'>
  <name>domU</name>
  <uuid>ab6eec38-06ad-4fa6-aa50-4bb3dac321ef</uuid>
  <memory unit='KiB'>131072</memory>
  <currentMemory unit='KiB'>131072</currentMemory>
  <vcpu placement='static'>1</vcpu>
  <os>
    <type arch='x86_64' machine='xenpv'>linux</type>
    <kernel>/boot/vmlinuz-2.6.26-2-xen-amd64</kernel>
    <initrd>/boot/initrd.img-2.6.26-2-xen-amd64</initrd>
    <cmdline>root=/dev/xvda2 ro (null)</cmdline>
  </os>
  <clock offset='utc' adjustment='reset'/>
  <on_poweroff>destroy</on_poweroff>
  <on_reboot>restart</on_reboot>
  <on_crash>restart</on_crash>
  <devices>
    <disk type='file' device='disk'>
      <driver name='file'/>
      <source file='/opt/xen/domains/domU/swap.img'/>
      <target dev='xvda1' bus='xen'/>
    </disk>
    <disk type='file' device='disk'>
      <driver name='file'/>
      <source file='/opt/xen/domains/domU/disk.img'/>
      <target dev='xvda2' bus='xen'/>
    </disk>
    <interface type='bridge'>
      <mac address='00:16:3e:70:61:00'/>
      <source bridge='xenbr0'/>
    </interface>
    <console type='pty'>
      <target type='xen' port='0'/>
    </console>
  </devices>
</domain>
Comment 2 Pierre Riteau 2016-04-15 06:22:33 EDT
Thank you Cole! I am glad to learn it was eventually fixed.
Comment 3 Pierre Riteau 2016-04-15 06:23:54 EDT
Is the "(null)" in "<cmdline>root=/dev/xvda2 ro (null)</cmdline>" expected though?
Comment 4 Cole Robinson 2016-04-15 06:42:53 EDT
Hmm, I just noticed that. Doesn't seem expected. It may be fixed upstream as well, I was testing on Fedora 22 which has an older libvirt. I'll check it out and open a new bug if necessary
Comment 5 Cole Robinson 2016-04-15 08:42:04 EDT
Yup, still relevant with upstream. I opened a new bug:

https://bugzilla.redhat.com/show_bug.cgi?id=1327578

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