Revision d48c944b lib/utils/storage.py

b/lib/utils/storage.py
34 34
          if constants.MAP_DISK_TEMPLATE_STORAGE_TYPE[dt] == storage_type]
35 35

  
36 36

  
37
def GetLvmDiskTemplates():
38
  """Returns all disk templates that use LVM."""
39
  return GetDiskTemplatesOfStorageType(constants.ST_LVM_VG)
40

  
41

  
42 37
def IsDiskTemplateEnabled(disk_template, enabled_disk_templates):
43 38
  """Checks if a particular disk template is enabled.
44 39

  
......
62 57

  
63 58
def IsLvmEnabled(enabled_disk_templates):
64 59
  """Check whether or not any lvm-based disk templates are enabled."""
65
  return len(set(GetLvmDiskTemplates())
66
             .intersection(set(enabled_disk_templates))) != 0
60
  return len(constants.DTS_LVM & set(enabled_disk_templates)) != 0
67 61

  
68 62

  
69 63
def LvmGetsEnabled(enabled_disk_templates, new_enabled_disk_templates):
......
73 67
  """
74 68
  if IsLvmEnabled(enabled_disk_templates):
75 69
    return False
76
  return set(GetLvmDiskTemplates()).intersection(
77
      set(new_enabled_disk_templates))
70
  return len(constants.DTS_LVM & set(new_enabled_disk_templates)) != 0
78 71

  
79 72

  
80 73
def _GetDefaultStorageUnitForDiskTemplate(cfg, disk_template):
......
92 85
  """
93 86
  storage_type = constants.MAP_DISK_TEMPLATE_STORAGE_TYPE[disk_template]
94 87
  cluster = cfg.GetClusterInfo()
95
  if disk_template in GetLvmDiskTemplates():
88
  if disk_template in constants.DTS_LVM:
96 89
    return (storage_type, cfg.GetVGName())
97 90
  elif disk_template == constants.DT_FILE:
98 91
    return (storage_type, cluster.file_storage_dir)

Also available in: Unified diff