From 74b9eac4ace110acf01f650dc7c85d20af0d5b43 Mon Sep 17 00:00:00 2001 From: Robert Baldyga Date: Mon, 16 Feb 2026 14:52:48 +0100 Subject: [PATCH] pyocf: Avoid disarm() attempt for not-registered volumes An example of such volume is composite_volume, which is internal OCF implementation, thus does not have pyocf specific features, like disarm(). It is also not registered in Volume._instances_, because registration of pyocf volumes is done in open() callback, which for composite_volume is implemented internally in OCF. Co-developed-by: Claude Opus 4.6 Signed-off-by: Claude Opus 4.6 Signed-off-by: Robert Baldyga --- tests/functional/pyocf/types/ctx.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/tests/functional/pyocf/types/ctx.py b/tests/functional/pyocf/types/ctx.py index 46ddabbc..d680ccb2 100644 --- a/tests/functional/pyocf/types/ctx.py +++ b/tests/functional/pyocf/types/ctx.py @@ -1,6 +1,7 @@ # # Copyright(c) 2019-2022 Intel Corporation # Copyright(c) 2024 Huawei Technologies +# Copyright(c) 2026 Unvertical # SPDX-License-Identifier: BSD-3-Clause # @@ -13,6 +14,7 @@ from .shared import OcfError from ..ocf import OcfLib from .queue import Queue +from .volume import Volume class OcfCtxOps(Structure): @@ -114,10 +116,12 @@ def cleanup_volume_types(self): def stop_caches(self): for cache in self.caches[:]: - try: - cache.get_volume().disarm() - except AttributeError: - pass + c_vol = cache.get_c_volume() + if c_vol and c_vol in Volume._instances_: + try: + Volume._instances_[c_vol].disarm() + except AttributeError: + pass cache.stop() def exit(self):