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 Oct 4, 2023
1 parent 3ca3be0 commit 67cac56
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:
assert 0, "%s not found as %s or %s" % (dev, "/sys/block/%s/device/block/size",
"/sys/block/%s/size")

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

0 comments on commit 67cac56

Please sign in to comment.