Commit 0ce212e5 authored by Iustin Pop's avatar Iustin Pop

Move the instance specs options to cli.py

Currently these are defined twice, instead of a single time in
cli.py. Also adds the new disk_templates option to the common block,
even though it's not yet used.
Signed-off-by: default avatarIustin Pop <iustin@google.com>
Reviewed-by: default avatarRené Nussbaumer <rn@google.com>
parent 12c3d3f6
......@@ -194,6 +194,7 @@ __all__ = [
"DISK_STATE_OPT",
"HV_STATE_OPT",
"IGNORE_IPOLICY_OPT",
"INSTANCE_POLICY_OPTS",
# Generic functions for CLI programs
"ConfirmOperation",
"GenericMain",
......@@ -1388,6 +1389,16 @@ COMMON_CREATE_OPTS = [
PRIORITY_OPT,
]
# common instance policy options
INSTANCE_POLICY_OPTS = [
SPECS_CPU_COUNT_OPT,
SPECS_DISK_COUNT_OPT,
SPECS_DISK_SIZE_OPT,
SPECS_MEM_SIZE_OPT,
SPECS_NIC_COUNT_OPT,
SPECS_DISK_TEMPLATES,
]
def _ParseArgs(argv, commands, aliases, env_override):
"""Parser for the command line arguments.
......
......@@ -1444,14 +1444,6 @@ def Epo(opts, args):
else:
return _EpoOff(opts, node_list, inst_map)
INSTANCE_POLICY_OPTS = [
SPECS_CPU_COUNT_OPT,
SPECS_DISK_COUNT_OPT,
SPECS_DISK_SIZE_OPT,
SPECS_MEM_SIZE_OPT,
SPECS_NIC_COUNT_OPT,
]
commands = {
"init": (
InitCluster, [ArgHost(min=1, max=1)],
......
......@@ -277,14 +277,6 @@ def EvacuateGroup(opts, args):
return rcode
INSTANCE_POLICY_OPTS = [
SPECS_CPU_COUNT_OPT,
SPECS_DISK_COUNT_OPT,
SPECS_DISK_SIZE_OPT,
SPECS_MEM_SIZE_OPT,
SPECS_NIC_COUNT_OPT,
]
commands = {
"add": (
AddGroup, ARGS_ONE_GROUP,
......
......@@ -190,6 +190,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*...]]
| [--disk-state *diskstate*]
| [--hypervisor-state *hvstate*]
| {*clustername*}
......@@ -371,7 +372,7 @@ must be specified first, followed by a colon and by a comma-separated
list of key-value pairs. These parameters can only be specified at
cluster and node group level; the cluster-level parameter are inherited
by the node group at the moment of its creation, and can be further
modified at node group level using the **gnt-group**(8) command.
modified at node group level using the **gnt-group**(8) command.
The following is the list of disk parameters available for the **drbd**
template, with measurement units specified in square brackets at the end
......@@ -483,17 +484,21 @@ 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. 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``.
``--specs-cpu-count`` sets the number of VCPUs that can be used by an
instance.
``--specs-disk-count`` sets the number of disks
``--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 amount of nics used
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.
- ``--specs-cpu-count`` limits the number of VCPUs that can be used by an
instance.
- ``--specs-disk-count`` limits the number of disks
- ``--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)
For details about how to use ``--hypervisor-state`` and ``--disk-state``
have a look at **ganeti**(7).
......@@ -565,6 +570,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*...]]
Modify the options for the cluster.
......@@ -601,7 +607,7 @@ 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-...`` options are described in the **init** command.
QUEUE
~~~~~
......
......@@ -32,6 +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*...]]
| [--disk-state *diskstate*]
| [--hypervisor-state *hvstate*]
| {*group*}
......@@ -66,14 +67,8 @@ 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 policy on the cluster. Each
option can have two values: ``min`` and ``max``.
``--specs-cpu-count`` sets the number of VCPUs that can be used by an
instance.
``--specs-disk-count`` sets the number of disks
``--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 amount of nics used
The ``--specs-...`` options specify instance policies on the node group,
and are documented in the **gnt-cluster**(8) man page.
ASSIGN-NODES
~~~~~~~~~~~~
......@@ -105,6 +100,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*...]]
| {*group*}
Modifies some parameters from the node group.
......@@ -114,8 +110,11 @@ in the **add** command above. ``--hypervisor-state`` as well as
``--disk-state`` are documented in detail in **ganeti**(7).
The ``--node-parameters``, ``--alloc-policy``, ``-D
(--disk-parameters)`` and ``--specs-..`` options are documented in the
**add** command above.
(--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.
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