pyocf: Load standby from device

Signed-off-by: Jan Musial <jan.musial@intel.com>
This commit is contained in:
Jan Musial 2022-03-29 09:05:27 +02:00
parent d87bdc3a43
commit 83a28825d2

View File

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