foxlet / macOS-Simple-KVM

Tools to set up a quick macOS VM in QEMU, accelerated by KVM.
13.55k stars 1.14k forks source link

does virsh managedsave/restore work? #621

Closed mailinglists35 closed 8 months ago

mailinglists35 commented 8 months ago

I removed cpu flag invtsc to allow virsh saving (opencore allows booting without +invtsc), however on restoring it doesn't work. anyone managed to get save and restore? the other more recent project seem to not have allowed discussions nor issues

$ sudo virsh managedsave-dumpxml macos-mojave-10.14 | xpath -e //qemu:commandline
Found 1 nodes in stdin:
-- NODE --
<qemu:commandline>
    <qemu:arg value="-device" />
    <qemu:arg value="isa-applesmc,osk=[...]" />
    <qemu:arg value="-smbios" />
    <qemu:arg value="type=2" />
    <qemu:arg value="-cpu" />
    <qemu:arg value="Penryn,vendor=GenuineIntel,kvm=on,vmware-cpuid-freq=on,+sse3,+sse4.2,+aes,+xsave,+avx,+xsaveopt,+xsavec,+xgetbv1,+avx2,+bmi2,+smep,+bmi1,+fma,+movbe,+pcid,+popcnt,+smep,+popcnt,check" />
  </qemu:commandline>

$ sudo virsh managedsave-dumpxml macos-mojave-10.14 | xpath -e //cpu
Found 1 nodes in stdin:
-- NODE --
<cpu mode="custom" match="exact" check="partial">
    <model fallback="forbid">Penryn</model>
    <topology sockets="1" dies="1" cores="2" threads="1" />
    <feature policy="require" name="ibpb" />
    <feature policy="require" name="md-clear" />
    <feature policy="require" name="spec-ctrl" />
    <feature policy="require" name="ssbd" />
  </cpu>

  $ sudo virsh restore --paused /var/lib/libvirt/qemu/save/macos-mojave-10.14.save
error: Failed to restore domain from /var/lib/libvirt/qemu/save/macos-mojave-10.14.save
error: operation failed: guest CPU doesn't match specification: missing features: fma,movbe,bmi1,avx2,bmi2,xsavec,xgetbv1
mailinglists35 commented 8 months ago

ah it is simple, managedsave-edit and remove the offending flags. seems they are not supported by host cpu