cas api: add casadm commands for standby cache

Signed-off-by: Piotr Debski <piotr.debski@intel.com>
Signed-off-by: Karolina Rogowska <karolina.rogowska@intel.com>
This commit is contained in:
Karolina Rogowska
2021-10-25 12:28:32 +02:00
committed by Piotr Debski
parent 6f26d2eade
commit d706619187
2 changed files with 79 additions and 0 deletions

View File

@@ -108,6 +108,36 @@ def start_cmd(cache_dev: str, cache_mode: str = None, cache_line_size: str = Non
return casadm_bin + command
def standby_init_cmd(cache_dev: str, cache_id: str, cache_line_size: str,
force: bool = False, shortcut: bool = False):
command = " --standby --init"
command += (" -d " if shortcut else " --cache-device ") + cache_dev
command += (" -i " if shortcut else " --cache-id ") + cache_id
command += (" -x " if shortcut else " --cache-line-size ") + cache_line_size
if force:
command += " -f" if shortcut else " --force"
return casadm_bin + command
def standby_load_cmd(cache_dev: str, shortcut: bool = False):
command = " --standby --load"
command += (" -d " if shortcut else " --cache-device ") + cache_dev
return casadm_bin + command
def standby_detach_cmd(cache_id: str, shortcut: bool = False):
command = " --standby --detach"
command += (" -i " if shortcut else " --cache-id ") + cache_id
return casadm_bin + command
def standby_activate_cmd(cache_dev: str, cache_id: str, shortcut: bool = False):
command = " --standby --activate"
command += (" -d " if shortcut else " --cache-device ") + cache_dev
command += (" -i " if shortcut else " --cache-id ") + cache_id
return casadm_bin + command
def print_statistics_cmd(cache_id: str, core_id: str = None, per_io_class: bool = False,
io_class_id: str = None, filter: str = None,
output_format: str = None, by_id_path: bool = True,