Add remove_core fcn
Signed-off-by: Jan Musial <jan.musial@intel.com>
This commit is contained in:
parent
d9d4f2fab1
commit
be773a45af
@ -20,6 +20,7 @@ from ctypes import (
|
|||||||
from enum import IntEnum
|
from enum import IntEnum
|
||||||
from datetime import timedelta
|
from datetime import timedelta
|
||||||
|
|
||||||
|
from ..ocf import OcfLib
|
||||||
from .shared import Uuid, OcfError, CacheLineSize, CacheLines, OcfCompletion
|
from .shared import Uuid, OcfError, CacheLineSize, CacheLines, OcfCompletion
|
||||||
from ..utils import Size, struct_to_dict
|
from ..utils import Size, struct_to_dict
|
||||||
from .core import Core
|
from .core import Core
|
||||||
@ -289,6 +290,27 @@ class Cache:
|
|||||||
|
|
||||||
self.put_and_write_unlock()
|
self.put_and_write_unlock()
|
||||||
|
|
||||||
|
def remove_core(self, core: Core):
|
||||||
|
self.get_and_write_lock()
|
||||||
|
|
||||||
|
c = OcfCompletion(
|
||||||
|
[
|
||||||
|
("priv", c_void_p),
|
||||||
|
("error", c_int),
|
||||||
|
]
|
||||||
|
)
|
||||||
|
|
||||||
|
self.owner.lib.ocf_mngt_cache_remove_core(
|
||||||
|
core.handle, c, None
|
||||||
|
)
|
||||||
|
|
||||||
|
c.wait()
|
||||||
|
if c.results["error"]:
|
||||||
|
self.put_and_write_unlock()
|
||||||
|
raise OcfError("Failed removing core", c.results["error"])
|
||||||
|
|
||||||
|
self.put_and_write_unlock()
|
||||||
|
|
||||||
def get_stats(self):
|
def get_stats(self):
|
||||||
cache_info = CacheInfo()
|
cache_info = CacheInfo()
|
||||||
usage = UsageStats()
|
usage = UsageStats()
|
||||||
@ -389,3 +411,7 @@ class Cache:
|
|||||||
|
|
||||||
self.put_and_write_unlock()
|
self.put_and_write_unlock()
|
||||||
self.owner.caches.remove(self)
|
self.owner.caches.remove(self)
|
||||||
|
|
||||||
|
lib = OcfLib.getInstance()
|
||||||
|
lib.ocf_mngt_cache_remove_core.argtypes = [c_void_p, c_void_p, c_void_p]
|
||||||
|
lib.ocf_mngt_cache_add_core.argtypes = [c_void_p, c_void_p, c_void_p, c_void_p]
|
||||||
|
Loading…
Reference in New Issue
Block a user