Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow user to expand pool if block device is expanded #906

Merged
merged 4 commits into from
Oct 13, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 13 additions & 3 deletions docs/stratis.txt
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,12 @@ pool init-cache <pool_name> <blockdev> [<blockdev>..]::
drives, such as SSDs, are used for this purpose.
pool add-cache <pool_name> <blockdev> [<blockdev>..]::
Add one or more blockdevs to an existing pool with an initialized cache.
pool extend-data <pool_name> [--device-uuid <uuid>]::
Increase the pool's data capacity with additional storage space offered by
its component data devices through, e.g., expansion of a component RAID
device. Devices may be specified by their Stratis UUID. If no devices are
specified, then stratisd will attempt to make use of all data devices
belonging to the pool that appear to have been expanded.
pool bind <(nbde|tang)> <pool name> <url> <(--thumbprint <thp> | --trust-url)>::
Bind the devices in the specified pool to a supplementary encryption
mechanism that uses NBDE (Network-Bound Disc Encryption). *tang* is
Expand Down Expand Up @@ -90,8 +96,8 @@ pool overprovision <pool name> <(yes|no)> ::
available.
pool explain <code> ::
Explain any code that might show up in the Alerts column when
listing a pool. Codes may be prefixed with a "W", for "warning", or an "E",
for "error".
listing a pool. Codes may be prefixed with an "I" for "info", a "W" for
"warning", or an "E" for "error".
pool debug get-object-path <(--uuid <uuid> |--name <name>)> ::
Look up the D-Bus object path for a pool given the UUID or name.
filesystem create <pool_name> <fs_name> [<fs_name>..] [--size <size>]::
Expand Down Expand Up @@ -243,7 +249,11 @@ Physical Size::
The total size of the device on which stratisd places Stratis
metadata. If the device is encrypted, this size will be slightly
smaller than the total size of the device specified by the user; it
will be the size of the associated dm-crypt device.
will be the size of the associated dm-crypt device. A second size will
be displayed in parentheses if stratisd has observed that the device
has a size that is different from the size that stratisd is making use
of. This can happen if, e.g., a RAID device was previously added to a
pool and has since been expanded.
Tier::
The data tier type ("Data" or "Cache")

Expand Down
7 changes: 7 additions & 0 deletions src/stratis_cli/_actions/_introspect.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@
<property name="InitializationTime" type="t" access="read">
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="const" />
</property>
<property name="NewPhysicalSize" type="(bs)" access="read" />
<property name="PhysicalPath" type="s" access="read">
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="const" />
</property>
Expand Down Expand Up @@ -179,6 +180,12 @@
<arg name="return_code" type="q" direction="out" />
<arg name="return_string" type="s" direction="out" />
</method>
<method name="GrowPhysicalDevice">
<arg name="dev" type="s" direction="in" />
<arg name="results" type="b" direction="out" />
<arg name="return_code" type="q" direction="out" />
<arg name="return_string" type="s" direction="out" />
</method>
<method name="InitCache">
<arg name="devices" type="as" direction="in" />
<arg name="results" type="(bao)" direction="out" />
Expand Down
17 changes: 15 additions & 2 deletions src/stratis_cli/_actions/_physical.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
from .._stratisd_constants import BLOCK_DEV_TIER_TO_NAME
from ._connection import get_object
from ._constants import TOP_OBJECT
from ._formatting import print_table
from ._formatting import get_property, print_table


class PhysicalActions:
Expand Down Expand Up @@ -90,11 +90,24 @@ def paths(modev):
else f"{physical_path} ({metadata_path})"
)

def size(modev):
"""
Return in-use size (observed size) if they are different, otherwise
just in-use size.
"""
in_use_size = Range(modev.TotalPhysicalSize())
observed_size = get_property(modev.NewPhysicalSize(), Range, in_use_size)
return (
f"{str(in_use_size)}"
if in_use_size == observed_size
else f"{str(in_use_size)} ({str(observed_size)})"
)

tables = [
[
path_to_name[modev.Pool()],
paths(modev),
str(Range(modev.TotalPhysicalSize())),
size(modev),
BLOCK_DEV_TIER_TO_NAME(modev.Tier(), True),
]
for modev in modevs
Expand Down
Loading