@@ -297,6 +297,7 @@ def add_compute_host_local(
297
297
is_connected : bool ,
298
298
is_synced : bool ,
299
299
admission_state : str ,
300
+ nodes_count : dict [str , int ],
300
301
nodes : list [str ] | None = None ,
301
302
) -> ComputeHost :
302
303
"""
@@ -310,6 +311,7 @@ def add_compute_host_local(
310
311
:param is_connected: A boolean indicating if the compute host is connected.
311
312
:param is_synced: A boolean indicating if the compute host is synced.
312
313
:param admission_state: The admission state of the compute host.
314
+ :param nodes_count: Count of deployed and running nodes and orphans.
313
315
:param nodes: A list of node IDs associated with the compute host.
314
316
:returns: The added compute host.
315
317
"""
@@ -323,6 +325,7 @@ def add_compute_host_local(
323
325
is_connected ,
324
326
is_synced ,
325
327
admission_state ,
328
+ nodes_count ,
326
329
nodes ,
327
330
)
328
331
self ._compute_hosts [compute_id ] = new_compute_host
@@ -380,6 +383,7 @@ def __init__(
380
383
is_connected : bool ,
381
384
is_synced : bool ,
382
385
admission_state : str ,
386
+ nodes_count : dict [str , int ],
383
387
nodes : list [str ] | None = None ,
384
388
):
385
389
"""
@@ -406,6 +410,7 @@ def __init__(
406
410
self ._is_connected = is_connected
407
411
self ._is_synced = is_synced
408
412
self ._admission_state = admission_state
413
+ self ._nodes_count = nodes_count
409
414
self ._nodes = nodes if nodes is not None else []
410
415
411
416
def __str__ (self ):
@@ -461,6 +466,12 @@ def is_synced(self) -> bool:
461
466
self ._system .sync_compute_hosts_if_outdated ()
462
467
return self ._is_synced
463
468
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
+
464
475
@property
465
476
def nodes (self ) -> list [str ]:
466
477
"""Return the list of nodes associated with the compute host."""
0 commit comments