The configuration is no longer used for verifying file storage paths.
---
lib/backend.py | 14 ++++----------
lib/bdev.py | 7 +++++++
2 files changed, 11 insertions(+), 10 deletions(-)
diff --git a/lib/backend.py b/lib/backend.py
index a4e7c9a..9500e10 100644
--- a/lib/backend.py
+++ b/lib/backend.py
@@ -2714,16 +2714,10 @@ def _TransformFileStorageDir(fs_dir):
if not (constants.ENABLE_FILE_STORAGE or
constants.ENABLE_SHARED_FILE_STORAGE):
_Fail("File storage disabled at configure time")
- cfg = _GetConfig()
- fs_dir = os.path.normpath(fs_dir)
- base_fstore = cfg.GetFileStorageDir()
- base_shared = cfg.GetSharedFileStorageDir()
- if not (utils.IsBelowDir(base_fstore, fs_dir) or
- utils.IsBelowDir(base_shared, fs_dir)):
- _Fail("File storage directory '%s' is not under base file"
- " storage directory '%s' or shared storage directory '%s'",
- fs_dir, base_fstore, base_shared)
- return fs_dir
+
+ bdev.CheckFileStoragePath(fs_dir)
+
+ return os.path.normpath(fs_dir)
def CreateFileStorageDir(file_storage_dir):
diff --git a/lib/bdev.py b/lib/bdev.py
index 8273eb6..486ef12 100644
--- a/lib/bdev.py
+++ b/lib/bdev.py
@@ -2169,6 +2169,9 @@ class FileStorage(BlockDev):
raise ValueError("Invalid configuration data %s" % str(unique_id))
self.driver = unique_id[0]
self.dev_path = unique_id[1]
+
+ CheckFileStoragePath(self.dev_path)
+
self.Attach()
def Assemble(self):
@@ -2285,7 +2288,11 @@ class FileStorage(BlockDev):
"""
if not isinstance(unique_id, (tuple, list)) or len(unique_id) != 2:
raise ValueError("Invalid configuration data %s" % str(unique_id))
+
dev_path = unique_id[1]
+
+ CheckFileStoragePath(dev_path)
+
try:
fd = os.open(dev_path, os.O_RDWR | os.O_CREAT | os.O_EXCL)
f = os.fdopen(fd, "w")
--
1.7.7.3