test-api: update cas api

Signed-off-by: Kamil Gierszewski <kamil.gierszewski@huawei.com>
This commit is contained in:
Kamil Gierszewski
2024-08-08 03:11:21 +02:00
parent 5dccbc3978
commit d48e9fc80d
14 changed files with 1180 additions and 1110 deletions

View File

@@ -1,5 +1,6 @@
#
# Copyright(c) 2019-2022 Intel Corporation
# Copyright(c) 2024 Huawei Technologies Co., Ltd.
# SPDX-License-Identifier: BSD-3-Clause
#
@@ -18,32 +19,30 @@ start_cache_with_existing_metadata = [
r"Error inserting cache \d+",
r"Old metadata found on device\.",
r"Please load cache metadata using --load option or use --force to",
r" discard on-disk metadata and start fresh cache instance\."
r" discard on-disk metadata and start fresh cache instance\.",
]
start_cache_on_already_used_dev = [
r"Error inserting cache \d+",
r"Cache device \'\/dev\/\S+\' is already used as cache\."
r"Cache device \'\/dev\/\S+\' is already used as cache\.",
]
start_cache_with_existing_id = [
r"Error inserting cache \d+",
r"Cache ID already exists"
r"Cache ID already exists",
]
standby_init_with_existing_filesystem = [
r"A filesystem exists on \S+. Specify the --force option if you wish to add the cache anyway.",
r"Note: this may result in loss of data"
r"Note: this may result in loss of data",
]
error_inserting_cache = [
r"Error inserting cache \d+"
]
error_inserting_cache = [r"Error inserting cache \d+"]
reinitialize_with_force_or_recovery = [
r"Old metadata found on device\.",
r"Please load cache metadata using --load option or use --force to",
r" discard on-disk metadata and start fresh cache instance\."
r" discard on-disk metadata and start fresh cache instance\.",
]
remove_inactive_core_with_remove_command = [
@@ -52,40 +51,36 @@ remove_inactive_core_with_remove_command = [
remove_inactive_dirty_core = [
r"The cache contains dirty data assigned to the core\. If you want to ",
r"continue, please use --force option\.\nWarning: the data will be lost"
r"continue, please use --force option\.\nWarning: the data will be lost",
]
stop_cache_incomplete = [
r"Error while removing cache \d+",
r"Cache is in incomplete state - at least one core is inactive"
r"Cache is in incomplete state - at least one core is inactive",
]
stop_cache_errors = [
r"Removed cache \d+ with errors",
r"Error while writing to cache device"
r"Error while writing to cache device",
]
get_stats_ioclass_id_not_configured = [
r"IO class \d+ is not configured\."
]
get_stats_ioclass_id_not_configured = [r"IO class \d+ is not configured\."]
get_stats_ioclass_id_out_of_range = [
r"Invalid IO class id, must be in the range 0-32\."
]
get_stats_ioclass_id_out_of_range = [r"Invalid IO class id, must be in the range 0-32\."]
remove_multilevel_core = [
r"Error while removing core device \d+ from cache instance \d+",
r"Device opens or mount are pending to this cache"
r"Device opens or mount are pending to this cache",
]
add_cached_core = [
r"Error while adding core device to cache instance \d+",
r"Core device \'/dev/\S+\' is already cached\."
r"Core device \'/dev/\S+\' is already cached\.",
]
already_cached_core = [
r"Error while adding core device to cache instance \d+",
r"Device already added as a core"
r"Device already added as a core",
]
remove_mounted_core = [
@@ -94,37 +89,31 @@ remove_mounted_core = [
stop_cache_mounted_core = [
r"Error while removing cache \d+",
r"Device opens or mount are pending to this cache"
r"Device opens or mount are pending to this cache",
]
load_and_force = [
r"Use of \'load\' with \'force\', \'cache-id\', \'cache-mode\' or \'cache-line-size\'",
r" simultaneously is forbidden."
r" simultaneously is forbidden.",
]
try_add_core_sector_size_mismatch = [
r"Error while adding core device to cache instance \d+",
r"Cache device logical sector size is greater than core device logical sector size\.",
r"Consider changing logical sector size on current cache device",
r"or try other device with the same logical sector size as core device\."
r"or try other device with the same logical sector size as core device\.",
]
no_caches_running = [
r"No caches running"
]
no_caches_running = [r"No caches running"]
unavailable_device = [
r"Error while opening \'\S+\'exclusively\. This can be due to\n"
r"cache instance running on this device\. In such case please stop the cache and try again\."
]
error_handling = [
r"Error during options handling"
]
error_handling = [r"Error during options handling"]
no_cas_metadata = [
r"Device \'\S+\' does not contain OpenCAS's metadata\."
]
no_cas_metadata = [r"Device \'\S+\' does not contain OpenCAS's metadata\."]
cache_dirty_data = [
r"Cache instance contains dirty data\. Clearing metadata will result in loss of dirty data\.\n"
@@ -140,21 +129,16 @@ cache_dirty_shutdown = [
r"Alternatively, if you wish to clear metadata anyway, please use \'--force\' option\."
]
missing_param = [
r"Option \'.+\' is missing"
]
missing_param = [r"Option \'.+\' is missing"]
disallowed_param = [
r"Unrecognized option \S+"
]
disallowed_param = [r"Unrecognized option \S+"]
operation_forbiden_in_standby = [
r"The operation is not permited while the cache is in the standby mode"
]
mutually_exclusive_params_init = [
r"Can\'t use \'load\' and \'init\' options simultaneously\n"
r"Error during options handling"
r"Can\'t use \'load\' and \'init\' options simultaneously\n" r"Error during options handling"
]
mutually_exclusive_params_load = [
@@ -166,30 +150,22 @@ activate_with_different_cache_id = [
r"Cache id specified by user and loaded from metadata are different"
]
cache_activated_successfully = [
r"Successfully activated cache instance \d+"
]
cache_activated_successfully = [r"Successfully activated cache instance \d+"]
invalid_core_volume_size = [
r"Core volume size does not match the size stored in cache metadata"
]
invalid_core_volume_size = [r"Core volume size does not match the size stored in cache metadata"]
error_activating_cache = [
r"Error activating cache \d+"
]
error_activating_cache = [r"Error activating cache \d+"]
activate_without_detach = [
r"Cannot open the device exclusively. Make sure to detach cache before activation."
]
cache_line_size_mismatch = [
r"Cache line size mismatch"
]
cache_line_size_mismatch = [r"Cache line size mismatch"]
headerless_io_class_config = [
r'Cannot parse configuration file - unknown column "1"\.\n'
r'Failed to parse I/O classes configuration file header\. It is either malformed or missing\.\n'
r'Please consult Admin Guide to check how columns in configuration file should be named\.'
r"Failed to parse I/O classes configuration file header\. It is either malformed or missing\.\n"
r"Please consult Admin Guide to check how columns in configuration file should be named\."
]
illegal_io_class_config_L2C1 = [
@@ -205,9 +181,7 @@ illegal_io_class_config_L2C4 = [
r"Cannot parse configuration file - error in line 2 in column 4 \(Allocation\)\."
]
illegal_io_class_config_L2 = [
r"Cannot parse configuration file - error in line 2\."
]
illegal_io_class_config_L2 = [r"Cannot parse configuration file - error in line 2\."]
double_io_class_config = [
r"Double configuration for IO class id \d+\n"
@@ -243,14 +217,13 @@ illegal_io_class_invalid_allocation_number = [
]
malformed_io_class_header = [
r'Cannot parse configuration file - unknown column \"value_template\"\.\n'
r'Failed to parse I/O classes configuration file header\. It is either malformed or missing\.\n'
r'Please consult Admin Guide to check how columns in configuration file should be named\.'
r"Cannot parse configuration file - unknown column \"value_template\"\.\n"
r"Failed to parse I/O classes configuration file header\. It is either malformed or missing\.\n"
r"Please consult Admin Guide to check how columns in configuration file should be named\."
]
unexpected_cls_option = [
r"Option '--cache-line-size \(-x\)' is not allowed"
]
unexpected_cls_option = [r"Option '--cache-line-size \(-x\)' is not allowed"]
def check_stderr_msg(output: Output, expected_messages, negate=False):
return __check_string_msg(output.stderr, expected_messages, negate)
@@ -268,7 +241,8 @@ def __check_string_msg(text: str, expected_messages, negate=False):
TestRun.LOGGER.error(f"Message is incorrect, expected: {msg}\n actual: {text}.")
msg_ok = False
elif matches and negate:
TestRun.LOGGER.error(f"Message is incorrect, expected to not find: {msg}\n "
f"actual: {text}.")
TestRun.LOGGER.error(
f"Message is incorrect, expected to not find: {msg}\n " f"actual: {text}."
)
msg_ok = False
return msg_ok