gnt-cluster init: enabling of disk templates
authorHelga Velroyen <helgav@google.com>
Tue, 26 Mar 2013 12:23:39 +0000 (13:23 +0100)
committerHelga Velroyen <helgav@google.com>
Thu, 11 Apr 2013 20:52:59 +0000 (22:52 +0200)
This patch enhances 'gnt-cluster init' to accept a list of disk templates
to be enabled. It removes the list of enabled storage types.

Signed-off-by: Helga Velroyen <helgav@google.com>
Reviewed-by: Michele Tartara <mtarara@google.com>

lib/bootstrap.py
lib/client/gnt_cluster.py

index 7bd189c..40da336 100644 (file)
@@ -372,13 +372,13 @@ def InitCluster(cluster_name, mac_prefix, # pylint: disable=R0913, R0914
                 maintain_node_health=False, drbd_helper=None, uid_pool=None,
                 default_iallocator=None, primary_ip_version=None, ipolicy=None,
                 prealloc_wipe_disks=False, use_external_mip_script=False,
-                hv_state=None, disk_state=None, enabled_storage_types=None):
+                hv_state=None, disk_state=None, enabled_disk_templates=None):
   """Initialise the cluster.
 
   @type candidate_pool_size: int
   @param candidate_pool_size: master candidate pool size
-  @type enabled_storage_types: list of string
-  @param enabled_storage_types: list of storage types to be used in this
+  @type enabled_disk_templates: list of string
+  @param enabled_disk_templates: list of disk_templates to be used in this
     cluster
 
   """
@@ -396,14 +396,14 @@ def InitCluster(cluster_name, mac_prefix, # pylint: disable=R0913, R0914
                                " entries: %s" % invalid_hvs,
                                errors.ECODE_INVAL)
 
-  if not enabled_storage_types:
-    raise errors.OpPrereqError("Enabled storage types list must contain at"
+  if not enabled_disk_templates:
+    raise errors.OpPrereqError("Enabled disk templates list must contain at"
                                " least one member", errors.ECODE_INVAL)
-  invalid_storage_types = \
-    set(enabled_storage_types) - constants.VALID_STORAGE_TYPES
-  if invalid_storage_types:
-    raise errors.OpPrereqError("Enabled storage_types contains invalid"
-                               " entries: %s" % invalid_storage_types,
+  invalid_disk_templates = \
+    set(enabled_disk_templates) - constants.DISK_TEMPLATES
+  if invalid_disk_templates:
+    raise errors.OpPrereqError("Enabled disk templates list contains invalid"
+                               " entries: %s" % invalid_disk_templates,
                                errors.ECODE_INVAL)
 
   try:
@@ -634,7 +634,7 @@ def InitCluster(cluster_name, mac_prefix, # pylint: disable=R0913, R0914
     ipolicy=full_ipolicy,
     hv_state_static=hv_state,
     disk_state_static=disk_state,
-    enabled_storage_types=enabled_storage_types,
+    enabled_disk_templates=enabled_disk_templates,
     )
   master_node_config = objects.Node(name=hostname.name,
                                     primary_ip=hostname.ip,
index 21d5abb..652b5f4 100644 (file)
@@ -226,7 +226,7 @@ def InitCluster(opts, args):
                         use_external_mip_script=external_ip_setup_script,
                         hv_state=hv_state,
                         disk_state=disk_state,
-                        enabled_storage_types=enabled_storage_types,
+                        enabled_disk_templates=enabled_disk_templates,
                         )
   op = opcodes.OpClusterPostInit()
   SubmitOpCode(op, opts=opts)
@@ -1507,7 +1507,7 @@ commands = {
      MAINTAIN_NODE_HEALTH_OPT, UIDPOOL_OPT, DRBD_HELPER_OPT, NODRBD_STORAGE_OPT,
      DEFAULT_IALLOCATOR_OPT, PRIMARY_IP_VERSION_OPT, PREALLOC_WIPE_DISKS_OPT,
      NODE_PARAMS_OPT, GLOBAL_SHARED_FILEDIR_OPT, USE_EXTERNAL_MIP_SCRIPT,
-     DISK_PARAMS_OPT, HV_STATE_OPT, DISK_STATE_OPT, ENABLED_STORAGE_TYPES_OPT]
+     DISK_PARAMS_OPT, HV_STATE_OPT, DISK_STATE_OPT, ENABLED_DISK_TEMPLATES_OPT]
      + INSTANCE_POLICY_OPTS,
     "[opts...] <cluster_name>", "Initialises a new cluster configuration"),
   "destroy": (