[libvirt-users] Building XML from working qemu command-line for ARM virtio

Clark Laughlin
Thu, 17 Oct 2013 20:02:29 -0000

Hello,

I've got a working QEMU command line that I am trying to get into a libvirt
dom xml and using domxml-from-native doesn't seem to know how to handle all
of it.

It's for ARM using some new virtio syntax:

qemu-system-arm -machine virt -cpu cortex-a15 -enable-kvm -m 512 -kernel
mach-virt-guest-3.11-zImage -display none -serial stdio -netdev
type=user,id=mynet -device virtio-net-device,netdev=mynet -drive
index=0,id=mydrive,file=saucy-server-cloudimg-armhf.img -device
virtio-blk-device,drive=mydrive -initrd saucy-server-cloudimg-armhf-initrd-lpae
-append "console=ttyAMA0 root=/dev/vda"

Does anyone have any suggestions for converting the rest of it, specifically the
-netdev, -drive, and -device params?

Here is what domxml-from-native gives:

<domain type='kvm'
xmlns:qemu='http://libvirt.org/schemas/domain/qemu/1.0'>
  <name>unnamed</name>
  <uuid>fab06af7-aa37-45ca-ac4b-85d9bec89e52</uuid>
  <memory unit='KiB'>524288</memory>
  <currentMemory unit='KiB'>524288</currentMemory>
  <vcpu placement='static'>1</vcpu>
  <os>
    <type machine='virt'>hvm</type>
    <kernel>mach-virt-guest-3.11-zImage</kernel>
    <initrd>saucy-server-cloudimg-armhf-initrd-lpae</initrd>
    <cmdline>console=ttyAMA0 root=/dev/vda</cmdline>
  </os>
  <cpu mode='custom' match='exact'>
    <model fallback='allow'>cortex-a15</model>
  </cpu>
  <clock offset='utc'/>
  <on_poweroff>destroy</on_poweroff>
  <on_reboot>restart</on_reboot>
  <on_crash>destroy</on_crash>
  <devices>

<emulator>/home/linaro/ubuntu-cloud-image/qemu-system-arm</emulator>
    <disk type='file' device='disk'>
      <driver name='qemu' type='raw'/>

      <target dev='hda' bus='ide'/>
      <address type='drive' controller='0' bus='0'
target='0' unit='0'/>
    </disk>
    <controller type='ide' index='0'/>
    <controller type='usb' index='0'/>
    <serial type='stdio'>
      <target port='0'/>
    </serial>
    <console type='stdio'>
      <target type='serial' port='0'/>
    </console>

    <graphics type='sdl'/>

      <model type='cirrus' vram='9216' heads='1'/>

    <memballoon model='virtio'/>
  </devices>
  <qemu:commandline>
    <qemu:arg value='-display'/>
    <qemu:arg value='none'/>
    <qemu:arg value='-netdev'/>
    <qemu:arg value='type=user,id=mynet'/>
    <qemu:arg value='-device'/>
    <qemu:arg value='virtio-net-device,netdev=mynet'/>
    <qemu:arg value='-device'/>
    <qemu:arg value='virtio-blk-device,drive=mydrive'/>
  </qemu:commandline>
</domain>


Thank you,
Clark L