From 83a28825d245cfa3663dda59cbf70cbcd03eb581 Mon Sep 17 00:00:00 2001 From: Jan Musial Date: Tue, 29 Mar 2022 09:05:27 +0200 Subject: [PATCH] pyocf: Load standby from device Signed-off-by: Jan Musial --- tests/functional/pyocf/types/cache.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/tests/functional/pyocf/types/cache.py b/tests/functional/pyocf/types/cache.py index c4510c5..1f32d3d 100644 --- a/tests/functional/pyocf/types/cache.py +++ b/tests/functional/pyocf/types/cache.py @@ -703,6 +703,22 @@ class Cache: if c.results["error"]: raise OcfError("Loading cache device failed", c.results["error"]) + @classmethod + def load_standby_from_device(cls, device, owner=None, name="cache", cache_line_size=None): + if owner is None: + owner = OcfCtx.get_default() + + c = cls(name=name, owner=owner, cache_line_size=cache_line_size) + + c.start_cache() + try: + c.standby_load(device) + except: # noqa E722 + c.stop() + raise + + return c + @classmethod def load_from_device( cls, device, owner=None, name="cache", open_cores=True, disable_cleaner=False