Skip to content

Commit

Permalink
getDiskDeviceSize: don't silently return None (part of xenserver#66)
Browse files Browse the repository at this point in the history
Signed-off-by: Yann Dirson <[email protected]>
  • Loading branch information
ydirson committed Jun 12, 2024
1 parent 3ca3be0 commit a6a3a8f
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions diskutil.py
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,9 @@ def getDiskDeviceSize(dev):
return int(__readOneLineFile__("/sys/block/%s/device/block/size" % dev))
elif os.path.exists("/sys/block/%s/size" % dev):
return int(__readOneLineFile__("/sys/block/%s/size" % dev))
else:
raise Exception("{0} not found as /sys/block/{0}/device/block/size or /sys/block/{0}/size"
.format(dev))

def getDiskSerialNumber(dev):
# For Multipath nodes return info about 1st slave
Expand Down

0 comments on commit a6a3a8f

Please sign in to comment.