Skip to content

Commit f70b49b

Browse files
committed
feat(linstorvolumemanager): raise when empty device path is detected (#104)
In `_request_device_path`: Before this change, an exception was thrown when a resource was missing, but not when the returned path was empty. Now it's raised in both cases. Signed-off-by: Ronan Abhamon <[email protected]>
1 parent 47a4d56 commit f70b49b

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

drivers/linstorvolumemanager.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2391,11 +2391,15 @@ def _request_device_path(self, volume_uuid, volume_name, activate=False):
23912391
)
23922392
return self._request_device_path(volume_uuid, volume_name)
23932393
raise LinstorVolumeManagerError(
2394-
'Empty dev path for `{}`, but definition "seems" to exist'
2394+
'Unable to get dev path for `{}`, no resource found but definition "seems" to exist'
23952395
.format(volume_uuid)
23962396
)
2397+
23972398
# Contains a path of the /dev/drbd<id> form.
2398-
return resource.volumes[0].device_path
2399+
device_path = resource.volumes[0].device_path
2400+
if not device_path:
2401+
raise LinstorVolumeManagerError('Empty dev path for `{}`!'.format(volume_uuid))
2402+
return device_path
23992403

24002404
def _destroy_resource(self, resource_name, force=False):
24012405
result = self._linstor.resource_dfn_delete(resource_name)

0 commit comments

Comments
 (0)