Skip to content

Commit

Permalink
Add stub function to stratis for pool report subcommand
Browse files Browse the repository at this point in the history
Signed-off-by: mulhern <[email protected]>
  • Loading branch information
mulkieran committed Aug 3, 2023
1 parent 2e6645a commit 13540a4
Show file tree
Hide file tree
Showing 2 changed files with 64 additions and 0 deletions.
34 changes: 34 additions & 0 deletions src/stratis_cli/_actions/_pool.py
Original file line number Diff line number Diff line change
Expand Up @@ -710,3 +710,37 @@ def explain_code(namespace):
Print an explanation of pool error code.
"""
print(PoolErrorCode.explain(namespace.code))

@staticmethod
def report_pool(namespace):
"""
Report information about a pool.
"""
# pylint: disable=import-outside-toplevel
from ._data import MODev, ObjectManager, devs, pools

proxy = get_object(TOP_OBJECT)
managed_objects = ObjectManager.Methods.GetManagedObjects(proxy, {})

(selection_key, selection_value) = (
("Uuid", namespace.uuid.hex)
if namespace.uuid is not None
else ("Name", namespace.name)
)

(pool_object_path, _) = next(
pools(props={selection_key: selection_value})
.require_unique_match(True)
.search(managed_objects)
)

modevs = (
MODev(info)
for objpath, info in devs(props={"Pool": pool_object_path}).search(
managed_objects
)
)

# replace the lines below with the correct call to lsblk
for modev in modevs:
print(modev.Devnode())
30 changes: 30 additions & 0 deletions src/stratis_cli/_parser/_pool.py
Original file line number Diff line number Diff line change
Expand Up @@ -442,4 +442,34 @@ def _ensure_nat(arg):
"subcmds": POOL_DEBUG_SUBCMDS,
},
),
(
"report",
{
"help": "Report information about pools",
"description": "Generate report for pools",
"mut_ex_args": [
(
True,
[
(
"--uuid",
{
"action": "store",
"type": UUID,
"help": "UUID of pool",
},
),
(
"--name",
{
"action": "store",
"help": "name of pool",
},
),
],
),
],
"func": PoolActions.report_pool,
},
),
]

0 comments on commit 13540a4

Please sign in to comment.