[PATCH 30/37] Display sizes for backstores that support it

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Use bytes_to_human to print their size in the summary, for
storageobjects that support a size attribute.

Signed-off-by: Andy Grover <agrover@xxxxxxxxxx>
---
 targetcli/ui_backstore.py |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/targetcli/ui_backstore.py b/targetcli/ui_backstore.py
index b8f6963..fc10cfc 100644
--- a/targetcli/ui_backstore.py
+++ b/targetcli/ui_backstore.py
@@ -23,7 +23,8 @@ from rtslib import FileIOBackstore, BlockBackstore
 from rtslib import PSCSIBackstore, RDMCPBackstore
 from rtslib import FileIOStorageObject, BlockStorageObject
 from rtslib import PSCSIStorageObject, RDMCPStorageObject
-from rtslib.utils import get_block_type, is_disk_partition, human_to_bytes
+from rtslib.utils import (get_block_type, is_disk_partition,
+                          human_to_bytes, bytes_to_human)
 from configshell import ExecutionError
 import os
 
@@ -381,11 +382,13 @@ class UIStorageObject(UIRTSLibNode):
         if legacy:
             errors.append("LEGACY: " + ", ".join(legacy))
 
+        size = bytes_to_human(getattr(so, "size", 0))
+
         if errors:
             msg = ", ".join(errors)
             if path:
                 msg += " (%s %s)" % (path, so.status)
             return (msg, False)
         else:
-            return ("%s %s" % (path, so.status), True)
+            return ("%s %s%s" % (path, size, so.status), True)
 
-- 
1.7.1

--
To unsubscribe from this list: send the line "unsubscribe target-devel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux SCSI]     [Kernel Newbies]     [Linux SCSI Target Infrastructure]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Device Mapper]

  Powered by Linux