Merge pull request #506 from katlapinka/api-detach
Add detach command to test's API and fix for attach command
This commit is contained in:
commit
e8fa4ca7fc
@ -72,8 +72,9 @@ def remove_detached(core_device: Device, shortcut: bool = False):
|
|||||||
return output
|
return output
|
||||||
|
|
||||||
|
|
||||||
def try_add(core_device: Device, cache_id: int):
|
def try_add(core_device: Device, cache_id: int, core_id: int = None):
|
||||||
output = TestRun.executor.run(script_try_add_cmd(str(cache_id), core_device.system_path))
|
output = TestRun.executor.run(script_try_add_cmd(str(cache_id), core_device.system_path,
|
||||||
|
str(core_id) if core_id is not None else None))
|
||||||
if output.exit_code != 0:
|
if output.exit_code != 0:
|
||||||
raise CmdException("Failed to execute try add script command.", output)
|
raise CmdException("Failed to execute try add script command.", output)
|
||||||
return Core(core_device.system_path, cache_id)
|
return Core(core_device.system_path, cache_id)
|
||||||
@ -93,6 +94,13 @@ def purge_core(cache_id: int, core_id: int):
|
|||||||
return output
|
return output
|
||||||
|
|
||||||
|
|
||||||
|
def detach_core(cache_id: int, core_id: int):
|
||||||
|
output = TestRun.executor.run(script_detach_core_cmd(str(cache_id), str(core_id)))
|
||||||
|
if output.exit_code != 0:
|
||||||
|
raise CmdException("Failed to execute detach core script command.", output)
|
||||||
|
return output
|
||||||
|
|
||||||
|
|
||||||
def reset_counters(cache_id: int, core_id: int = None, shortcut: bool = False):
|
def reset_counters(cache_id: int, core_id: int = None, shortcut: bool = False):
|
||||||
_core_id = None if core_id is None else str(core_id)
|
_core_id = None if core_id is None else str(core_id)
|
||||||
output = TestRun.executor.run(
|
output = TestRun.executor.run(
|
||||||
|
@ -19,9 +19,12 @@ def add_core_cmd(cache_id: str, core_dev: str, core_id: str = None, shortcut: bo
|
|||||||
return casadm_bin + command
|
return casadm_bin + command
|
||||||
|
|
||||||
|
|
||||||
def script_try_add_cmd(cache_id: str, core_dev: str):
|
def script_try_add_cmd(cache_id: str, core_dev: str, core_id: str = None):
|
||||||
return f"{casadm_bin} --script --add-core --try-add --cache-id {cache_id} " \
|
command = f"{casadm_bin} --script --add-core --try-add --cache-id {cache_id} " \
|
||||||
f"--core-device {core_dev}"
|
f"--core-device {core_dev}"
|
||||||
|
if core_id:
|
||||||
|
command += f" --core-id {core_id}"
|
||||||
|
return command
|
||||||
|
|
||||||
|
|
||||||
def script_purge_cache_cmd(cache_id: str):
|
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}"
|
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):
|
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 \
|
command = f" -R -i {cache_id} -j {core_id}" if shortcut \
|
||||||
else f" --remove-core --cache-id {cache_id} --core-id {core_id}"
|
else f" --remove-core --cache-id {cache_id} --core-id {core_id}"
|
||||||
|
Loading…
Reference in New Issue
Block a user