From bcb72dc9b85f2530e9db565b3a26fd8323be8aec Mon Sep 17 00:00:00 2001 From: "CanbiZ (MickLesk)" <47820557+MickLesk@users.noreply.github.com> Date: Sat, 31 Oct 2026 22:13:45 +0100 Subject: [PATCH] Ubuntu VM: check for a snippets storage before building a static-IP VM (#18347) Ubuntu 26.04 needs the MAC-matched network snippet, and without a storage for snippets the run failed only after the VM was created. It now stops before downloading the image. --- vm/ubuntu-vm.sh | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/vm/ubuntu-vm.sh b/vm/ubuntu-vm.sh index 8cc01e1e9..20408905d 100644 --- a/vm/ubuntu-vm.sh +++ b/vm/ubuntu-vm.sh @@ -130,6 +130,12 @@ vm_prompt_cloud_init "ubuntu" if [ "$USE_CLOUD_INIT" != "yes" ]; then msg_warn "Without Cloud-Init this Ubuntu image gets no network configuration or credentials; configure them in the guest yourself." fi +if [[ "$USE_CLOUD_INIT" == "yes" && "${CLOUDINIT_NETWORK_MODE:-dhcp}" == "static" && -z "${CLOUDINIT_SNIPPET_STORAGE:-}" ]] && + ! pvesm status -content snippets 2>/dev/null | awk 'NR > 1 && $3 == "active" {found = 1} END {exit !found}'; then + msg_error "A static IP needs a storage with 'snippets' content, and none is active" + msg_warn "Enable Snippets under Datacenter > Storage on a directory storage, or choose DHCP" + exit 1 +fi post_to_api_vm vm_select_storage "$HN" vm_define_disk_references 2