spdkcli: print bdev size if it's 0 bytes
Print "0 bytes" in case reported number of blocks is for some reason "0" instead of returning awkward empty string. Signed-off-by: Karol Latecki <karol.latecki@intel.com> Change-Id: Ifd8bb0a7b389ebee8af324bfa21afbe5595632a5 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/15906 Reviewed-by: Jim Harris <james.r.harris@intel.com> Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com> Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
This commit is contained in:
parent
d0e6ba0a3c
commit
3a3802438d
@ -9,6 +9,8 @@ import json
|
|||||||
|
|
||||||
|
|
||||||
def convert_bytes_to_human(size):
|
def convert_bytes_to_human(size):
|
||||||
|
if size == 0:
|
||||||
|
return "%3.1f%s" % (size, "bytes")
|
||||||
if not size:
|
if not size:
|
||||||
return ""
|
return ""
|
||||||
for x in ["bytes", "K", "M", "G", "T"]:
|
for x in ["bytes", "K", "M", "G", "T"]:
|
||||||
|
Loading…
Reference in New Issue
Block a user