Score:0

Converting QEMU Solaris VM to libvirt

bi flag

I have a QEMU VM running Solaris 2.6 on a SPARCstation-5 machine. I currently start it with the following command:

qemu-system-sparc \
-name sunvm \
-machine SS-5 \
-m 256 \
-drive file=sunvm.img,bus=0,unit=0,media=disk \
-nic bridge,model=lance,mac=52:54:00:ab:cd:ef,helper=/usr/lib/qemu/qemu-bridge-helper,br=br0 \
-vnc :1

This works fine and I can connect to the VM through the network and with VNC.

I'd like to manage this VM using libvirt/virsh, which means I need to come up with libvirt XML that represents the same machine.

I tried using virt-install to create the XML and came up with the following:

virt-install \
--name sunvm \
--osinfo generic \
--ram 256 \
--arch sparc \
--machine SS-5 \
--vcpus 1 \
--import \
--disk path=sunvm.img,format=qcow2,bus=scsi \
--network bridge=br0,model=lance,mac=52:54:00:ab:cd:ef \
--noautoconsole \
--graphics vnc,port=5901 \
--print-xml --dry-run

This generates the following XML:

<domain type="qemu">
  <name>sunvm</name>
  <uuid>8b9dc638-5b67-4eec-9fe9-65443777fc10</uuid>
  <memory>262144</memory>
  <currentMemory>262144</currentMemory>
  <vcpu>1</vcpu>
  <os>
    <type arch="sparc" machine="SS-5">hvm</type>
    <boot dev="hd"/>
  </os>
  <clock offset="utc"/>
  <devices>
    <emulator>/usr/bin/qemu-system-sparc</emulator>
    <disk type="file" device="disk">
      <driver name="qemu" type="qcow2"/>
      <source file="/home/user/sunvm.img"/>
      <target dev="sda" bus="scsi"/>
    </disk>
    <interface type="bridge">
      <source bridge="br0"/>
      <mac address="52:54:00:ab:cd:ef"/>
      <model type="lance"/>
    </interface>
    <console type="pty"/>
    <graphics type="vnc" port="5901"/>
    <video>
      <model type="vga"/>
    </video>
  </devices>
</domain>

When I try to create this machine with virsh, I get the message:

error: XML error: No PCI buses available

I tried adding the following line to the XML:

<controller type="pci" index="0" model="pci-root"/>

I then got the message:

error: unsupported configuration: domain configuration does not support video model 'vga'

I tried different video models like qxl, cirrus, vmvga, xen, vbox, and qxl, but they gave the same error.

I tried removing both the video and graphics XML elements and then adding:

<qemu:commandline xmlns:qemu="http://libvirt.org/schemas/domain/qemu/1.0">
  <qemu:arg value="-vnc"/>
  <qemu:arg value=":1"/>
</qemu:commandline>

I then got the message:

error: internal error: process exited while connecting to monitor: qemu-system-sparc: -device lance,netdev=hostnet0,id=net0,mac=52:54:00:ab:cd:ef,bus=pci,addr=0x1: Parameter 'driver' expects pluggable device type

I couldn't figure out what that meant, so I tried removing the "interface" XML element and adding these direct qemu arguments:

<qemu:arg value="-nic"/>
<qemu:arg value="bridge,model=lance,mac=52:54:00:ab:cd:ef,helper=/usr/lib/qemu/qemu-bridge-helper,br=br0"/>

I then got the message:

error: internal error: process exited while connecting to monitor: qemu-system-sparc: bridge helper failed

I don't understand why the bridge helper would fail when it works fine running qemu directly. I have setuid enabled on /usr/lib/qemu/qemu-bridge-helper and /etc/qemu/bridge.conf contains allow br0.

In any case, I tried temporarily changing the nic argument to "user" instead of "bridge", just to see if it would get any farther. This allowed me to start the VM, but when I connect over VNC it says "This VM has no graphic display device."

At this point I got stuck and I don't know what else to try.

Is there any way to get this VM working in libvirt with both functional bridged networking and a VNC-accessible display?

I'm using Debian 11 (bullseye) with libvirt 7.0.0 and QEMU 5.2.

I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.