Skip to content

Commit 7463ced

Browse files
Tim SmithTimSmithCtx
Tim Smith
authored andcommitted
Convert CommandException to XenError("Command") in get_scsi_id()
The get_scsi_id() utility function is called by consumers of the now-obsoleted sm-core-libs. Those callers are expecting a XenError rather than a CommandException should there be an issue, so perform the conversion here. Signed-off-by: Tim Smith <[email protected]>
1 parent 061f5a0 commit 7463ced

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

libs/sm/core/util.py

+6-2
Original file line numberDiff line numberDiff line change
@@ -1627,9 +1627,13 @@ def get_isl_scsiids(session):
16271627
def get_scsi_id(path):
16281628
"""
16291629
Compatibility wrapper for sm-core-libs which had its own copy
1630-
of scsiutil.getSCSIid()
1630+
of scsiutil.getSCSIid(). Converts any CommandException raised
1631+
to a XenError as consumers of sm-core-libs are expecting.
16311632
"""
1632-
return scsiutil.getSCSIid(path)
1633+
try:
1634+
return scsiutil.getSCSIid(path)
1635+
except CommandException as e:
1636+
raise f_exceptions.XenError("Command", e.reason)
16331637

16341638

16351639
class extractXVA:

0 commit comments

Comments
 (0)