Enable try-add method in CAS test-framework API
This commit is contained in:
parent
9cabf06ed4
commit
ad90a69284
@ -72,6 +72,13 @@ def remove_detached(core_device: Device, shortcut: bool = False):
|
|||||||
return output
|
return output
|
||||||
|
|
||||||
|
|
||||||
|
def try_add(core_device: Device, cache_id: int):
|
||||||
|
output = TestRun.executor.run(script_try_add_cmd(str(cache_id), core_device.system_path))
|
||||||
|
if output.exit_code != 0:
|
||||||
|
raise CmdException("Failed to execute try add script command.", output)
|
||||||
|
return Core(core_device.system_path, cache_id)
|
||||||
|
|
||||||
|
|
||||||
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,6 +19,11 @@ 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):
|
||||||
|
return f"{casadm_bin} --script --add-core --try-add --cache-id {cache_id} " \
|
||||||
|
f"--core-device {core_dev}"
|
||||||
|
|
||||||
|
|
||||||
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}"
|
||||||
|
@ -32,7 +32,9 @@ class Core(Device):
|
|||||||
self.core_device = Device(core_device)
|
self.core_device = Device(core_device)
|
||||||
self.system_path = None
|
self.system_path = None
|
||||||
core_info = self.__get_core_info()
|
core_info = self.__get_core_info()
|
||||||
|
if core_info["core_id"] != "-":
|
||||||
self.core_id = int(core_info["core_id"])
|
self.core_id = int(core_info["core_id"])
|
||||||
|
if core_info["exp_obj"] != "-":
|
||||||
Device.__init__(self, core_info["exp_obj"])
|
Device.__init__(self, core_info["exp_obj"])
|
||||||
self.cache_id = cache_id
|
self.cache_id = cache_id
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user