fix: use full path /usr/sbin/pvesm, add debug logging, remove local-lvm fallback

This commit is contained in:
Claus Lohmar 2026-07-27 09:18:08 +00:00
parent ae53d2fbd8
commit d4726acd65

View file

@ -100,7 +100,10 @@ def storage_pools():
result = []
try:
import subprocess
out = subprocess.run(["pvesm", "status"], capture_output=True, text=True, timeout=10)
out = subprocess.run(["/usr/sbin/pvesm", "status"], capture_output=True, text=True, timeout=10)
logger.info("pvesm status returned %d lines, rc=%d", len(out.stdout.split("\n")), out.returncode)
if out.stderr:
logger.warning("pvesm stderr: %s", out.stderr.strip()[:200])
for line in out.stdout.split("\n")[1:]:
parts = line.split()
if len(parts) < 3:
@ -110,10 +113,9 @@ def storage_pools():
continue
if stype not in ("lvmthin", "zfspool", "rbd", "dir", "nfs"):
continue
# Verify content includes images
content = ""
try:
cp = subprocess.run(["pvesm", "config", name], capture_output=True, text=True, timeout=5)
cp = subprocess.run(["/usr/sbin/pvesm", "config", name], capture_output=True, text=True, timeout=5)
for cl in cp.stdout.split("\n"):
if cl.strip().startswith("content"):
content = cl.strip().split(None, 1)[1] if len(cl.strip().split(None, 1)) > 1 else ""
@ -122,12 +124,10 @@ def storage_pools():
if "images" not in content:
continue
result.append({"name": name, "type": stype})
except Exception:
pass
if not result:
result.append({"name": "local-lvm", "type": "lvmthin"})
except Exception as exc:
logger.warning("Storage pool discovery failed: %s", exc)
logger.info("Storage pools found: %s", [p["name"] for p in result])
return {"pools": result}