Commit d04c9d45 authored by Iustin Pop's avatar Iustin Pop

Rename ispecs-disk-templates to ipolicy-disk-templates

The ispecs (min/std/max) are different from the other ipolicy
variables (disk templates for now, more in the future). As such, let's
rename the ispecs-disk-templates to ipolicy-disk-templates for
consistency with this logical difference.
Signed-off-by: default avatarIustin Pop <iustin@google.com>
Reviewed-by: default avatarMichael Hanselmann <hansmi@google.com>
parent d62cbd3a
#
#
# 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,
]
......
......@@ -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
......
......@@ -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])
......
#
#
# 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
......
......@@ -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" %
......
......@@ -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
~~~~~
......
......@@ -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
~~~~~~
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment