Skip to content

Commit bc71322

Browse files
fix: fallback to VHD_BLOCK_SIZE if error in fetch
Signed-off-by: Mathieu Labourier <[email protected]>
1 parent 85feea1 commit bc71322

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

libs/sm/vhdutil.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,11 @@ def ioretry(cmd, text=True):
9595

9696
def getBlockSize(path):
9797
cmd = [VHD_UTIL, "read", "-pn", path]
98-
ret = ioretry(cmd)
98+
try:
99+
ret = ioretry(cmd)
100+
except util.CommandException as e:
101+
util.SMlog("WARN: unable to fetch block size: {}".format(e))
102+
return VHD_BLOCK_SIZE
99103
if isinstance(ret, bytes):
100104
import locale
101105
ret = ret.decode(

0 commit comments

Comments
 (0)