diff --git a/src/stratis_cli/_actions/_pool.py b/src/stratis_cli/_actions/_pool.py index 6a22c3a0d..f94d1b95a 100644 --- a/src/stratis_cli/_actions/_pool.py +++ b/src/stratis_cli/_actions/_pool.py @@ -204,10 +204,10 @@ def create_pool(namespace): # pylint: disable=too-many-locals if namespace.journal_size is None else (True, namespace.journal_size.magnitude.numerator) ), - "tag_size": ( + "tag_spec": ( (False, 0) - if namespace.tag_size is None - else (True, namespace.tag_size.magnitude.numerator) + if namespace.tag_spec is None + else (True, namespace.tag_spec) ), }, ) diff --git a/src/stratis_cli/_constants.py b/src/stratis_cli/_constants.py index b8f80e0a8..4a95813c5 100644 --- a/src/stratis_cli/_constants.py +++ b/src/stratis_cli/_constants.py @@ -116,3 +116,16 @@ class Clevis(Enum): def __str__(self): return self.value + + +class IntegrityTagSpec(Enum): + """ + Options for specifying integrity tag size. + """ + + B0 = "0b" + B32 = "32b" + B512 = "512b" + + def __str__(self): + return self.value diff --git a/src/stratis_cli/_parser/_pool.py b/src/stratis_cli/_parser/_pool.py index ee959a798..e78f41c9d 100644 --- a/src/stratis_cli/_parser/_pool.py +++ b/src/stratis_cli/_parser/_pool.py @@ -21,11 +21,17 @@ from uuid import UUID from .._actions import BindActions, PoolActions -from .._constants import Clevis, EncryptionMethod, UnlockMethod, YesOrNo +from .._constants import ( + Clevis, + EncryptionMethod, + IntegrityTagSpec, + UnlockMethod, + YesOrNo, +) from .._error_codes import PoolErrorCode from ._bind import BIND_SUBCMDS, REBIND_SUBCMDS from ._debug import POOL_DEBUG_SUBCMDS -from ._range import RejectAction, parse_bytes_range, parse_range +from ._range import RejectAction, parse_range class ClevisEncryptionOptions: # pylint: disable=too-few-public-methods @@ -186,15 +192,18 @@ def _ensure_nat(arg): }, ), ( - "--tag-size", + "--tag-spec", { "help": ( - "Size of tag to use to verify " - "correctness of 4KiB block, e.g, 64B. " - "Must be a power of 2 and less than " - "128B." + "Integrity tag specification defining " + "the size of the tag used to store a " + "checksum or other value for each " + "block on a device. stratisd chooses " + "a default specification if none is " + "given." ), - "type": parse_bytes_range, + "choices": list(IntegrityTagSpec), + "type": IntegrityTagSpec, }, ), ], diff --git a/src/stratis_cli/_parser/_range.py b/src/stratis_cli/_parser/_range.py index d11d27703..7d70c9ec3 100644 --- a/src/stratis_cli/_parser/_range.py +++ b/src/stratis_cli/_parser/_range.py @@ -86,13 +86,6 @@ def parse_range(values, *, bound=None): return result -def parse_bytes_range(values): - """ - Parse a range that must be less than 256B. - """ - return parse_range(values, bound=Range(256)) - - class RejectAction(argparse.Action): """ Just reject any use of the option.