2

I managed to have an osx guest running in qemu with the following commands:

// create the virtual image
$ qemu-img create -f qcow2 mac_hdd.img 35G
// .. install osx ...
// start the guest
$ qemu-system-x86_64 -enable-kvm -m 2048 -cpu core2duo   -machine q35  \
 -usb -device usb-kbd -device usb-mouse  \
 -device isa-applesmc,osk="XXXXXXXXredactedXXXXXXXX"  \
 -kernel ./chameleon_svn2360_boot -smbios type=2 \
 -device ide-drive,bus=ide.2,drive=MacHDD  -drive id=MacD,if=none,index=2,file=mac_hdd.img \
 -netdev user,id=hub0port0 -device e1000-82545em,netdev=hub0port0,id=mac_vnet0 \
 -monitor stdio

The guest runs fine; but I also want to able to control it from virt-manager, so I executed the conversion tool like in:

$ cat > mac_hdd.args <<EOF
// herestring of the arguments
EOF
$ virsh  domxml-from-native qemu-argv mac_hdd.args > osx10.8.3.xml
// as root
# virsh define osx10.8.3.xml

This generates the following configuration:

<domain type='kvm' xmlns:qemu='http://libvirt.org/schemas/domain/qemu/1.0'>
  <name>unnamed</name>
  <uuid>7872c6ca-8c58-4eee-801b-b070a2b06abb</uuid>
  <memory unit='KiB'>2097152</memory>
  <currentMemory unit='KiB'>2097152</currentMemory>
  <vcpu placement='static'>1</vcpu>
  <os>
    <type arch='x86_64' machine='q35'>hvm</type>
    <kernel>./chameleon_svn2360_boot</kernel>
  </os>
  <features>
    <acpi/>
  </features>
  <cpu mode='custom' match='exact'>
    <model fallback='allow'>core2duo</model>
  </cpu>
  <clock offset='utc'/>
  <on_poweroff>destroy</on_poweroff>
  <on_reboot>restart</on_reboot>
  <on_crash>destroy</on_crash>
  <devices>
    <emulator>qemu-system-x86_64</emulator>
    <disk type='file' device='disk'>
      <driver name='qemu' type='raw'/>
      <source file='./mac_hdd.img'/>
      <target dev='hdc' bus='ide'/>
      <address type='drive' controller='0' bus='1' target='0' unit='0'/>
    </disk>
    <controller type='usb' index='0'/>
    <controller type='ide' index='0'/>
    <controller type='sata' index='0'/>
    <controller type='pci' index='0' model='pcie-root'/>
    <controller type='pci' index='1' model='dmi-to-pci-bridge'/>
    <controller type='pci' index='2' model='pci-bridge'/>
    <input type='mouse' bus='ps2'/>
    <input type='keyboard' bus='ps2'/>
    <graphics type='sdl'/>
    <video>
      <model type='cirrus' vram='9216' heads='1'/>
    </video>
    <memballoon model='none'/>
  </devices>
  <qemu:commandline>
    <qemu:arg value='-device'/>
    <qemu:arg value='usb-kbd'/>
    <qemu:arg value='-device'/>
    <qemu:arg value='usb-mouse'/>
    <qemu:arg value='-device'/>
    <qemu:arg value='isa-applesmc,osk=&quot;XXXXXXredactedXXXXXXXquot;'/>
    <qemu:arg value='-smbios'/>
    <qemu:arg value='type=2'/>
    <qemu:arg value='-device'/>
    <qemu:arg value='ide-drive,bus=ide.2,drive=MacHDD'/>
    <qemu:arg value='-netdev'/>
    <qemu:arg value='user,id=hub0port0'/>
    <qemu:arg value='-device'/>
    <qemu:arg value='e1000-82545em,netdev=hub0port0,id=mac_vnet0'/>
  </qemu:commandline>
</domain>

Unfortunately this does not work (please don't mind the relative paths, I fixed that); as soon I start the vm, I get error cannot find drive MacHDD; I then tried to add an <alias>MacHDD</alias> to the <disk> definition, but still the same error is generated.

While if I remove the :

  <qemu:arg value='-device'/>
  <qemu:arg value='ide-drive,bus=ide.2,drive=MacHDD'/>

from the definition, then the vm starts, but fails to boot at the bios screen.

Is there a way to accomplish this? I am on Fedora 21 with libvirt-1.2.9.2

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.