Revision 4b322a76

b/lib/backend.py
1140 1140
    if pathresult:
1141 1141
      result[constants.NV_FILE_STORAGE_PATH] = pathresult
1142 1142

  
1143
  if what.get(constants.NV_SHARED_FILE_STORAGE_PATH):
1144
    pathresult = filestorage.CheckFileStoragePath(
1145
        what[constants.NV_SHARED_FILE_STORAGE_PATH])
1146
    if pathresult:
1147
      result[constants.NV_SHARED_FILE_STORAGE_PATH] = pathresult
1148

  
1143 1149
  return result
1144 1150

  
1145 1151

  
b/lib/cmdlib/cluster.py
2417 2417
                    "Node should not have returned forbidden file storage"
2418 2418
                    " paths")
2419 2419

  
2420
  def _VerifyStoragePaths(self, ninfo, nresult):
2420
  def _VerifyStoragePaths(self, ninfo, nresult, file_disk_template,
2421
                          verify_key, error_key):
2421 2422
    """Verifies (file) storage paths.
2422 2423

  
2423 2424
    @type ninfo: L{objects.Node}
2424 2425
    @param ninfo: the node to check
2425 2426
    @param nresult: the remote results for the node
2426

  
2427
    """
2427
    @type file_disk_template: string
2428
    @param file_disk_template: file-based disk template, whose directory
2429
        is supposed to be verified
2430
    @type verify_key: string
2431
    @param verify_key: key for the verification map of this file
2432
        verification step
2433
    @param error_key: error key to be added to the verification results
2434
        in case something goes wrong in this verification step
2435

  
2436
    """
2437
    assert (file_disk_template in
2438
            utils.storage.GetDiskTemplatesOfStorageType(constants.ST_FILE))
2428 2439
    cluster = self.cfg.GetClusterInfo()
2429
    if cluster.IsFileStorageEnabled():
2440
    if cluster.IsDiskTemplateEnabled(file_disk_template):
2430 2441
      self._ErrorIf(
2431
          constants.NV_FILE_STORAGE_PATH in nresult,
2432
          constants.CV_ENODEFILESTORAGEPATHUNUSABLE, ninfo.name,
2433
          "The configured file storage path is unusable: %s" %
2434
          nresult.get(constants.NV_FILE_STORAGE_PATH))
2442
          verify_key in nresult,
2443
          error_key, ninfo.name,
2444
          "The configured %s storage path is unusable: %s" %
2445
          (file_disk_template, nresult.get(verify_key)))
2446

  
2447
  def _VerifyFileStoragePaths(self, ninfo, nresult):
2448
    """Verifies (file) storage paths.
2449

  
2450
    @see: C{_VerifyStoragePaths}
2451

  
2452
    """
2453
    self._VerifyStoragePaths(
2454
        ninfo, nresult, constants.DT_FILE,
2455
        constants.NV_FILE_STORAGE_PATH,
2456
        constants.CV_ENODEFILESTORAGEPATHUNUSABLE)
2457

  
2458
  def _VerifySharedFileStoragePaths(self, ninfo, nresult):
2459
    """Verifies (file) storage paths.
2460

  
2461
    @see: C{_VerifyStoragePaths}
2462

  
2463
    """
2464
    self._VerifyStoragePaths(
2465
        ninfo, nresult, constants.DT_SHARED_FILE,
2466
        constants.NV_SHARED_FILE_STORAGE_PATH,
2467
        constants.CV_ENODESHAREDFILESTORAGEPATHUNUSABLE)
2435 2468

  
2436 2469
  def _VerifyOob(self, ninfo, nresult):
2437 2470
    """Verifies out of band functionality of a node.
......
2948 2981
      self._VerifyOob(node_i, nresult)
2949 2982
      self._VerifyAcceptedFileStoragePaths(node_i, nresult,
2950 2983
                                           node_i.uuid == master_node_uuid)
2951
      self._VerifyStoragePaths(node_i, nresult)
2984
      self._VerifyFileStoragePaths(node_i, nresult)
2985
      self._VerifySharedFileStoragePaths(node_i, nresult)
2952 2986

  
2953 2987
      if nimg.vm_capable:
2954 2988
        self._UpdateVerifyNodeLVM(node_i, nresult, vg_name, nimg)
b/lib/constants.py
1659 1659
  (CV_TNODE, "ENODEFILESTORAGEPATHS", "Detected bad file storage paths")
1660 1660
CV_ENODEFILESTORAGEPATHUNUSABLE = \
1661 1661
  (CV_TNODE, "ENODEFILESTORAGEPATHUNUSABLE", "File storage path unusable")
1662
CV_ENODESHAREDFILESTORAGEPATHUNUSABLE = \
1663
  (CV_TNODE, "ENODESHAREDFILESTORAGEPATHUNUSABLE",
1664
      "Shared file storage path unusable")
1662 1665

  
1663 1666
CV_ALL_ECODES = compat.UniqueFrozenset([
1664 1667
  CV_ECLUSTERCFG,
......
1694 1697
  CV_ENODEUSERSCRIPTS,
1695 1698
  CV_ENODEFILESTORAGEPATHS,
1696 1699
  CV_ENODEFILESTORAGEPATHUNUSABLE,
1700
  CV_ENODESHAREDFILESTORAGEPATHUNUSABLE,
1697 1701
  ])
1698 1702

  
1699 1703
CV_ALL_ECODES_STRINGS = \
b/lib/storage/filestorage.py
198 198
    path, _allowed_paths_file=pathutils.FILE_STORAGE_PATHS_FILE):
199 199
  """Checks whether the path exists and is acceptable to use.
200 200

  
201
  Can be used for any file-based storage, for example shared-file storage.
202

  
201 203
  @type path: string
202 204
  @param path: path to check
203 205
  @rtype: string
b/src/Ganeti/Types.hs
267 267
  , ("CvENODEUSERSCRIPTS",             'C.cvEnodeuserscriptsCode)
268 268
  , ("CvENODEFILESTORAGEPATHS",        'C.cvEnodefilestoragepathsCode)
269 269
  , ("CvENODEFILESTORAGEPATHUNUSABLE", 'C.cvEnodefilestoragepathunusableCode)
270
  , ("CvENODESHAREDFILESTORAGEPATHUNUSABLE",
271
     'C.cvEnodesharedfilestoragepathunusableCode)
270 272
  ])
271 273
$(THH.makeJSONInstance ''CVErrorCode)
272 274

  

Also available in: Unified diff