Update AppImage

This commit is contained in:
MacRimi
2025-10-06 19:08:21 +02:00
parent 5807c4d97f
commit 7a0c2dc261
2 changed files with 46 additions and 54 deletions

View File

@@ -1696,13 +1696,36 @@ def get_gpu_info():
'type': 'Discrete' if vendor in ['NVIDIA', 'AMD'] else 'Integrated'
}
try:
# Get detailed PCI info for this slot
pci_result = subprocess.run(['lspci', '-vmm', '-s', slot], capture_output=True, text=True, timeout=2)
if pci_result.returncode == 0:
for pci_line in pci_result.stdout.split('\n'):
if ':' in pci_line:
key, value = pci_line.split(':', 1)
key = key.strip()
value = value.strip()
if key == 'Class':
gpu['pci_class'] = value
# Get driver and kernel module info
driver_result = subprocess.run(['lspci', '-k', '-s', slot], capture_output=True, text=True, timeout=2)
if driver_result.returncode == 0:
for driver_line in driver_result.stdout.split('\n'):
if 'Kernel driver in use:' in driver_line:
gpu['pci_driver'] = driver_line.split(':', 1)[1].strip()
elif 'Kernel modules:' in driver_line:
gpu['pci_kernel_module'] = driver_line.split(':', 1)[1].strip()
except Exception as e:
print(f"[v0] Error getting PCI info for GPU {slot}: {e}")
detailed_info = get_detailed_gpu_info(gpu)
gpu.update(detailed_info)
gpus.append(gpu)
print(f"[v0] Found GPU: {gpu_name} ({vendor}) at slot {slot}")
except Exception as e:
print(f"[v0] Error detecting GPUs from lspci: {e}")
except Exception as e:
print(f"[v0] Error detecting GPUs from lspci: {e}")
try:
result = subprocess.run(['sensors'], capture_output=True, text=True, timeout=5)
@@ -1738,8 +1761,8 @@ def get_gpu_info():
('i915' in current_adapter.lower() and gpu['vendor'] == 'Intel')):
# Parse temperature (only if not already set by nvidia-smi)
if 'temperature' not in gpu or gpu['temperature'] is None:
if '°C' in value_part or 'C' in value_part:
if '°C' in value_part or 'C' in value_part:
if 'temperature' not in gpu or gpu['temperature'] is None:
temp_match = re.search(r'([+-]?[\d.]+)\s*°?C', value_part)
if temp_match:
gpu['temperature'] = float(temp_match.group(1))
@@ -2459,8 +2482,7 @@ def api_info():
'/api/vms',
'/api/logs',
'/api/health',
'/api/hardware',
'/api/gpu/<slot>'
'/api/hardware'
]
})
@@ -2495,48 +2517,6 @@ def api_hardware():
return jsonify(formatted_data)
@app.route('/api/gpu/<slot>', methods=['GET'])
def api_gpu_detail(slot):
"""Get detailed real-time GPU information for a specific GPU"""
try:
# Find the GPU by slot
hardware_info = get_hardware_info()
gpus = hardware_info.get('gpus', [])
gpu = None
for g in gpus:
if g.get('slot') == slot:
gpu = g
break
if not gpu:
return jsonify({'error': 'GPU not found'}), 404
# Get PCI device information for this GPU
pci_devices = hardware_info.get('pci_devices', [])
pci_info = None
for device in pci_devices:
if device.get('slot') == slot:
pci_info = device
break
# Enrich GPU with PCI information
if pci_info:
gpu['pci_class'] = pci_info.get('class')
gpu['pci_driver'] = pci_info.get('driver')
gpu['pci_kernel_module'] = pci_info.get('kernel_module')
# Get fresh detailed information
detailed_info = get_detailed_gpu_info(gpu)
gpu.update(detailed_info)
print(f"[v0] /api/gpu/{slot} returning detailed GPU info")
return jsonify(gpu)
except Exception as e:
print(f"[v0] Error getting GPU details: {e}")
return jsonify({'error': str(e)}), 500
@app.route('/api/vms/<int:vmid>', methods=['GET'])
def api_vm_details(vmid):
"""Get detailed information for a specific VM/LXC"""