Skip to content

Commit

Permalink
Add more ouptut to pool detail view
Browse files Browse the repository at this point in the history
At this point all the properties of the pool are used. No information
about devices is included as that can be obtained by the device listing.

Signed-off-by: mulhern <[email protected]>
  • Loading branch information
mulkieran committed Jun 1, 2022
1 parent 8aa97e9 commit d3534ec
Showing 1 changed file with 28 additions and 8 deletions.
36 changes: 28 additions & 8 deletions src/stratis_cli/_actions/_pool.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
from ._connection import get_object
from ._constants import TOP_OBJECT
from ._formatting import (
TABLE_FAILURE_STRING,
TOTAL_USED_FREE,
get_property,
print_table,
Expand Down Expand Up @@ -505,41 +506,60 @@ def alert_string(mopool):

else:
this_uuid = pool_uuid.hex
pool_props = MOPool(
mopool = MOPool(
next(
pools(props={"Uuid": this_uuid})
.require_unique_match(True)
.search(managed_objects)
)[1]
)

encrypted = pool_props.Encrypted()
encrypted = mopool.Encrypted()

print("UUID: %s" % format_uuid(this_uuid))
print("Name: %s" % pool_props.Name())
print("Cache: %s" % ("yes" if pool_props.HasCache() else "No"))
print("Filesystem Limit: %s" % pool_props.FsLimit())
print("Name: %s" % mopool.Name())
print(
"Actions Allowed: %s"
% PoolActionAvailability.from_str(mopool.AvailableActions())
)
print("Cache: %s" % ("Yes" if mopool.HasCache() else "No"))
print("Filesystem Limit: %s" % mopool.FsLimit())
print(
"Allows Overprovisioning: %s"
% ("Yes" if pool_props.Overprovisioning() else "No")
% ("Yes" if mopool.Overprovisioning() else "No")
)
print(
"Key Description: %s"
% (
_interp_inconsistent_option(pool_props.KeyDescription())
_interp_inconsistent_option(mopool.KeyDescription())
if encrypted
else "unencrypted"
)
)
print(
"Clevis Configuration: %s"
% (
_interp_inconsistent_option(pool_props.ClevisInfo())
_interp_inconsistent_option(mopool.ClevisInfo())
if encrypted
else "unencrypted"
)
)

total_physical_used = get_property(mopool.TotalPhysicalUsed(), Range, None)

print("Space Usage:")
print("Fully Allocated: %s" % ("Yes" if mopool.NoAllocSpace() else "No"))
print(" Size: %s" % Range(mopool.TotalPhysicalSize()))
print(" Allocated: %s" % Range(mopool.AllocatedSize()))
print(
" Used: %s"
% (
TABLE_FAILURE_STRING
if total_physical_used is None
else total_physical_used
)
)

@staticmethod
def _list_stopped_pools(namespace, *, pool_uuid=None):
"""
Expand Down

0 comments on commit d3534ec

Please sign in to comment.