Update zero metadata API and tests

Signed-off-by: Slawomir Jankowski <slawomir.jankowski@intel.com>
This commit is contained in:
Slawomir Jankowski
2021-02-25 14:39:37 +01:00
parent c2c1d9eb4c
commit 7a9405a58e
4 changed files with 21 additions and 3 deletions

View File

@@ -153,9 +153,9 @@ def print_version(output_format: OutputFormat = None, shortcut: bool = False):
return output
def zero_metadata(cache_dev: Device, shortcut: bool = False):
def zero_metadata(cache_dev: Device, force: bool = False, shortcut: bool = False):
output = TestRun.executor.run(
zero_metadata_cmd(cache_dev=cache_dev.path, shortcut=shortcut))
zero_metadata_cmd(cache_dev=cache_dev.path, force=force, shortcut=shortcut))
if output.exit_code != 0:
raise CmdException("Failed to wipe metadata.", output)
return output

View File

@@ -115,9 +115,11 @@ def print_statistics_cmd(cache_id: str, core_id: str = None, per_io_class: bool
return casadm_bin + command
def zero_metadata_cmd(cache_dev: str, shortcut: bool):
def zero_metadata_cmd(cache_dev: str, force: bool = False, shortcut: bool = False):
command = " --zero-metadata"
command += (" -d " if shortcut else " --device ") + cache_dev
if force:
command += (" -f" if shortcut else " --force")
return casadm_bin + command

View File

@@ -254,6 +254,7 @@ zero_metadata_help = [
r"Clear metadata from caching device",
r"Options that are valid with --zero-metadata are:",
r"-d --device \<DEVICE\> Path to device on which metadata would be cleared"
r"-f --force Ignore potential dirty data on cache device"
]
unrecognized_stderr = [