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 <daniel.madej@intel.com>
This commit is contained in:
Daniel Madej 2020-01-24 14:56:05 +01:00
parent 5c77bbd00b
commit ccbce2a9b7
2 changed files with 11 additions and 7 deletions

View File

@ -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)

View File

@ -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,