Skip to content

Commit 036de0f

Browse files
committed
fix(ui): surface accurate memory and uplink metadata
1 parent 0f33a80 commit 036de0f

5 files changed

Lines changed: 45 additions & 6 deletions

File tree

host-agent/api/handlers.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -349,6 +349,12 @@ def v1_vm_details_by_name(self, vm_name: str) -> Dict[str, Any]:
349349
network_info: Dict[str, Any] = {"interfaces": network_interfaces}
350350
if saved_network_cfg:
351351
network_info["saved_config"] = saved_network_cfg
352+
if "uplink" in saved_network_cfg and saved_network_cfg["uplink"]:
353+
network_info["uplink"] = saved_network_cfg["uplink"]
354+
if "uplink" not in network_info or not network_info.get("uplink"):
355+
default_uplink = self.agent_defaults.get("net", {}).get("uplink")
356+
if default_uplink:
357+
network_info["uplink"] = default_uplink
352358

353359
vm_config = {
354360
"cpus": machine_cfg.get("vcpu_count"),

host-agent/config/manager.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,8 @@ def build_network_config_from_spec(self, spec: Spec) -> Dict[str, Any]:
226226
"vm_name": spec.vm.name,
227227
"driver": spec.net.driver,
228228
"bridge": spec.net.bridge,
229+
"host_bridge": getattr(spec.net, "host_bridge", ""),
230+
"uplink": getattr(spec.net, "uplink", ""),
229231
"nics": [],
230232
}
231233
for nic in spec.vm.nics:

host-agent/debian/changelog

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@ firecracker-cloudstack-agent (0.3.1-2) unstable; urgency=medium
33
* Fix VM provisioning to honor `maxRam` from CloudStack payloads when
44
generating Firecracker configs.
55
* Update documentation with a full agent configuration reference table.
6+
* Report memory size from discovered VM configs so the UI shows the
7+
provisioned MiB/GiB correctly.
8+
* Persist and expose network uplink information for each VM, and improve
9+
interface rendering in the dashboard.
610

711
-- Marco Sinhoreli <msinhore@gmail.com> Thu, 16 Oct 2025 17:58:12 +0000
812

host-agent/orchestration/lifecycle.py

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
This module handles VM recovery, discovery, and startup operations.
66
"""
77
import logging
8+
import json
89
from pathlib import Path
910
from typing import Any, Dict, List, Optional
1011

@@ -152,7 +153,22 @@ def discover_existing_vms(self) -> List[Dict[str, Any]]:
152153
try:
153154
# Get VM status
154155
status = self._get_vm_status_by_name(vm_name)
155-
vm_info = {"name": vm_name, "status": status, "config_file": str(config_file)}
156+
memory_mib = None
157+
try:
158+
with config_file.open("r", encoding="utf-8") as cfg_fp:
159+
config_data = json.load(cfg_fp)
160+
machine_cfg = config_data.get("machine-config")
161+
if isinstance(machine_cfg, dict):
162+
memory_mib = machine_cfg.get("mem_size_mib")
163+
except Exception:
164+
memory_mib = None
165+
vm_info = {
166+
"name": vm_name,
167+
"status": status,
168+
"config_file": str(config_file),
169+
}
170+
if memory_mib:
171+
vm_info["memory_mib"] = memory_mib
156172
discovered_vms.append(vm_info)
157173
except Exception as e:
158174
logger.warning("Failed to get status for VM %s: %s", vm_name, e)

host-agent/ui/src/components/VmDetails.vue

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -78,10 +78,10 @@
7878
<td>Interfaces</td>
7979
<td>
8080
<div v-if="networkInterfaces.length === 0">No interfaces discovered</div>
81-
<div v-for="iface in networkInterfaces" :key="iface.iface_id" style="margin-bottom: 6px">
82-
<strong>{{ iface.iface_id || "eth" }}</strong>
83-
· MAC {{ iface.guest_mac || "-" }}
84-
<span v-if="iface.host_dev_name">· tap {{ iface.host_dev_name }}</span>
81+
<div v-for="iface in networkInterfaces" :key="iface.iface_id" class="iface-block">
82+
<div><strong>{{ iface.iface_id || "eth" }}</strong></div>
83+
<div>MAC {{ iface.guest_mac || "-" }}</div>
84+
<div v-if="iface.host_dev_name">tap {{ iface.host_dev_name }}</div>
8585
</div>
8686
</td>
8787
</tr>
@@ -91,7 +91,7 @@
9191
</tr>
9292
<tr>
9393
<td>Uplink</td>
94-
<td>{{ details.payload?.uplink || details.network?.saved_config?.uplink || "-" }}</td>
94+
<td>{{ details.network?.uplink || details.payload?.uplink || details.network?.saved_config?.uplink || "-" }}</td>
9595
</tr>
9696
</tbody>
9797
</table>
@@ -215,3 +215,14 @@ const originImageLabel = computed(() => {
215215
return `${sanitizedBase}/${imageToken}`;
216216
});
217217
</script>
218+
219+
<style scoped>
220+
.iface-block {
221+
margin-bottom: 8px;
222+
line-height: 1.4;
223+
}
224+
225+
.iface-block:last-child {
226+
margin-bottom: 0;
227+
}
228+
</style>

0 commit comments

Comments
 (0)