Skip to content

Commit 8a61788

Browse files
authored
fix(linstorvolumemanager): prevent ops on version mismatch (#112)
Add a way in `linstorvolumemanager` to verify that all nodes are using the same LINSTOR version at init. Raise an error early if this happens so that SR ops are properly disabled with clear feedback to the user. Signed-off-by: Antoine Bartuccio <[email protected]>
1 parent 1cec251 commit 8a61788

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

drivers/linstorvolumemanager.py

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -392,7 +392,7 @@ def __init__(
392392
"""
393393
Create a new LinstorVolumeManager object.
394394
:param str uri: URI to communicate with the LINSTOR controller.
395-
:param str group_name: The SR goup name to use.
395+
:param str group_name: The SR group name to use.
396396
:param bool repair: If true we try to remove bad volumes due to a crash
397397
or unexpected behavior.
398398
:param function logger: Function to log messages.
@@ -402,6 +402,18 @@ def __init__(
402402
self._linstor = self._create_linstor_instance(
403403
uri, attempt_count=attempt_count
404404
)
405+
406+
407+
mismatched_nodes = [
408+
node for node in self._linstor.node_list().pop().nodes if node.connection_status == "VERSION_MISMATCH"
409+
]
410+
411+
if mismatched_nodes:
412+
raise LinstorVolumeManagerError(
413+
"Some linstor nodes are not using the same version. " +
414+
f"Incriminated nodes are: {','.join([node.name for node in mismatched_nodes])}"
415+
)
416+
405417
self._base_group_name = group_name
406418

407419
# Ensure group exists.
@@ -420,7 +432,7 @@ def __init__(
420432
self._volumes = set()
421433
self._storage_pools_time = 0
422434

423-
# To increate performance and limit request count to LINSTOR services,
435+
# To increase performance and limit request count to LINSTOR services,
424436
# we use caches.
425437
self._kv_cache = self._create_kv_cache()
426438
self._resource_cache = None

0 commit comments

Comments
 (0)