From d90ffe5b14fabb2191ced436a511817a25ffff8f Mon Sep 17 00:00:00 2001 From: juvdiaz Date: Fri, 26 Jun 2026 23:19:01 -0600 Subject: [PATCH] Replace Pimox workers when storage changes --- lab.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lab.sh b/lab.sh index 0447a9f..b17a8e5 100755 --- a/lab.sh +++ b/lab.sh @@ -722,6 +722,11 @@ ensure_pimox_worker_node() { echo "VM ${vmid} exists as a template; refusing to reuse it as worker ${worker_name}." >&2 exit 1 fi + if ! truthy "${worker_replace_existing}" && + ! pimox_ssh "${pimox_host}" "${pimox_user}" "${pimox_key}" "sudo '${qm_bin}' config '${vmid}' | awk -F': ' -v storage='${worker_storage}' '/^(scsi|virtio|sata|ide)[0-9]+:/ { disks = 1; if (\$2 !~ \"^\" storage \":\") bad = 1 } END { exit (disks && !bad) ? 0 : 1 }'"; then + echo "Existing Pimox worker VM ${vmid} (${worker_name}) is not fully on storage ${worker_storage}; replacing it from template ${template_vmid}." + worker_replace_existing=true + fi if truthy "${worker_replace_existing}"; then echo "Replacing existing Pimox worker VM ${vmid} (${worker_name}) before cloning from template ${template_vmid}..." pimox_ssh "${pimox_host}" "${pimox_user}" "${pimox_key}" "set -eu