Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions e2e/stress_test/continuous_parallel_lvol_snapshot_clone.py
Original file line number Diff line number Diff line change
Expand Up @@ -238,12 +238,10 @@ def _force_enqueue_deletes(self):
self.logger.warning(f"[max_lvols] Forced enqueue of {added} lvol tree deletes to recover from cluster max-lvol limit")

def _api(self, op: str, ctx: dict, fn, retries: int = 10, interval: int = 5):
last_exc = None
for attempt in range(1, retries + 1):
try:
return fn()
except Exception as e:
last_exc = e
api_err = self._extract_api_error(e)
if self._is_max_lvols_error(api_err):
self._inc("failures", op if op in self._metrics["failures"] else "unknown", 1)
Expand Down
12 changes: 10 additions & 2 deletions simplyblock_core/models/storage_node.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# coding=utf-8
import time
from typing import List
from datetime import datetime, timedelta, timezone
from typing import List, Optional
from uuid import uuid4

from simplyblock_core import utils
Expand Down Expand Up @@ -482,6 +483,13 @@ def lvol_del_sync_lock_reset(self) -> bool:
time.sleep(0.250)
return True

def uptime(self) -> Optional[timedelta]:
return (
datetime.now(timezone.utc) - datetime.fromisoformat(self.online_since)
if self.online_since and self.status == StorageNode.STATUS_ONLINE
else None
)


class NodeLVolDelLock(BaseModel):
pass
pass
9 changes: 1 addition & 8 deletions simplyblock_core/storage_node_ops.py
Original file line number Diff line number Diff line change
Expand Up @@ -2433,19 +2433,12 @@ def list_storage_nodes(is_json, cluster_id=None):
nodes = db_controller.get_storage_nodes()
data = []
output = ""
now = datetime.datetime.now(datetime.timezone.utc)

for node in nodes:
logger.debug(node)
logger.debug("*" * 20)
total_devices = len(node.nvme_devices)
online_devices = 0
uptime = ""
if node.online_since and node.status == StorageNode.STATUS_ONLINE:
try:
uptime = utils.strfdelta((now - datetime.datetime.fromisoformat(node.online_since)))
except Exception:
pass

for dev in node.nvme_devices:
if dev.status == NVMeDevice.STATUS_ONLINE:
Expand All @@ -2459,7 +2452,7 @@ def list_storage_nodes(is_json, cluster_id=None):
"LVols": f"{len(lvs)}",
"Status": node.status,
"Health": node.health_check,
"Up time": uptime,
"Up time": utils.strfdelta(uptime) if (uptime := node.uptime()) is not None else "",
"CPU": f"{len(utils.hexa_to_cpu_list(node.spdk_cpu_mask))}",
"MEM": utils.humanbytes(node.spdk_mem),
"SPDK P": node.rpc_port,
Expand Down
4 changes: 2 additions & 2 deletions simplyblock_web/api/v2/device.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def list(cluster: Cluster, storage_node: StorageNode) -> List[DeviceDTO]:
ret = db.get_device_stats(device, 1)
if ret:
stat_obj = ret[0]
data.append(DeviceDTO.from_model(device, stat_obj))
data.append(DeviceDTO.from_model(device, storage_node.get_id(), stat_obj))
return data

instance_api = APIRouter(prefix='/{device_id}')
Expand All @@ -46,7 +46,7 @@ def get(cluster: Cluster, storage_node: StorageNode, device: Device) -> DeviceDT
ret = db.get_device_stats(device, 1)
if ret:
stat_obj = ret[0]
return DeviceDTO.from_model(device, stat_obj)
return DeviceDTO.from_model(device, storage_node.get_id(), stat_obj)


@instance_api.post('/remove', name='clusters:storage_nodes:devices:remove', status_code=204, responses={204: {"content": None}})
Expand Down
Loading
Loading