Revision 5e09a309

b/lib/backend.py
2743 2743
  if not (constants.ENABLE_FILE_STORAGE or
2744 2744
          constants.ENABLE_SHARED_FILE_STORAGE):
2745 2745
    _Fail("File storage disabled at configure time")
2746
  cfg = _GetConfig()
2747
  fs_dir = os.path.normpath(fs_dir)
2748
  base_fstore = cfg.GetFileStorageDir()
2749
  base_shared = cfg.GetSharedFileStorageDir()
2750
  if not (utils.IsBelowDir(base_fstore, fs_dir) or
2751
          utils.IsBelowDir(base_shared, fs_dir)):
2752
    _Fail("File storage directory '%s' is not under base file"
2753
          " storage directory '%s' or shared storage directory '%s'",
2754
          fs_dir, base_fstore, base_shared)
2755
  return fs_dir
2746

  
2747
  bdev.CheckFileStoragePath(fs_dir)
2748

  
2749
  return os.path.normpath(fs_dir)
2756 2750

  
2757 2751

  
2758 2752
def CreateFileStorageDir(file_storage_dir):
b/lib/bdev.py
2245 2245
      raise ValueError("Invalid configuration data %s" % str(unique_id))
2246 2246
    self.driver = unique_id[0]
2247 2247
    self.dev_path = unique_id[1]
2248

  
2249
    CheckFileStoragePath(self.dev_path)
2250

  
2248 2251
    self.Attach()
2249 2252

  
2250 2253
  def Assemble(self):
......
2361 2364
    """
2362 2365
    if not isinstance(unique_id, (tuple, list)) or len(unique_id) != 2:
2363 2366
      raise ValueError("Invalid configuration data %s" % str(unique_id))
2367

  
2364 2368
    dev_path = unique_id[1]
2369

  
2370
    CheckFileStoragePath(dev_path)
2371

  
2365 2372
    try:
2366 2373
      fd = os.open(dev_path, os.O_RDWR | os.O_CREAT | os.O_EXCL)
2367 2374
      f = os.fdopen(fd, "w")

Also available in: Unified diff