From 813c6aab135fb3e3a5f4e33d0ddab7b007807475 Mon Sep 17 00:00:00 2001 From: MacRimi Date: Tue, 28 Oct 2025 23:18:32 +0100 Subject: [PATCH] Update AppImage --- AppImage/components/virtual-machines.tsx | 15 +++++++++++---- AppImage/scripts/flask_server.py | 20 ++++++++++++++++++++ 2 files changed, 31 insertions(+), 4 deletions(-) diff --git a/AppImage/components/virtual-machines.tsx b/AppImage/components/virtual-machines.tsx index 1efa13d..14efe33 100644 --- a/AppImage/components/virtual-machines.tsx +++ b/AppImage/components/virtual-machines.tsx @@ -123,6 +123,7 @@ interface VMDetails extends VMData { gpu_passthrough?: string[] devices?: string[] } + lxc_ip?: string } const fetcher = async (url: string) => { @@ -157,7 +158,11 @@ const formatUptime = (seconds: number) => { return `${days}d ${hours}h ${minutes}m` } -const extractIPFromConfig = (config?: VMConfig): string => { +const extractIPFromConfig = (config?: VMConfig, lxcIP?: string): string => { + if (lxcIP) { + return lxcIP + } + if (!config) return "DHCP" // Check net0, net1, net2, etc. @@ -282,7 +287,9 @@ export function VirtualMachines() { const response = await fetch(`/api/vms/${lxc.vmid}`) if (response.ok) { const details = await response.json() - if (details.config) { + if (details.lxc_ip) { + configs[lxc.vmid] = details.lxc_ip + } else if (details.config) { configs[lxc.vmid] = extractIPFromConfig(details.config) } } @@ -1243,9 +1250,9 @@ export function VirtualMachines() {
IP Address
- {extractIPFromConfig(vmDetails.config)} + {extractIPFromConfig(vmDetails.config, vmDetails.lxc_ip)}
)} diff --git a/AppImage/scripts/flask_server.py b/AppImage/scripts/flask_server.py index 5493ee7..dead4a8 100644 --- a/AppImage/scripts/flask_server.py +++ b/AppImage/scripts/flask_server.py @@ -165,6 +165,26 @@ def parse_lxc_hardware_config(vmid, node): return hardware_info + +def get_lxc_ip_from_lxc_info(vmid): + """Get LXC IP address using lxc-info command (for DHCP containers)""" + try: + result = subprocess.run( + ['lxc-info', '-n', str(vmid), '-iH'], + capture_output=True, + text=True, + timeout=5 + ) + if result.returncode == 0: + ip = result.stdout.strip() + # Return IP only if it's valid (not empty) + if ip and ip != '': + return ip + return None + except Exception: + # Silently fail if lxc-info is not available or fails + return None + # Helper function to format bytes into human-readable string def format_bytes(size_in_bytes): """Converts bytes to a human-readable string (KB, MB, GB, TB)."""