Proxmox: stop early when the node's cluster has no quorum

Without quorum /etc/pve is read-only, so pct create and pvesm set fail with
cfs lock errors. lxc mode now checks pvecm status first and explains the
fixes (pvecm expected 1 for now, or separating the node from the cluster).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
neil 2026-11-04 18:44:41 -08:00
parent 310f78c7df
commit a96ae4e825
4 changed files with 40 additions and 0 deletions

View file

@ -124,3 +124,18 @@ export -f pct pvesh pveam pvesm id
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
def test_proxmox_without_quorum_stops_early(tmp_path):
stubs = f'''
pct() {{ echo "pct $*" >> {tmp_path}/calls; true; }}
pvecm() {{ printf "Votequorum information\\nExpected votes: 3\\nQuorate: No\\n"; }}
pvesm() {{ echo "pvesm $*" >> {tmp_path}/calls; true; }}
id() {{ if [ "$1" = -u ]; then echo 0; else command id "$@"; fi; }}
export -f pct pvecm 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 and "without quorum" in r.stderr and "pvecm expected 1" in r.stderr
assert not (tmp_path / "calls").exists() # stopped before touching pct or storage