fix: use full path /usr/sbin/pvesm, add debug logging, remove local-lvm fallback
This commit is contained in:
parent
ae53d2fbd8
commit
d4726acd65
1 changed files with 8 additions and 8 deletions
|
|
@ -100,7 +100,10 @@ def storage_pools():
|
||||||
result = []
|
result = []
|
||||||
try:
|
try:
|
||||||
import subprocess
|
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:]:
|
for line in out.stdout.split("\n")[1:]:
|
||||||
parts = line.split()
|
parts = line.split()
|
||||||
if len(parts) < 3:
|
if len(parts) < 3:
|
||||||
|
|
@ -110,10 +113,9 @@ def storage_pools():
|
||||||
continue
|
continue
|
||||||
if stype not in ("lvmthin", "zfspool", "rbd", "dir", "nfs"):
|
if stype not in ("lvmthin", "zfspool", "rbd", "dir", "nfs"):
|
||||||
continue
|
continue
|
||||||
# Verify content includes images
|
|
||||||
content = ""
|
content = ""
|
||||||
try:
|
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"):
|
for cl in cp.stdout.split("\n"):
|
||||||
if cl.strip().startswith("content"):
|
if cl.strip().startswith("content"):
|
||||||
content = cl.strip().split(None, 1)[1] if len(cl.strip().split(None, 1)) > 1 else ""
|
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:
|
if "images" not in content:
|
||||||
continue
|
continue
|
||||||
result.append({"name": name, "type": stype})
|
result.append({"name": name, "type": stype})
|
||||||
except Exception:
|
except Exception as exc:
|
||||||
pass
|
logger.warning("Storage pool discovery failed: %s", exc)
|
||||||
|
|
||||||
if not result:
|
|
||||||
result.append({"name": "local-lvm", "type": "lvmthin"})
|
|
||||||
|
|
||||||
|
logger.info("Storage pools found: %s", [p["name"] for p in result])
|
||||||
return {"pools": result}
|
return {"pools": result}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue