Revision 1f7c8208 lib/cmdlib/common.py

b/lib/cmdlib/common.py
1067 1067
  if lu.cfg.GetNodeInfo(node_uuid).offline:
1068 1068
    raise errors.OpPrereqError("%s: %s" % (msg, lu.cfg.GetNodeName(node_uuid)),
1069 1069
                               errors.ECODE_STATE)
1070

  
1071

  
1072
def CheckDiskTemplateEnabled(cluster, disk_template):
1073
  """Helper function to check if a disk template is enabled.
1074

  
1075
  @type cluster: C{objects.Cluster}
1076
  @param cluster: the cluster's configuration
1077
  @type disk_template: str
1078
  @param disk_template: the disk template to be checked
1079

  
1080
  """
1081
  assert disk_template is not None
1082
  assert disk_template in constants.DISK_TEMPLATES
1083
  if not disk_template in cluster.enabled_disk_templates:
1084
    raise errors.OpPrereqError("Disk template '%s' is not enabled in cluster."
1085
                               " Enabled disk templates are: %s" %
1086
                               (disk_template,
1087
                                ",".join(cluster.enabled_disk_templates)))
1088

  

Also available in: Unified diff