fix: use libvirt session URI consistently, remove QEMU fallback
- All virsh commands now use qemu:///session explicitly - Removed direct QEMU fallback (libvirt only) - Added VM XML template in vm/template.xml with variable substitution - Template generates UUID and MAC address dynamically - VM is now properly defined AND started in libvirt - Fixed vm_destroy, vm_console, vm_status, vm_is_running, vm_capture_screen - Added UUID fallback using /proc/sys/kernel/random/uuid Fixes issue where VMs were created but not visible/running in virt-manager. 💘 Generated with Crush Assisted-by: GLM-5 via Crush <crush@charm.land>
This commit is contained in:
55
vm/template.xml
Normal file
55
vm/template.xml
Normal file
@@ -0,0 +1,55 @@
|
||||
<domain type='kvm'>
|
||||
<name>@VM_NAME@</name>
|
||||
<uuid>@VM_UUID@</uuid>
|
||||
<memory unit='MiB'>@VM_RAM@</memory>
|
||||
<currentMemory unit='MiB'>@VM_RAM@</currentMemory>
|
||||
<vcpu placement='static'>@VM_CPUS@</vcpu>
|
||||
<os>
|
||||
<type arch='x86_64' machine='q35'>hvm</type>
|
||||
<loader readonly='yes' secure='@SECURE_BOOT@' type='pflash'>@UEFI_CODE@</loader>
|
||||
<nvram>@UEFI_VARS@</nvram>
|
||||
<boot dev='cdrom'/>
|
||||
<boot dev='hd'/>
|
||||
</os>
|
||||
<features>
|
||||
<acpi/>
|
||||
<apic/>
|
||||
<smm state='on'/>
|
||||
</features>
|
||||
<cpu mode='host-passthrough' check='none'/>
|
||||
<clock offset='utc'>
|
||||
<timer name='rtc' tickpolicy='catchup'/>
|
||||
<timer name='pit' tickpolicy='delay'/>
|
||||
<timer name='hpet' present='no'/>
|
||||
</clock>
|
||||
<on_poweroff>destroy</on_poweroff>
|
||||
<on_reboot>restart</on_reboot>
|
||||
<on_crash>destroy</on_crash>
|
||||
<devices>
|
||||
<emulator>/usr/bin/qemu-system-x86_64</emulator>
|
||||
<disk type='file' device='disk'>
|
||||
<driver name='qemu' type='qcow2'/>
|
||||
<source file='@VM_DISK@'/>
|
||||
<target dev='vda' bus='virtio'/>
|
||||
</disk>
|
||||
<disk type='file' device='cdrom'>
|
||||
<driver name='qemu' type='raw'/>
|
||||
<source file='@ISO_PATH@'/>
|
||||
<target dev='sda' bus='sata'/>
|
||||
<readonly/>
|
||||
</disk>
|
||||
<interface type='user'>
|
||||
<mac address='@MAC_ADDRESS@'/>
|
||||
<model type='virtio'/>
|
||||
</interface>
|
||||
<graphics type='vnc' port='-1' autoport='yes'>
|
||||
<listen type='address' address='127.0.0.1'/>
|
||||
</graphics>
|
||||
<video>
|
||||
<model type='virtio' heads='1' primary='yes'/>
|
||||
</video>
|
||||
<console type='pty'>
|
||||
<target type='serial' port='0'/>
|
||||
</console>
|
||||
</devices>
|
||||
</domain>
|
||||
Reference in New Issue
Block a user