summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAmartey Pearson <apearson@us.ibm.com>2017-02-07 12:37:31 -0600
committerAmartey Pearson <apearson@us.ibm.com>2017-02-07 12:38:33 -0600
commite54d50d732dd215c4993a6d9843b7529c5d9c4e4 (patch)
tree38361cbfc6f6196215b6615d1c0088875e99902d
parent2c65d971ab1e77cad6cc637b1cf39148be87dab2 (diff)
parent6453b0d484f4a5b63439a69de4620b498b5c108a (diff)
downloadrtslib-fb-e54d50d732dd215c4993a6d9843b7529c5d9c4e4.tar.gz
Add ability to invalidate caches
For efficiency, rtslib may have caches (today for the data in configfs). A client may need to clear out these caches such as via the refresh option in targetcli. * Add new invalidate_caches method to RTSRoot. While this only has a single cache today, it gives the ability to extend to any future caches. * While bs_cache really should be private, it probably shouldn't be changed given that this is a library and may be used elsewhere. Signed-off-by: Amartey Pearson <apearson@us.ibm.com>
-rw-r--r--rtslib/root.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/rtslib/root.py b/rtslib/root.py
index 6d6b5ee..99a25b7 100644
--- a/rtslib/root.py
+++ b/rtslib/root.py
@@ -25,7 +25,7 @@ import json
from .node import CFSNode
from .target import Target
from .fabric import FabricModule
-from .tcm import so_mapping, StorageObject
+from .tcm import so_mapping, bs_cache, StorageObject
from .utils import RTSLibError, RTSLibALUANotSupported, modprobe, mount_configfs
from .utils import dict_remove, set_attributes
from .alua import ALUATargetPortGroup
@@ -290,6 +290,12 @@ class RTSRoot(CFSNode):
return self.restore(config, clear_existing=clear_existing,
abort_on_error=abort_on_error)
+ def invalidate_caches(self):
+ '''
+ Invalidate any caches used throughout the hierarchy
+ '''
+ bs_cache.clear()
+
targets = property(_list_targets,
doc="Get the list of Target objects.")
tpgs = property(_list_tpgs,