Revision 52a8a6ae

b/lib/backend.py
573 573
  raise errors.QuitGanetiException(True, "Shutdown scheduled")
574 574

  
575 575

  
576
def _GetLvmVgSpaceInfo(name, params):
577
  """Wrapper around C{_GetVgInfo} which checks the storage parameters.
578

  
579
  @type name: string
580
  @param name: name of the volume group
581
  @type params: list
582
  @param params: list of storage parameters, which in this case should be
583
    containing only one for exclusive storage
584

  
585
  """
586
  if params is None:
587
    raise errors.ProgrammerError("No storage parameter for LVM vg storage"
588
                                 " reporting is provided.")
589
  if not isinstance(params, list):
590
    raise errors.ProgrammerError("The storage parameters are not of type"
591
                                 " list: '%s'" % params)
592
  if not len(params) == 1:
593
    raise errors.ProgrammerError("Received more than one storage parameter:"
594
                                 " '%s'" % params)
595
  excl_stor = bool(params[0])
596
  return _GetVgInfo(name, excl_stor)
597

  
598

  
576 599
def _GetVgInfo(name, excl_stor):
577 600
  """Retrieves information about a LVM volume group.
578 601

  
......
714 737
  constants.ST_EXT: None,
715 738
  constants.ST_FILE: _GetFileStorageSpaceInfo,
716 739
  constants.ST_LVM_PV: _GetVgSpindlesInfo,
717
  constants.ST_LVM_VG: _GetVgInfo,
740
  constants.ST_LVM_VG: _GetLvmVgSpaceInfo,
718 741
  constants.ST_RADOS: None,
719 742
}
720 743

  
b/lib/cmdlib/instance_storage.py
905 905
    info = nodeinfo[node]
906 906
    info.Raise("Cannot get current information from node %s" % node_name,
907 907
               prereq=True, ecode=errors.ECODE_ENVIRON)
908
    (_, (vg_info, ), _) = info.payload
909
    vg_free = vg_info.get("storage_free", None)
908
    (_, space_info, _) = info.payload
909
    lvm_vg_info = utils.storage.LookupSpaceInfoByStorageType(
910
        space_info, constants.ST_LVM_VG)
911
    if not lvm_vg_info:
912
      raise errors.OpPrereqError("Can't retrieve storage information for LVM")
913
    vg_free = lvm_vg_info.get("storage_free", None)
910 914
    if not isinstance(vg_free, int):
911 915
      raise errors.OpPrereqError("Can't compute free disk space on node"
912 916
                                 " %s for vg %s, result was '%s'" %
b/lib/rpc.py
730 730
  """
731 731
  result = []
732 732
  for (storage_type, storage_key) in storage_units:
733
    if storage_type == constants.ST_LVM_VG:
734
      result.append((storage_type, storage_key, es_flag))
733
    if storage_type in [constants.ST_LVM_VG, constants.ST_LVM_PV]:
734
      result.append((storage_type, storage_key, [es_flag]))
735 735
    else:
736 736
      result.append((storage_type, storage_key, []))
737 737
  return result

Also available in: Unified diff