From 29ba6893099273b4e9b6fa84498b77614a10bc1f Mon Sep 17 00:00:00 2001 From: tteckster Date: Mon, 11 Jul 2022 13:52:05 -0400 Subject: [PATCH] Update haos_vm.sh attempt zfspool|btrfs --- vm/haos_vm.sh | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/vm/haos_vm.sh b/vm/haos_vm.sh index a5621c76..9d6271b9 100644 --- a/vm/haos_vm.sh +++ b/vm/haos_vm.sh @@ -2,7 +2,7 @@ GEN_MAC=$(echo '00 60 2f'$(od -An -N3 -t xC /dev/urandom) | sed -e 's/ /:/g' | tr '[:lower:]' '[:upper:]') NEXTID=$(pvesh get /cluster/nextid) RELEASE=$(curl -sX GET "https://api.github.com/repos/home-assistant/operating-system/releases" | awk '/tag_name/{print $4;exit}' FS='[""]') -STABLE="7.6" +STABLE="8.3" YW=`echo "\033[33m"` BL=`echo "\033[36m"` RD=`echo "\033[01;31m"` @@ -306,10 +306,19 @@ msg_info "Extracting KVM Disk Image" unxz $FILE STORAGE_TYPE=$(pvesm status -storage $STORAGE | awk 'NR>1 {print $2}') case $STORAGE_TYPE in - btrfs|nfs|dir) - DISK_EXT=".qcow2" - DISK_REF="$VMID/" - DIR_IMPORT="-format qcow2" + nfs|dir) + DISK_EXT=".qcow2" + DISK_REF="$VMID/" + DISK_IMPORT="-format qcow2" + ;; + + zfspool|btrfs) + DISK_EXT=".qcow2" + DISK_REF="$VMID/" + DISK_FORMAT="subvol" + DISK_IMPORT="-format subvol" + ;; + esac for i in {0,1}; do disk="DISK$i" @@ -321,8 +330,8 @@ msg_ok "Extracted KVM Disk Image" msg_info "Creating HAOS VM" qm create $VMID -agent 1 -bios ovmf -cores $CORE_COUNT -memory $RAM_SIZE -name $VM_NAME -net0 virtio,bridge=$BRG,macaddr=$MAC$VLAN \ -onboot 1 -ostype l26 -scsihw virtio-scsi-pci -pvesm alloc $STORAGE $VMID $DISK0 4M 1>&/dev/null -qm importdisk $VMID ${FILE%.*} $STORAGE ${DIR_IMPORT:-} 1>&/dev/null +pvesm alloc $STORAGE $VMID $DISK0 4M 1>&/dev/null #--format ${DISK_FORMAT:-qcow2} +qm importdisk $VMID ${FILE%.*} $STORAGE ${DISK_IMPORT:-} 1>&/dev/null qm set $VMID \ -efidisk0 ${DISK0_REF},efitype=4m,size=4M \ -scsi0 ${DISK1_REF},size=32G >/dev/null