From 4d2ac57dab7c8324d82b8fda2f563b7acbdbceae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20B=C3=A4dorf?= Date: Sat, 23 Jul 2022 17:00:43 +0200 Subject: [PATCH] Add more logging to VM service script --- hosts/chocolatebar/virtualisation/create-service.nix | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/hosts/chocolatebar/virtualisation/create-service.nix b/hosts/chocolatebar/virtualisation/create-service.nix index 04fd0d5..2f174e9 100644 --- a/hosts/chocolatebar/virtualisation/create-service.nix +++ b/hosts/chocolatebar/virtualisation/create-service.nix @@ -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}' '';