Add detach command to test's API and fix for attach command

Signed-off-by: Katarzyna Lapinska <katarzyna.lapinska@intel.com>
This commit is contained in:
Katarzyna Lapinska
2020-08-24 10:39:35 +02:00
parent 9283601d84
commit dfdbd9abbe
2 changed files with 21 additions and 5 deletions

View File

@@ -19,9 +19,12 @@ def add_core_cmd(cache_id: str, core_dev: str, core_id: str = None, shortcut: bo
return casadm_bin + command
def script_try_add_cmd(cache_id: str, core_dev: str):
return f"{casadm_bin} --script --add-core --try-add --cache-id {cache_id} " \
f"--core-device {core_dev}"
def script_try_add_cmd(cache_id: str, core_dev: str, core_id: str = None):
command = f"{casadm_bin} --script --add-core --try-add --cache-id {cache_id} " \
f"--core-device {core_dev}"
if core_id:
command += f" --core-id {core_id}"
return command
def script_purge_cache_cmd(cache_id: str):
@@ -32,6 +35,11 @@ def script_purge_core_cmd(cache_id: str, core_id: str):
return f"{casadm_bin} --script --purge-core --cache-id {cache_id} --core-id {core_id}"
def script_detach_core_cmd(cache_id: str, core_id: str):
return f"{casadm_bin} --script --remove-core --detach --cache-id {cache_id} " \
f"--core-id {core_id}"
def remove_core_cmd(cache_id: str, core_id: str, force: bool = False, shortcut: bool = False):
command = f" -R -i {cache_id} -j {core_id}" if shortcut \
else f" --remove-core --cache-id {cache_id} --core-id {core_id}"