From ccbce2a9b707f70c07e4543eec7538bdfd799145 Mon Sep 17 00:00:00 2001 From: Daniel Madej Date: Fri, 24 Jan 2020 14:56:05 +0100 Subject: [PATCH] Test API: Filesystem on core + set sequential cut-off fix Copy exported object's filesystem to core device on fs creation Fix set_param_cutoff function Signed-off-by: Daniel Madej --- test/functional/api/cas/casadm.py | 12 ++++++------ test/functional/api/cas/core.py | 6 +++++- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/test/functional/api/cas/casadm.py b/test/functional/api/cas/casadm.py index 81a1195..4111535 100644 --- a/test/functional/api/cas/casadm.py +++ b/test/functional/api/cas/casadm.py @@ -2,9 +2,7 @@ # Copyright(c) 2019 Intel Corporation # SPDX-License-Identifier: BSD-3-Clause-Clear # -import csv -from test_utils.output import CmdException from typing import List from api.cas.cache import Cache @@ -54,7 +52,8 @@ def add_core(cache: Cache, core_dev: Device, core_id: int = None, shortcut: bool core_id=_core_id, shortcut=shortcut)) if output.exit_code != 0: raise CmdException("Failed to add core.", output) - return Core(core_dev.system_path, cache.cache_id) + core = Core(core_dev.system_path, cache.cache_id) + return core def remove_core(cache_id: int, core_id: int, force: bool = False, shortcut: bool = False): @@ -252,10 +251,11 @@ def get_param_cleaning_acp(cache_id: int, output_format: OutputFormat = None, def set_param_cutoff(cache_id: int, core_id: int = None, threshold: Size = None, policy: SeqCutOffPolicy = None): - _threshold = None if threshold is None else int(threshold.get_value(Unit.KibiByte)) + _core_id = None if core_id is None else str(core_id) + _threshold = None if threshold is None else str(int(threshold.get_value(Unit.KibiByte))) + _policy = None if policy is None else policy.name command = set_param_cutoff_cmd( - cache_id=cache_id, core_id=core_id, - threshold=_threshold, policy=policy) + cache_id=str(cache_id), core_id=_core_id, threshold=_threshold, policy=_policy) output = TestRun.executor.run(command) if output.exit_code != 0: raise CmdException("Error while setting sequential cut-off params.", output) diff --git a/test/functional/api/cas/core.py b/test/functional/api/cas/core.py index 35230f4..13a2235 100644 --- a/test/functional/api/cas/core.py +++ b/test/functional/api/cas/core.py @@ -7,7 +7,7 @@ from api.cas.casadm_parser import * from api.cas.cli import * from api.cas.statistics import CoreStats, CoreIoClassStats -from test_tools import fs_utils +from test_tools import fs_utils, disk_utils from test_utils.os_utils import * from test_utils.os_utils import wait @@ -49,6 +49,10 @@ class Core(Device): "status": split_line[3], "exp_obj": split_line[5]} + def create_filesystem(self, fs_type: disk_utils.Filesystem, force=True, blocksize=None): + super().create_filesystem(fs_type, force, blocksize) + self.core_device.filesystem = self.filesystem + def get_io_class_statistics(self, io_class_id: int, stat_filter: List[StatsFilter] = None,