Proxmox: explain why no container storage qualifies; pick storage before the template

On a cluster node whose container storages are all disabled for that node,
the installer said only "no active storage". It now lists the storages that
allow containers with their status on this node, explains "disabled", and
gives the two fixes. Storage is checked before any template download, so a
failed run leaves nothing behind. Also drops --enabled from the pvesm query
so disabled storages show in that listing.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
neil 2026-11-04 18:38:38 -08:00
parent 1dad1ad85d
commit fbe1a1be43
3 changed files with 65 additions and 18 deletions

View file

@ -107,3 +107,20 @@ export -f pct pvesh pveam pvesm sleep id
log.write_text("")
r = run()
assert r.returncode == 0 and "reusing container 105" in r.stdout and "pct create" not in log.read_text()
def test_proxmox_no_container_storage_explains_why(tmp_path):
stubs = f'''
pct() {{ case $1 in list) printf 'VMID Status Lock Name\\n' ;; esac; true; }}
pvesh() {{ echo 105; }}
pveam() {{ echo "pveam $*" >> {tmp_path}/calls; true; }}
pvesm() {{ printf "Name Type Status Total\\nlocal-lvm lvmthin disabled 0\\ngmktec-nvme lvmthin disabled 0\\n"; }}
id() {{ if [ "$1" = -u ]; then echo 0; else command id "$@"; fi; }}
export -f pct pvesh pveam pvesm id
'''
(tmp_path / "pve").mkdir()
env = {**os.environ, "NETMON_PVE_DIR": str(tmp_path / "pve"), "INSTALL_DIR": str(tmp_path / "opt")}
r = subprocess.run(["bash", "-c", stubs + "bash install.sh"], cwd=ROOT, capture_output=True, text=True, env=env, timeout=60)
assert r.returncode != 0
assert "gmktec-nvme" in r.stderr and "disabled" in r.stderr and "LXC_STORAGE" in r.stderr
assert not (tmp_path / "calls").exists() # nothing downloaded before giving up