pyocf: Make cache lookup by name a common utility

Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
This commit is contained in:
Robert Baldyga
2022-06-20 17:01:43 +02:00
committed by Piotr Debski
parent 5441cdb50a
commit ef4bfc9ac3
2 changed files with 13 additions and 9 deletions

View File

@@ -977,6 +977,16 @@ class Cache:
def settle(self):
Queue.settle_many(self.io_queues + [self.mngt_queue])
@staticmethod
def get_by_name(cache_name, owner=None):
if owner is None:
owner = OcfCtx.get_default()
cache_pointer = c_void_p()
return OcfLib.getInstance().ocf_mngt_cache_get_by_name(
owner.ctx_handle, cache_name, byref(cache_pointer)
)
lib = OcfLib.getInstance()