diff --git a/lib/cli.py b/lib/cli.py index a802cbb72ddb9d8cde7a0986610cc6d93310ff53..fecc4e966354fc0429ff012c5fea7294008264b3 100644 --- a/lib/cli.py +++ b/lib/cli.py @@ -1,7 +1,7 @@ # # -# Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Google Inc. +# Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012 Google Inc. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -172,7 +172,7 @@ __all__ = [ "SPECS_DISK_SIZE_OPT", "SPECS_MEM_SIZE_OPT", "SPECS_NIC_COUNT_OPT", - "SPECS_DISK_TEMPLATES", + "IPOLICY_DISK_TEMPLATES", "SPICE_CACERT_OPT", "SPICE_CERT_OPT", "SRC_DIR_OPT", @@ -805,11 +805,11 @@ SPECS_NIC_COUNT_OPT = cli_option("--specs-nic-count", dest="ispecs_nic_count", type="keyval", default={}, help="NIC count specs: min, max, std") -SPECS_DISK_TEMPLATES = cli_option("--specs-disk-templates", - dest="ispecs_disk_templates", - type="list", default=None, - help="Comma-separated list of" - " enabled disk templates") +IPOLICY_DISK_TEMPLATES = cli_option("--ipolicy-disk-templates", + dest="ipolicy_disk_templates", + type="list", default=None, + help="Comma-separated list of" + " enabled disk templates") HYPERVISOR_OPT = cli_option("-H", "--hypervisor-parameters", dest="hypervisor", help="Hypervisor and hypervisor options, in the" @@ -1401,7 +1401,7 @@ INSTANCE_POLICY_OPTS = [ SPECS_DISK_SIZE_OPT, SPECS_MEM_SIZE_OPT, SPECS_NIC_COUNT_OPT, - SPECS_DISK_TEMPLATES, + IPOLICY_DISK_TEMPLATES, ] diff --git a/lib/client/gnt_cluster.py b/lib/client/gnt_cluster.py index 4350f168fd3b058eff44e94f1f9be4207e4dcdfc..2fa42cd1d01f120c5a738c57efc30463a64054e5 100644 --- a/lib/client/gnt_cluster.py +++ b/lib/client/gnt_cluster.py @@ -143,14 +143,14 @@ def InitCluster(opts, args): utils.ForceDictType(diskparams[templ], constants.DISK_DT_TYPES) # prepare ipolicy dict - ispecs_dts = opts.ispecs_disk_templates # hate long var names + ispecs_dts = opts.ipolicy_disk_templates # hate long var names ipolicy_raw = \ objects.CreateIPolicyFromOpts(ispecs_mem_size=opts.ispecs_mem_size, ispecs_cpu_count=opts.ispecs_cpu_count, ispecs_disk_count=opts.ispecs_disk_count, ispecs_disk_size=opts.ispecs_disk_size, ispecs_nic_count=opts.ispecs_nic_count, - ispecs_disk_templates=ispecs_dts, + ipolicy_disk_templates=ispecs_dts, fill_all=True) ipolicy = objects.FillIPolicy(constants.IPOLICY_DEFAULTS, ipolicy_raw) @@ -467,7 +467,7 @@ def ShowClusterConfig(opts, args): ToStdout(" - %s", key) _PrintGroupedParams(result["ipolicy"][key], roman=opts.roman_integers) ToStdout(" - enabled disk templates: %s", - utils.CommaJoin(result["ipolicy"][constants.ISPECS_DTS])) + utils.CommaJoin(result["ipolicy"][constants.IPOLICY_DTS])) return 0 @@ -995,14 +995,14 @@ def SetClusterParams(opts, args): if ndparams is not None: utils.ForceDictType(ndparams, constants.NDS_PARAMETER_TYPES) - ispecs_dts = opts.ispecs_disk_templates + ispecs_dts = opts.ipolicy_disk_templates ipolicy = \ objects.CreateIPolicyFromOpts(ispecs_mem_size=opts.ispecs_mem_size, ispecs_cpu_count=opts.ispecs_cpu_count, ispecs_disk_count=opts.ispecs_disk_count, ispecs_disk_size=opts.ispecs_disk_size, ispecs_nic_count=opts.ispecs_nic_count, - ispecs_disk_templates=ispecs_dts) + ipolicy_disk_templates=ispecs_dts) mnh = opts.maintain_node_health diff --git a/lib/client/gnt_group.py b/lib/client/gnt_group.py index a3951f5f8c865626aecadaa8e62ed3a30dd15899..c07ddaf1fb998e086bdb0248cb495593c7000bad 100644 --- a/lib/client/gnt_group.py +++ b/lib/client/gnt_group.py @@ -190,7 +190,7 @@ def SetGroupParams(opts, args): ispecs_disk_count=opts.ispecs_disk_count, ispecs_disk_size=opts.ispecs_disk_size, ispecs_nic_count=opts.ispecs_nic_count, - ispecs_disk_templates=opts.ispecs_disk_templates, + ipolicy_disk_templates=opts.ipolicy_disk_templates, group_ipolicy=True, allowed_values=[constants.VALUE_DEFAULT]) diff --git a/lib/constants.py b/lib/constants.py index 3639767add5077882bb0571d72cf61f555cab5d9..b38039ad4c8f808b8ecdbfb1d175e71a999495cd 100644 --- a/lib/constants.py +++ b/lib/constants.py @@ -1,7 +1,7 @@ # # -# Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Google Inc. +# Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012 Google Inc. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -949,14 +949,14 @@ ISPECS_PARAMETERS = frozenset(ISPECS_PARAMETER_TYPES.keys()) ISPECS_MIN = "min" ISPECS_MAX = "max" ISPECS_STD = "std" -ISPECS_DTS = "disk_templates" +IPOLICY_DTS = "disk_templates" IPOLICY_PARAMETERS = frozenset([ ISPECS_MIN, ISPECS_MAX, ISPECS_STD, ]) -IPOLICY_ALL_KEYS = IPOLICY_PARAMETERS.union([ISPECS_DTS]) +IPOLICY_ALL_KEYS = IPOLICY_PARAMETERS.union([IPOLICY_DTS]) # Node parameter names ND_OOB_PROGRAM = "oob_program" @@ -1906,7 +1906,7 @@ IPOLICY_DEFAULTS = { ISPEC_DISK_SIZE: 1024, ISPEC_NIC_COUNT: 1, }, - ISPECS_DTS: DISK_TEMPLATES, + IPOLICY_DTS: DISK_TEMPLATES, } MASTER_POOL_SIZE_DEFAULT = 10 diff --git a/lib/objects.py b/lib/objects.py index 4e6e93ce831295d3a31f7b0f065590a1c44c179e..6e9374cb3ae00daa5e1f7f91312b75ceb0a4aab9 100644 --- a/lib/objects.py +++ b/lib/objects.py @@ -103,7 +103,7 @@ def FillIPolicy(default_ipolicy, custom_ipolicy, skip_keys=None): custom_ipolicy.get(key, {}), skip_keys=skip_keys) # list items - for key in [constants.ISPECS_DTS]: + for key in [constants.IPOLICY_DTS]: ret_dict[key] = list(custom_ipolicy.get(key, default_ipolicy[key])) return ret_dict @@ -182,7 +182,7 @@ def CreateIPolicyFromOpts(ispecs_mem_size=None, ispecs_disk_count=None, ispecs_disk_size=None, ispecs_nic_count=None, - ispecs_disk_templates=None, + ipolicy_disk_templates=None, group_ipolicy=False, allowed_values=None, fill_all=False): @@ -219,10 +219,10 @@ def CreateIPolicyFromOpts(ispecs_mem_size=None, ipolicy_out[key][name] = val # no filldict for lists - if not group_ipolicy and fill_all and ispecs_disk_templates is None: - ispecs_disk_templates = constants.DISK_TEMPLATES - if ispecs_disk_templates is not None: - ipolicy_out[constants.ISPECS_DTS] = list(ispecs_disk_templates) + if not group_ipolicy and fill_all and ipolicy_disk_templates is None: + ipolicy_disk_templates = constants.DISK_TEMPLATES + if ipolicy_disk_templates is not None: + ipolicy_out[constants.IPOLICY_DTS] = list(ipolicy_disk_templates) assert not (frozenset(ipolicy_out.keys()) - constants.IPOLICY_ALL_KEYS) @@ -887,8 +887,8 @@ class InstancePolicy(ConfigObject): """ for param in constants.ISPECS_PARAMETERS: InstancePolicy.CheckISpecSyntax(ipolicy, param) - if constants.ISPECS_DTS in ipolicy: - InstancePolicy.CheckDiskTemplates(ipolicy[constants.ISPECS_DTS]) + if constants.IPOLICY_DTS in ipolicy: + InstancePolicy.CheckDiskTemplates(ipolicy[constants.IPOLICY_DTS]) wrong_keys = frozenset(ipolicy.keys()) - constants.IPOLICY_ALL_KEYS if wrong_keys: raise errors.ConfigurationError("Invalid keys in ipolicy: %s" % diff --git a/man/gnt-cluster.rst b/man/gnt-cluster.rst index eaa41a854bd15b6667ea63b99a5c930c46ca092c..81a05b92bd6a41395c7017dc4507238d8129d4c0 100644 --- a/man/gnt-cluster.rst +++ b/man/gnt-cluster.rst @@ -193,7 +193,7 @@ INIT | [--specs-disk-size *spec-param*=*value* [,*spec-param*=*value*...]] | [--specs-mem-size *spec-param*=*value* [,*spec-param*=*value*...]] | [--specs-nic-count *spec-param*=*value* [,*spec-param*=*value*...]] -| [--specs-disk-templates *template* [,*template*...]] +| [--ipol-disk-templates *template* [,*template*...]] | [--disk-state *diskstate*] | [--hypervisor-state *hvstate*] | {*clustername*} @@ -487,12 +487,14 @@ The ``-C (--candidate-pool-size)`` option specifies the that the master will try to keep as master\_candidates. For more details about this role and other node roles, see the ganeti(7). -The ``--specs-...`` options specify instance policy on the -cluster. Except for the ``disk-templates`` option, each option can have -three values: ``min``, ``max`` and ``std``, which can also be modified -on group level (except for ``std``, which is defined once for the entire -cluster). Please note, that ``std`` values are not the same as defaults -set by ``--beparams``, but they are used for the capacity calculations. +The ``--specs-...`` and ``--ipol-disk-templates`` options specify +instance policy on the cluster. For the ``--specs-...`` options, each +option can have three values: ``min``, ``max`` and ``std``, which can +also be modified on group level (except for ``std``, which is defined +once for the entire cluster). Please note, that ``std`` values are not +the same as defaults set by ``--beparams``, but they are used for the +capacity calculations. The ``--ipol-disk-templates`` option takes a +comma-separated list of disk templates. - ``--specs-cpu-count`` limits the number of VCPUs that can be used by an instance. @@ -500,8 +502,7 @@ set by ``--beparams``, but they are used for the capacity calculations. - ``--specs-disk-size`` limits the disk size for every disk used - ``--specs-mem-size`` limits the amount of memory available - ``--specs-nic-count`` sets limits on the number of NICs used -- ``--specs-disk-templates`` limits the allowed disk templates (no - mix/std/max for this option) +- ``--ipol-disk-templates`` limits the allowed disk templates For details about how to use ``--hypervisor-state`` and ``--disk-state`` have a look at **ganeti**(7). @@ -573,7 +574,7 @@ MODIFY | [--specs-disk-size *spec-param*=*value* [,*spec-param*=*value*...]] | [--specs-mem-size *spec-param*=*value* [,*spec-param*=*value*...]] | [--specs-nic-count *spec-param*=*value* [,*spec-param*=*value*...]] -| [--specs-disk-templates *template* [,*template*...]] +| [--ipol-disk-templates *template* [,*template*...]] Modify the options for the cluster. @@ -610,7 +611,8 @@ The ``-I (--default-iallocator)`` is described in the **init** command. To clear the default iallocator, just pass an empty string (''). -The ``--specs-...`` options are described in the **init** command. +The ``--specs-...`` and ``--ipol-disk-templates`` options are described +in the **init** command. QUEUE ~~~~~ diff --git a/man/gnt-group.rst b/man/gnt-group.rst index a260e654709e64663e6bce511b73de8209034127..fdf7306635435fc8207b3b08711ca307aea18703 100644 --- a/man/gnt-group.rst +++ b/man/gnt-group.rst @@ -32,7 +32,7 @@ ADD | [--specs-disk-size *spec-param*=*value* [,*spec-param*=*value*...]] | [--specs-mem-size *spec-param*=*value* [,*spec-param*=*value*...]] | [--specs-nic-count *spec-param*=*value* [,*spec-param*=*value*...]] -| [--specs-disk-templates *template* [,*template*...]] +| [--ipol-disk-templates *template* [,*template*...]] | [--disk-state *diskstate*] | [--hypervisor-state *hvstate*] | {*group*} @@ -67,8 +67,9 @@ parameters for the node group; please see the section about **gnt-cluster add** in **gnt-cluster**(8) for more information about disk parameters -The ``--specs-...`` options specify instance policies on the node group, -and are documented in the **gnt-cluster**(8) man page. +The ``--specs-...`` and ``--ipol-disk-templates`` options specify +instance policies on the node group, and are documented in the +**gnt-cluster**(8) man page. ASSIGN-NODES ~~~~~~~~~~~~ @@ -100,7 +101,7 @@ MODIFY | [--specs-disk-size *spec-param*=*value* [,*spec-param*=*value*...]] | [--specs-mem-size *spec-param*=*value* [,*spec-param*=*value*...]] | [--specs-nic-count *spec-param*=*value* [,*spec-param*=*value*...]] -| [--specs-disk-templates *template* [,*template*...]] +| [--ipol-disk-templates *template* [,*template*...]] | {*group*} Modifies some parameters from the node group. @@ -113,8 +114,9 @@ The ``--node-parameters``, ``--alloc-policy``, ``-D (--disk-parameters)`` options are documented in the **add** command above. -The ``--specs-...`` options specify instance policies on the node group, -and are documented in the **gnt-cluster**(8) man page. +The ``--specs-...`` and ``--ipol-disk-templates`` options specify +instance policies on the node group, and are documented in the +**gnt-cluster**(8) man page. REMOVE ~~~~~~