Skip to content

Commit 7cb7eaf

Browse files
authored
fix(linstor): explicitly notifies a missing res def (#157)
Prior to this change, a `KeyError` was raised that didn't indicate why a volume info was not found in the event of a missing resource definition. Signed-off-by: Ronan Abhamon <ronan.abhamon@vates.tech>
1 parent 6afa0f4 commit 7cb7eaf

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

drivers/linstorvolumemanager.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -960,7 +960,13 @@ def get_volume_info(self, volume_uuid):
960960
"""
961961

962962
volume_name = self.get_volume_name(volume_uuid)
963-
return self._get_volumes_info()[volume_name]
963+
try:
964+
return self._get_volumes_info()[volume_name]
965+
except KeyError:
966+
raise LinstorVolumeManagerError(
967+
f"Could not find info about volume `{volume_uuid}`, the resource definition has likely been deleted",
968+
LinstorVolumeManagerError.ERR_VOLUME_NOT_EXISTS
969+
)
964970

965971
def get_device_path(self, volume_uuid):
966972
"""

0 commit comments

Comments
 (0)