Add more logging to VM service script
This commit is contained in:
parent
2b0a804b4e
commit
4d2ac57dab
|
@ -26,19 +26,23 @@ in
|
|||
exit 0
|
||||
fi
|
||||
|
||||
echo "Creating network XML"
|
||||
NET_TMP_FILE="/tmp/network.xml"
|
||||
|
||||
NETUUID="$(${pkgs.libvirt}/bin/virsh net-uuid 'default' || true)"
|
||||
(sed "s/UUID/$NETUUID/" '${networkXML}') > "$NET_TMP_FILE"
|
||||
|
||||
echo "Defining and starting network"
|
||||
${pkgs.libvirt}/bin/virsh net-define "$NET_TMP_FILE"
|
||||
${pkgs.libvirt}/bin/virsh net-start 'default' || true
|
||||
|
||||
VARS_FILE=${varsFile}
|
||||
if [ ! -f "$VARS_FILE" ]; then
|
||||
echo "Copying vars filej"
|
||||
cp /run/libvirt/nix-ovmf/OVMF_VARS.fd "$VARS_FILE"
|
||||
fi
|
||||
|
||||
echo "Replacing USB device IDs in the XML"
|
||||
# Load the template contents into a tmp file
|
||||
TMP_FILE="/tmp/${vm.name}.xml"
|
||||
cat "${machineXML}" > "$TMP_FILE"
|
||||
|
@ -63,10 +67,12 @@ in
|
|||
# TODO: Set correct pci address for the GPU too
|
||||
|
||||
# Setup looking glass shm file
|
||||
echo "Setting up looking glass shm file"
|
||||
${pkgs.coreutils-full}/bin/truncate -s 0 /dev/shm/looking-glass
|
||||
${pkgs.coreutils-full}/bin/dd if=/dev/zero of=/dev/shm/looking-glass bs=1M count=32
|
||||
|
||||
# Load and start the xml definition
|
||||
echo "Loading and starting the VM XML definition"
|
||||
${pkgs.libvirt}/bin/virsh define "$TMP_FILE"
|
||||
${pkgs.libvirt}/bin/virsh start '${vm.name}'
|
||||
'';
|
||||
|
|
Loading…
Reference in a new issue