test-api: update parser
Signed-off-by: Kamil Gierszewski <kamil.gierszewski@huawei.com>
This commit is contained in:
parent
8cd3f4a631
commit
0e24e52686
@ -59,7 +59,7 @@ def get_cores(cache_id: int) -> list:
|
|||||||
cores_dict = get_cas_devices_dict()["cores"].values()
|
cores_dict = get_cas_devices_dict()["cores"].values()
|
||||||
|
|
||||||
def is_active(core):
|
def is_active(core):
|
||||||
return CoreStatus[core["status"].lower()] == CoreStatus.active
|
return core["status"] == CoreStatus.active
|
||||||
|
|
||||||
return [
|
return [
|
||||||
Core(core["device_path"], core["cache_id"])
|
Core(core["device_path"], core["cache_id"])
|
||||||
@ -74,7 +74,7 @@ def get_inactive_cores(cache_id: int) -> list:
|
|||||||
cores_dict = get_cas_devices_dict()["cores"].values()
|
cores_dict = get_cas_devices_dict()["cores"].values()
|
||||||
|
|
||||||
def is_inactive(core):
|
def is_inactive(core):
|
||||||
return CoreStatus[core["status"].lower()] == CoreStatus.inactive
|
return core["status"] == CoreStatus.inactive
|
||||||
|
|
||||||
return [
|
return [
|
||||||
Core(core["device_path"], core["cache_id"])
|
Core(core["device_path"], core["cache_id"])
|
||||||
@ -89,7 +89,7 @@ def get_detached_cores(cache_id: int) -> list:
|
|||||||
cores_dict = get_cas_devices_dict()["cores"].values()
|
cores_dict = get_cas_devices_dict()["cores"].values()
|
||||||
|
|
||||||
def is_detached(core):
|
def is_detached(core):
|
||||||
return CoreStatus[core["status"].lower()] == CoreStatus.detached
|
return core["status"] == CoreStatus.detached
|
||||||
|
|
||||||
return [
|
return [
|
||||||
Core(core["device_path"], core["cache_id"])
|
Core(core["device_path"], core["cache_id"])
|
||||||
@ -110,15 +110,17 @@ def get_cas_devices_dict() -> dict:
|
|||||||
params = [
|
params = [
|
||||||
("id", cache_id),
|
("id", cache_id),
|
||||||
("device_path", device["disk"]),
|
("device_path", device["disk"]),
|
||||||
("status", device["status"]),
|
("status", CacheStatus(device["status"].lower())),
|
||||||
]
|
]
|
||||||
devices["caches"][cache_id] = dict([(key, value) for key, value in params])
|
devices["caches"][cache_id] = dict([(key, value) for key, value in params])
|
||||||
|
|
||||||
elif device["type"] == "core":
|
elif device["type"] == "core":
|
||||||
params = [
|
params = [
|
||||||
("cache_id", cache_id),
|
("cache_id", cache_id),
|
||||||
|
("core_id", (int(device["id"]) if device["id"] != "-" else device["id"])),
|
||||||
("device_path", device["disk"]),
|
("device_path", device["disk"]),
|
||||||
("status", device["status"]),
|
("status", CoreStatus(device["status"].lower())),
|
||||||
|
("exp_obj", device["device"]),
|
||||||
]
|
]
|
||||||
if core_pool:
|
if core_pool:
|
||||||
params.append(("core_pool", device))
|
params.append(("core_pool", device))
|
||||||
|
Loading…
Reference in New Issue
Block a user