diff options
author | Andy Grover <agrover@redhat.com> | 2017-09-21 16:45:30 -0700 |
---|---|---|
committer | Andy Grover <agrover@redhat.com> | 2017-09-21 16:50:50 -0700 |
commit | 12e626b649ef4a928aa95e60d8b8c58b20bd3372 (patch) | |
tree | 12d9e4933d9f1ee537640162be81dcda3291c26d | |
parent | 198a1f22987ce4f5efec5dad888a7c4303129cb7 (diff) | |
download | rtslib-fb-remove-hba-dirs.tar.gz |
Remove hba-only directories in clear_existing()remove-hba-dirs
rtslib never creates hba directories without a storage object within it,
but if under some circumstance these existed then clear_existing() wouldn't
remove them, since StorageObject::all()'s glob ignores them.
Add code to ensure these are also removed.
Signed-off-by: Andy Grover <agrover@redhat.com>
-rw-r--r-- | rtslib/root.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/rtslib/root.py b/rtslib/root.py index 0c3c231..72c0299 100644 --- a/rtslib/root.py +++ b/rtslib/root.py @@ -21,6 +21,7 @@ under the License. import os import stat import json +import glob from .node import CFSNode from .target import Target @@ -206,6 +207,11 @@ class RTSRoot(CFSNode): for so in self.storage_objects: so.delete() + # If somehow some hbas still exist (no storage object within?) clean + # them up too. + for hba_dir in glob.glob("%s/core/*_*" % self.configfs_dir): + os.rmdir(hba_dir) + def restore(self, config, clear_existing=False, abort_on_error=False): ''' Takes a dict generated by dump() and reconfigures the target to match. |