Revision 4b322a76 lib/cmdlib/cluster.py

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)

Also available in: Unified diff