@staticmethod
  def _ComputeStorageDataFromSpaceInfoByTemplate(
      space_info, node_name, disk_template):
    """Extract storage data from node info.

    @type space_info: see result of the RPC call node info
    @param space_info: the storage reporting part of the result of the RPC call
      node info
    @type node_name: string
    @param node_name: the node's name
    @type disk_template: string
    @param disk_template: the disk template to report space for
    @rtype: 4-tuple of integers
    @return: tuple of storage info (total_disk, free_disk, total_spindles,
       free_spindles)

    """
    storage_type = constants.MAP_DISK_TEMPLATE_STORAGE_TYPE[disk_template]
    if storage_type not in constants.STS_REPORT:
      total_disk = total_spindles = 0
      free_disk = free_spindles = 0
    else:
      template_space_info = utils.storage.LookupSpaceInfoByDiskTemplate(
          space_info, disk_template)
      if not template_space_info:
        raise errors.OpExecError("Node '%s' didn't return space info for disk"
                                   "template '%s'" % (node_name, disk_template))
      total_disk = template_space_info["storage_size"]
      free_disk = template_space_info["storage_free"]

      total_spindles = 0
      free_spindles = 0
      if disk_template in constants.DTS_LVM:
        lvm_pv_info = utils.storage.LookupSpaceInfoByStorageType(
           space_info, constants.ST_LVM_PV)
        if lvm_pv_info:
          total_spindles = lvm_pv_info["storage_size"]
          free_spindles = lvm_pv_info["storage_free"]
    return (total_disk, free_disk, total_spindles, free_spindles)
dataset/ETHPy150Open ganeti/ganeti/lib/masterd/iallocator.py/IAllocator._ComputeStorageDataFromSpaceInfoByTemplate/original