cosmin.danisor
cosmin.danisor

Reputation: 963

Qemu Native to Libvirt XML

I have created a macos virtual machine using qemu cli everything seems to work great so far. My challenge is to convert it to an libvirt xml now.

I'm trying using this command: virsh domxml-from-native qemu-argv but I get the following error with no other info error: this function is not supported by the connection driver: virConnectDomainXMLFromNative

This is my cli command, I'm using Fedora 31

qemu-system-x86_64 -enable-kvm -m 16G \
  -cpu Penryn,kvm=on,vendor=GenuineIntel,+invtsc,vmware-cpuid-freq=on,+aes,+xsave,+avx,+xsaveopt,avx2,+smep \
  -boot order=c \
  -machine pc-q35-2.9 \
  -smp 16,sockets=1,cores=8,threads=2 \
  -usb -device usb-kbd -device usb-tablet \
  -device isa-applesmc,osk="ourhardworkbythesewordsguardedpleasedontsteal(c)AppleComputerInc" \
  -drive if=pflash,format=raw,readonly,file=OVMF_CODE.fd \
  -drive if=pflash,format=raw,file=OVMF_VARS-3440x1440.fd \
  -smbios type=2 \
  -device ich9-intel-hda -device hda-duplex \
  -device ide-drive,bus=ide.0,drive=Clover \
  -drive id=Clover,if=none,snapshot=on,format=qcow2,file=./'HighSierra/Clover.qcow2' \
  -device ide-drive,bus=ide.1,drive=MacHDD \
  -drive id=MacHDD,if=none,file=/dev/disk/by-id/ata-SanDisk_SDSSDA120G_163757447010,format=raw \
  -nic user,model=e1000-82545em \
  -device vfio-pci,host=08:00.0,multifunction=on \
  -device vfio-pci,host=08:00.1 \
  -rtc clock=host,base=localtime \
  -vga none \
  -nographic \
  -serial none \
  -parallel none \
  -usb \
  -device usb-host,hostbus=5,hostport=4 \
  -device usb-host,hostbus=5,hostport=4.1 \
  -device usb-host,hostbus=5,hostport=4.2 \
  -device usb-host,hostbus=5,hostport=4.3 \
  -device usb-host,hostbus=5,hostport=4.4 

I have no clue where to start, the documentation for this function is almost nonexistent

Upvotes: 1

Views: 5983

Answers (1)

DanielB
DanielB

Reputation: 2816

Unfortunately support for the domxml-from-native command has been removed from recentish libvirt, because we found that in practice it was too unreliable and incomplete to be useful.

Your best bet for importing a pre-existing disk image to libvirt is to use the "virt-install" command with its "--import" flag. You can use the various other args to define the disks, NICs, etc.

The only thing I think you'll have trouble with is the "isa-applesmc" device as I don't think libvirt supports that. For that you will need to edit the XML virt-intsall has created, and then add a passthrough option as illustrated here https://libvirt.org/drvqemu.html#qemucommand

Upvotes: 3

Related Questions