Skip to content

Commit c1b7e3c

Browse files
SIMPLE-7433 nodes_count added to compute
1 parent c3f4f20 commit c1b7e3c

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

virl2_client/models/system.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -297,6 +297,7 @@ def add_compute_host_local(
297297
is_connected: bool,
298298
is_synced: bool,
299299
admission_state: str,
300+
nodes_count: dict[str, int],
300301
nodes: list[str] | None = None,
301302
) -> ComputeHost:
302303
"""
@@ -310,6 +311,7 @@ def add_compute_host_local(
310311
:param is_connected: A boolean indicating if the compute host is connected.
311312
:param is_synced: A boolean indicating if the compute host is synced.
312313
:param admission_state: The admission state of the compute host.
314+
:param nodes_count: Count of deployed and running nodes and orphans.
313315
:param nodes: A list of node IDs associated with the compute host.
314316
:returns: The added compute host.
315317
"""
@@ -323,6 +325,7 @@ def add_compute_host_local(
323325
is_connected,
324326
is_synced,
325327
admission_state,
328+
nodes_count,
326329
nodes,
327330
)
328331
self._compute_hosts[compute_id] = new_compute_host
@@ -380,6 +383,7 @@ def __init__(
380383
is_connected: bool,
381384
is_synced: bool,
382385
admission_state: str,
386+
nodes_count: dict[str, int],
383387
nodes: list[str] | None = None,
384388
):
385389
"""
@@ -406,6 +410,7 @@ def __init__(
406410
self._is_connected = is_connected
407411
self._is_synced = is_synced
408412
self._admission_state = admission_state
413+
self._nodes_count = nodes_count
409414
self._nodes = nodes if nodes is not None else []
410415

411416
def __str__(self):
@@ -461,6 +466,12 @@ def is_synced(self) -> bool:
461466
self._system.sync_compute_hosts_if_outdated()
462467
return self._is_synced
463468

469+
@property
470+
def nodes_count(self) -> dict[str, int]:
471+
"""Return the count of deployed and running nodes and orphans."""
472+
self._system.sync_compute_hosts_if_outdated()
473+
return self._nodes_count
474+
464475
@property
465476
def nodes(self) -> list[str]:
466477
"""Return the list of nodes associated with the compute host."""

0 commit comments

Comments
 (0)