Mtab check optional

There are situations when /etc/mtab is not present in the
system (e.g. in certain container images). This blocks
stop/remove operations. With making this check optional
the duty of checking mounts falls to kernel.
Test modified to check operations with and without mtab.

Signed-off-by: Daniel Madej <daniel.madej@huawei.com>
This commit is contained in:
Daniel Madej
2024-09-10 10:39:39 +02:00
parent 7a3b0672f2
commit a2f3cc1f4a
3 changed files with 113 additions and 42 deletions

View File

@@ -1,6 +1,6 @@
#
# Copyright(c) 2019-2022 Intel Corporation
# Copyright(c) 2024 Huawei Technologies Co., Ltd.
# Copyright(c) 2024 Huawei Technologies
# SPDX-License-Identifier: BSD-3-Clause
#
@@ -84,11 +84,20 @@ already_cached_core = [
]
remove_mounted_core = [
r"Can\'t remove core \d+ from cache \d+\. Device /dev/cas\d+-\d+ is mounted\!"
r"Can\'t remove core \d+ from cache \d+\. Device /dev/cas\d+-\d+(p\d+|) is mounted\!"
]
remove_mounted_core_kernel = [
r"Error while removing core device \d+ from cache instance \d+",
r"Device opens or mount are pending to this cache",
]
stop_cache_mounted_core = [
r"Error while removing cache \d+",
r"Can\'t stop cache instance \d+\. Device /dev/cas\d+-\d+(p\d+|) is mounted\!"
]
stop_cache_mounted_core_kernel = [
r"Error while stopping cache \d+",
r"Device opens or mount are pending to this cache",
]
@@ -242,7 +251,7 @@ def __check_string_msg(text: str, expected_messages, negate=False):
msg_ok = False
elif matches and negate:
TestRun.LOGGER.error(
f"Message is incorrect, expected to not find: {msg}\n " f"actual: {text}."
f"Message is incorrect, expected to not find: {msg}\n actual: {text}."
)
msg_ok = False
return msg_ok