mirror of
https://github.com/unraid/webgui.git
synced 2026-01-01 06:59:56 -06:00
39 lines
1.4 KiB
Bash
Executable File
39 lines
1.4 KiB
Bash
Executable File
#!/bin/bash
|
|
# Intialize libvirt config storage
|
|
# Invoked by emhttp after mounting libvirt loopback but before starting libvirt.
|
|
|
|
# run & log functions
|
|
. /etc/rc.d/rc.runlog
|
|
|
|
# missing qemu directory would indicate new libvirt image file created
|
|
if [ ! -d /etc/libvirt/qemu ]; then
|
|
log "initializing /etc/libvirt"
|
|
# initialize with default settings
|
|
cp -rp /etc/libvirt-/* /etc/libvirt
|
|
# check if libvirt image file exists on USB flash
|
|
OLD_IMAGE=/boot/config/plugins/dynamix.kvm.manager/domain.img
|
|
if [ ! -f $OLD_IMAGE ]; then
|
|
OLD_IMAGE=/boot/config/plugins/virtMan/virtMan.img
|
|
if [ ! -f $OLD_IMAGE ]; then
|
|
OLD_IMAGE=
|
|
fi
|
|
fi
|
|
if [ "$OLD_IMAGE" != "" ]; then
|
|
# found existing image, use qemu config from there
|
|
rm -rf /etc/libvirt/qemu/*
|
|
mount $OLD_IMAGE /etc/libvirt-
|
|
cp -rp /etc/libvirt-/qemu/* /etc/libvirt/qemu
|
|
if [ -f /etc/libvirt-/hooks/qemu ]; then
|
|
cp -p /etc/libvirt-/hooks/qemu /etc/libvirt/hooks/qemu
|
|
fi
|
|
umount /etc/libvirt-
|
|
fi
|
|
fi
|
|
|
|
# if vfio-pci bind error, prevent autostart
|
|
if [ -s /var/log/vfio-pci-errors ]; then
|
|
mkdir -p /run/libvirt/qemu
|
|
echo "vfio-pci bind error" > /run/libvirt/qemu/autostarted
|
|
/usr/local/emhttp/webGui/scripts/notify -e "VM Autostart disabled" -s "vfio-pci-errors " -d "VM Autostart disabled due to vfio-bind error" -m "Please review /var/log/vfio-pci-errors" -i "alert" -l "/VMs"
|
|
fi
|