From ad54d69c9fec050ca2c276b9156cefd17e319eb9 Mon Sep 17 00:00:00 2001 From: Brooklyn Date: Tue, 9 Apr 2024 10:16:41 +0200 Subject: [PATCH] Added iSCSI multipath status to the API In this commit the multipath status is available in the following endpoint: /ovirt-engine/api/hosts/xxxx/storage A new field has been added that represents the multipaths that are NOT faulty as an integer value. This is useful for monitoring (you can compare 'available_paths' to 'paths' and trigger an alert when 'available_paths' is lower than 'paths'. Signed-off-by: Brooklyn Dewolf --- .../engine/core/common/businessentities/storage/LUNs.java | 4 ++++ .../engine/api/restapi/types/StorageLogicalUnitMapper.java | 1 + 2 files changed, 5 insertions(+) diff --git a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/storage/LUNs.java b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/storage/LUNs.java index 888dc478ec4..c8aef74dd71 100644 --- a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/storage/LUNs.java +++ b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/storage/LUNs.java @@ -269,6 +269,10 @@ public int getPathCount() { return getPathsDictionary() == null ? 0 : getPathsDictionary().size(); } + public int getAvailablePathCount() { + return getPathsDictionary() == null ? 0 : (int) getPathsDictionary().values().stream().filter(o -> o).count(); + } + public Map getPathsDictionary() { return pathsDictionary; } diff --git a/backend/manager/modules/restapi/types/src/main/java/org/ovirt/engine/api/restapi/types/StorageLogicalUnitMapper.java b/backend/manager/modules/restapi/types/src/main/java/org/ovirt/engine/api/restapi/types/StorageLogicalUnitMapper.java index 246dd9d36f6..dcddea9ef98 100644 --- a/backend/manager/modules/restapi/types/src/main/java/org/ovirt/engine/api/restapi/types/StorageLogicalUnitMapper.java +++ b/backend/manager/modules/restapi/types/src/main/java/org/ovirt/engine/api/restapi/types/StorageLogicalUnitMapper.java @@ -58,6 +58,7 @@ public static LogicalUnit map(LUNs entity, LogicalUnit template) { model.setTarget(lunConnection.getIqn()); } + model.setAvailablePaths(entity.getAvailablePathCount()); model.setPaths(entity.getPathCount()); return model; }