fix IP addresses: parse from config/agent endpoints instead of guest agent

- LXCs: use /interfaces endpoint first, fallback to net0-net7 config parsing
- QEMU: use /agent/network-get-interfaces with correct result nesting
- IPv4 only filtering (ip-address-type check)
- Drop ip6= and nameserver from config fallback

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
2026-05-21 11:36:05 +01:00
parent 15d0ea37f0
commit 8f317641ec
4 changed files with 115 additions and 20 deletions

View File

@@ -1,5 +1,5 @@
import { NextResponse } from 'next/server';
import { getNodes, getVMs, getGuestIPs } from '@/lib/proxmox';
import { getNodes, getVMs, getConfigIPs } from '@/lib/proxmox';
const PROXMOX_WEB_URL = process.env.PROXMOX_WEB_URL || process.env.PROXMOX_API_URL?.replace('/api2/json', '');
@@ -16,7 +16,7 @@ export async function GET(_req) {
let ips = [];
if (vm.status === 'running') {
try {
ips = await getGuestIPs(node.name, vm.vmid, 'qemu');
ips = await getConfigIPs(node.name, vm.vmid, 'qemu');
} catch { /* guest agent not available */ }
}
allVMs.push({