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

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__ = [ ...@@ -194,6 +194,7 @@ __all__ = [
"DISK_STATE_OPT", "DISK_STATE_OPT",
"HV_STATE_OPT", "HV_STATE_OPT",
"IGNORE_IPOLICY_OPT", "IGNORE_IPOLICY_OPT",
"INSTANCE_POLICY_OPTS",
# Generic functions for CLI programs # Generic functions for CLI programs
"ConfirmOperation", "ConfirmOperation",
"GenericMain", "GenericMain",
...@@ -1388,6 +1389,16 @@ COMMON_CREATE_OPTS = [ ...@@ -1388,6 +1389,16 @@ COMMON_CREATE_OPTS = [
PRIORITY_OPT, 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): def _ParseArgs(argv, commands, aliases, env_override):
"""Parser for the command line arguments. """Parser for the command line arguments.
......
...@@ -1444,14 +1444,6 @@ def Epo(opts, args): ...@@ -1444,14 +1444,6 @@ def Epo(opts, args):
else: else:
return _EpoOff(opts, node_list, inst_map) 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 = { commands = {
"init": ( "init": (
InitCluster, [ArgHost(min=1, max=1)], InitCluster, [ArgHost(min=1, max=1)],
......
...@@ -277,14 +277,6 @@ def EvacuateGroup(opts, args): ...@@ -277,14 +277,6 @@ def EvacuateGroup(opts, args):
return rcode 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 = { commands = {
"add": ( "add": (
AddGroup, ARGS_ONE_GROUP, AddGroup, ARGS_ONE_GROUP,
......
...@@ -190,6 +190,7 @@ INIT ...@@ -190,6 +190,7 @@ INIT
| [--specs-disk-size *spec-param*=*value* [,*spec-param*=*value*...]] | [--specs-disk-size *spec-param*=*value* [,*spec-param*=*value*...]]
| [--specs-mem-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-nic-count *spec-param*=*value* [,*spec-param*=*value*...]]
| [--specs-disk-templates *template* [,*template*...]]
| [--disk-state *diskstate*] | [--disk-state *diskstate*]
| [--hypervisor-state *hvstate*] | [--hypervisor-state *hvstate*]
| {*clustername*} | {*clustername*}
...@@ -483,17 +484,21 @@ The ``-C (--candidate-pool-size)`` option specifies the ...@@ -483,17 +484,21 @@ The ``-C (--candidate-pool-size)`` option specifies the
that the master will try to keep as master\_candidates. For more that the master will try to keep as master\_candidates. For more
details about this role and other node roles, see the ganeti(7). details about this role and other node roles, see the ganeti(7).
The ``--specs-..`` options specify instance policy on the cluster. Each The ``--specs-...`` options specify instance policy on the
option can have three values: ``min``, ``max`` and ``std``, which can cluster. Except for the ``disk-templates`` option, each option can have
also be modified on group level (except for ``std``, which is defined three values: ``min``, ``max`` and ``std``, which can also be modified
once for the entire cluster). Please note, that ``std`` values are not on group level (except for ``std``, which is defined once for the entire
the same as defaults set by ``--beparams``. cluster). Please note, that ``std`` values are not the same as defaults
``--specs-cpu-count`` sets the number of VCPUs that can be used by an set by ``--beparams``, but they are used for the capacity calculations.
instance.
``--specs-disk-count`` sets the number of disks - ``--specs-cpu-count`` limits the number of VCPUs that can be used by an
``--specs-disk-size`` limits the disk size for every disk used instance.
``--specs-mem-size`` limits the amount of memory available - ``--specs-disk-count`` limits the number of disks
``--specs-nic-count`` sets limits on the amount of nics used - ``--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`` For details about how to use ``--hypervisor-state`` and ``--disk-state``
have a look at **ganeti**(7). have a look at **ganeti**(7).
...@@ -565,6 +570,7 @@ MODIFY ...@@ -565,6 +570,7 @@ MODIFY
| [--specs-disk-size *spec-param*=*value* [,*spec-param*=*value*...]] | [--specs-disk-size *spec-param*=*value* [,*spec-param*=*value*...]]
| [--specs-mem-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-nic-count *spec-param*=*value* [,*spec-param*=*value*...]]
| [--specs-disk-templates *template* [,*template*...]]
Modify the options for the cluster. Modify the options for the cluster.
...@@ -601,7 +607,7 @@ The ``-I (--default-iallocator)`` is described in the **init** ...@@ -601,7 +607,7 @@ The ``-I (--default-iallocator)`` is described in the **init**
command. To clear the default iallocator, just pass an empty string 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 QUEUE
~~~~~ ~~~~~
......
...@@ -32,6 +32,7 @@ ADD ...@@ -32,6 +32,7 @@ ADD
| [--specs-disk-size *spec-param*=*value* [,*spec-param*=*value*...]] | [--specs-disk-size *spec-param*=*value* [,*spec-param*=*value*...]]
| [--specs-mem-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-nic-count *spec-param*=*value* [,*spec-param*=*value*...]]
| [--specs-disk-templates *template* [,*template*...]]
| [--disk-state *diskstate*] | [--disk-state *diskstate*]
| [--hypervisor-state *hvstate*] | [--hypervisor-state *hvstate*]
| {*group*} | {*group*}
...@@ -66,14 +67,8 @@ parameters for the node group; please see the section about ...@@ -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 **gnt-cluster add** in **gnt-cluster**(8) for more information about
disk parameters disk parameters
The ``--specs-..`` options specify instance policy on the cluster. Each The ``--specs-...`` options specify instance policies on the node group,
option can have two values: ``min`` and ``max``. and are documented in the **gnt-cluster**(8) man page.
``--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
ASSIGN-NODES ASSIGN-NODES
~~~~~~~~~~~~ ~~~~~~~~~~~~
...@@ -105,6 +100,7 @@ MODIFY ...@@ -105,6 +100,7 @@ MODIFY
| [--specs-disk-size *spec-param*=*value* [,*spec-param*=*value*...]] | [--specs-disk-size *spec-param*=*value* [,*spec-param*=*value*...]]
| [--specs-mem-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-nic-count *spec-param*=*value* [,*spec-param*=*value*...]]
| [--specs-disk-templates *template* [,*template*...]]
| {*group*} | {*group*}
Modifies some parameters from the node group. Modifies some parameters from the node group.
...@@ -114,8 +110,11 @@ in the **add** command above. ``--hypervisor-state`` as well as ...@@ -114,8 +110,11 @@ in the **add** command above. ``--hypervisor-state`` as well as
``--disk-state`` are documented in detail in **ganeti**(7). ``--disk-state`` are documented in detail in **ganeti**(7).
The ``--node-parameters``, ``--alloc-policy``, ``-D The ``--node-parameters``, ``--alloc-policy``, ``-D
(--disk-parameters)`` and ``--specs-..`` options are documented in the (--disk-parameters)`` options are documented in the **add** command
**add** command above. above.
The ``--specs-...`` options specify instance policies on the node group,
and are documented in the **gnt-cluster**(8) man page.
REMOVE 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