Revision d04c9d45

b/lib/cli.py
1 1
#
2 2
#
3 3

  
4
# Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Google Inc.
4
# Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012 Google Inc.
5 5
#
6 6
# This program is free software; you can redistribute it and/or modify
7 7
# it under the terms of the GNU General Public License as published by
......
172 172
  "SPECS_DISK_SIZE_OPT",
173 173
  "SPECS_MEM_SIZE_OPT",
174 174
  "SPECS_NIC_COUNT_OPT",
175
  "SPECS_DISK_TEMPLATES",
175
  "IPOLICY_DISK_TEMPLATES",
176 176
  "SPICE_CACERT_OPT",
177 177
  "SPICE_CERT_OPT",
178 178
  "SRC_DIR_OPT",
......
805 805
                                 type="keyval", default={},
806 806
                                 help="NIC count specs: min, max, std")
807 807

  
808
SPECS_DISK_TEMPLATES = cli_option("--specs-disk-templates",
809
                                  dest="ispecs_disk_templates",
810
                                  type="list", default=None,
811
                                  help="Comma-separated list of"
812
                                  " enabled disk templates")
808
IPOLICY_DISK_TEMPLATES = cli_option("--ipolicy-disk-templates",
809
                                 dest="ipolicy_disk_templates",
810
                                 type="list", default=None,
811
                                 help="Comma-separated list of"
812
                                 " enabled disk templates")
813 813

  
814 814
HYPERVISOR_OPT = cli_option("-H", "--hypervisor-parameters", dest="hypervisor",
815 815
                            help="Hypervisor and hypervisor options, in the"
......
1401 1401
  SPECS_DISK_SIZE_OPT,
1402 1402
  SPECS_MEM_SIZE_OPT,
1403 1403
  SPECS_NIC_COUNT_OPT,
1404
  SPECS_DISK_TEMPLATES,
1404
  IPOLICY_DISK_TEMPLATES,
1405 1405
  ]
1406 1406

  
1407 1407

  
b/lib/client/gnt_cluster.py
143 143
    utils.ForceDictType(diskparams[templ], constants.DISK_DT_TYPES)
144 144

  
145 145
  # prepare ipolicy dict
146
  ispecs_dts = opts.ispecs_disk_templates # hate long var names
146
  ispecs_dts = opts.ipolicy_disk_templates # hate long var names
147 147
  ipolicy_raw = \
148 148
    objects.CreateIPolicyFromOpts(ispecs_mem_size=opts.ispecs_mem_size,
149 149
                                  ispecs_cpu_count=opts.ispecs_cpu_count,
150 150
                                  ispecs_disk_count=opts.ispecs_disk_count,
151 151
                                  ispecs_disk_size=opts.ispecs_disk_size,
152 152
                                  ispecs_nic_count=opts.ispecs_nic_count,
153
                                  ispecs_disk_templates=ispecs_dts,
153
                                  ipolicy_disk_templates=ispecs_dts,
154 154
                                  fill_all=True)
155 155
  ipolicy = objects.FillIPolicy(constants.IPOLICY_DEFAULTS, ipolicy_raw)
156 156

  
......
467 467
    ToStdout("  - %s", key)
468 468
    _PrintGroupedParams(result["ipolicy"][key], roman=opts.roman_integers)
469 469
  ToStdout("  - enabled disk templates: %s",
470
           utils.CommaJoin(result["ipolicy"][constants.ISPECS_DTS]))
470
           utils.CommaJoin(result["ipolicy"][constants.IPOLICY_DTS]))
471 471

  
472 472
  return 0
473 473

  
......
995 995
  if ndparams is not None:
996 996
    utils.ForceDictType(ndparams, constants.NDS_PARAMETER_TYPES)
997 997

  
998
  ispecs_dts = opts.ispecs_disk_templates
998
  ispecs_dts = opts.ipolicy_disk_templates
999 999
  ipolicy = \
1000 1000
    objects.CreateIPolicyFromOpts(ispecs_mem_size=opts.ispecs_mem_size,
1001 1001
                                  ispecs_cpu_count=opts.ispecs_cpu_count,
1002 1002
                                  ispecs_disk_count=opts.ispecs_disk_count,
1003 1003
                                  ispecs_disk_size=opts.ispecs_disk_size,
1004 1004
                                  ispecs_nic_count=opts.ispecs_nic_count,
1005
                                  ispecs_disk_templates=ispecs_dts)
1005
                                  ipolicy_disk_templates=ispecs_dts)
1006 1006

  
1007 1007
  mnh = opts.maintain_node_health
1008 1008

  
b/lib/client/gnt_group.py
190 190
    ispecs_disk_count=opts.ispecs_disk_count,
191 191
    ispecs_disk_size=opts.ispecs_disk_size,
192 192
    ispecs_nic_count=opts.ispecs_nic_count,
193
    ispecs_disk_templates=opts.ispecs_disk_templates,
193
    ipolicy_disk_templates=opts.ipolicy_disk_templates,
194 194
    group_ipolicy=True,
195 195
    allowed_values=[constants.VALUE_DEFAULT])
196 196

  
b/lib/constants.py
1 1
#
2 2
#
3 3

  
4
# Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Google Inc.
4
# Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012 Google Inc.
5 5
#
6 6
# This program is free software; you can redistribute it and/or modify
7 7
# it under the terms of the GNU General Public License as published by
......
949 949
ISPECS_MIN = "min"
950 950
ISPECS_MAX = "max"
951 951
ISPECS_STD = "std"
952
ISPECS_DTS = "disk_templates"
952
IPOLICY_DTS = "disk_templates"
953 953

  
954 954
IPOLICY_PARAMETERS = frozenset([
955 955
  ISPECS_MIN,
956 956
  ISPECS_MAX,
957 957
  ISPECS_STD,
958 958
  ])
959
IPOLICY_ALL_KEYS = IPOLICY_PARAMETERS.union([ISPECS_DTS])
959
IPOLICY_ALL_KEYS = IPOLICY_PARAMETERS.union([IPOLICY_DTS])
960 960

  
961 961
# Node parameter names
962 962
ND_OOB_PROGRAM = "oob_program"
......
1906 1906
    ISPEC_DISK_SIZE: 1024,
1907 1907
    ISPEC_NIC_COUNT: 1,
1908 1908
    },
1909
  ISPECS_DTS: DISK_TEMPLATES,
1909
  IPOLICY_DTS: DISK_TEMPLATES,
1910 1910
  }
1911 1911

  
1912 1912
MASTER_POOL_SIZE_DEFAULT = 10
b/lib/objects.py
103 103
                             custom_ipolicy.get(key, {}),
104 104
                             skip_keys=skip_keys)
105 105
  # list items
106
  for key in [constants.ISPECS_DTS]:
106
  for key in [constants.IPOLICY_DTS]:
107 107
    ret_dict[key] = list(custom_ipolicy.get(key, default_ipolicy[key]))
108 108

  
109 109
  return ret_dict
......
182 182
                          ispecs_disk_count=None,
183 183
                          ispecs_disk_size=None,
184 184
                          ispecs_nic_count=None,
185
                          ispecs_disk_templates=None,
185
                          ipolicy_disk_templates=None,
186 186
                          group_ipolicy=False,
187 187
                          allowed_values=None,
188 188
                          fill_all=False):
......
219 219
      ipolicy_out[key][name] = val
220 220

  
221 221
  # no filldict for lists
222
  if not group_ipolicy and fill_all and ispecs_disk_templates is None:
223
    ispecs_disk_templates = constants.DISK_TEMPLATES
224
  if ispecs_disk_templates is not None:
225
    ipolicy_out[constants.ISPECS_DTS] = list(ispecs_disk_templates)
222
  if not group_ipolicy and fill_all and ipolicy_disk_templates is None:
223
    ipolicy_disk_templates = constants.DISK_TEMPLATES
224
  if ipolicy_disk_templates is not None:
225
    ipolicy_out[constants.IPOLICY_DTS] = list(ipolicy_disk_templates)
226 226

  
227 227
  assert not (frozenset(ipolicy_out.keys()) - constants.IPOLICY_ALL_KEYS)
228 228

  
......
887 887
    """
888 888
    for param in constants.ISPECS_PARAMETERS:
889 889
      InstancePolicy.CheckISpecSyntax(ipolicy, param)
890
    if constants.ISPECS_DTS in ipolicy:
891
      InstancePolicy.CheckDiskTemplates(ipolicy[constants.ISPECS_DTS])
890
    if constants.IPOLICY_DTS in ipolicy:
891
      InstancePolicy.CheckDiskTemplates(ipolicy[constants.IPOLICY_DTS])
892 892
    wrong_keys = frozenset(ipolicy.keys()) - constants.IPOLICY_ALL_KEYS
893 893
    if wrong_keys:
894 894
      raise errors.ConfigurationError("Invalid keys in ipolicy: %s" %
b/man/gnt-cluster.rst
193 193
| [--specs-disk-size *spec-param*=*value* [,*spec-param*=*value*...]]
194 194
| [--specs-mem-size *spec-param*=*value* [,*spec-param*=*value*...]]
195 195
| [--specs-nic-count *spec-param*=*value* [,*spec-param*=*value*...]]
196
| [--specs-disk-templates *template* [,*template*...]]
196
| [--ipol-disk-templates *template* [,*template*...]]
197 197
| [--disk-state *diskstate*]
198 198
| [--hypervisor-state *hvstate*]
199 199
| {*clustername*}
......
487 487
that the master will try to keep as master\_candidates. For more
488 488
details about this role and other node roles, see the ganeti(7).
489 489

  
490
The ``--specs-...`` options specify instance policy on the
491
cluster. Except for the ``disk-templates`` option, each option can have
492
three values: ``min``, ``max`` and ``std``, which can also be modified
493
on group level (except for ``std``, which is defined once for the entire
494
cluster). Please note, that ``std`` values are not the same as defaults
495
set by ``--beparams``, but they are used for the capacity calculations.
490
The ``--specs-...`` and ``--ipol-disk-templates`` options specify
491
instance policy on the cluster. For the ``--specs-...`` options, each
492
option can have three values: ``min``, ``max`` and ``std``, which can
493
also be modified on group level (except for ``std``, which is defined
494
once for the entire cluster). Please note, that ``std`` values are not
495
the same as defaults set by ``--beparams``, but they are used for the
496
capacity calculations. The ``--ipol-disk-templates`` option takes a
497
comma-separated list of disk templates.
496 498

  
497 499
- ``--specs-cpu-count`` limits the number of VCPUs that can be used by an
498 500
  instance.
......
500 502
- ``--specs-disk-size`` limits the disk size for every disk used
501 503
- ``--specs-mem-size`` limits the amount of memory available
502 504
- ``--specs-nic-count`` sets limits on the number of NICs used
503
- ``--specs-disk-templates`` limits the allowed disk templates (no
504
  mix/std/max for this option)
505
- ``--ipol-disk-templates`` limits the allowed disk templates
505 506

  
506 507
For details about how to use ``--hypervisor-state`` and ``--disk-state``
507 508
have a look at **ganeti**(7).
......
573 574
| [--specs-disk-size *spec-param*=*value* [,*spec-param*=*value*...]]
574 575
| [--specs-mem-size *spec-param*=*value* [,*spec-param*=*value*...]]
575 576
| [--specs-nic-count *spec-param*=*value* [,*spec-param*=*value*...]]
576
| [--specs-disk-templates *template* [,*template*...]]
577
| [--ipol-disk-templates *template* [,*template*...]]
577 578

  
578 579

  
579 580
Modify the options for the cluster.
......
610 611
command. To clear the default iallocator, just pass an empty string
611 612
('').
612 613

  
613
The ``--specs-...`` options are described in the **init** command.
614
The ``--specs-...`` and ``--ipol-disk-templates`` options are described
615
in the **init** command.
614 616

  
615 617
QUEUE
616 618
~~~~~
b/man/gnt-group.rst
32 32
| [--specs-disk-size *spec-param*=*value* [,*spec-param*=*value*...]]
33 33
| [--specs-mem-size *spec-param*=*value* [,*spec-param*=*value*...]]
34 34
| [--specs-nic-count *spec-param*=*value* [,*spec-param*=*value*...]]
35
| [--specs-disk-templates *template* [,*template*...]]
35
| [--ipol-disk-templates *template* [,*template*...]]
36 36
| [--disk-state *diskstate*]
37 37
| [--hypervisor-state *hvstate*]
38 38
| {*group*}
......
67 67
**gnt-cluster add** in **gnt-cluster**(8) for more information about
68 68
disk parameters
69 69

  
70
The ``--specs-...`` options specify instance policies on the node group,
71
and are documented in the **gnt-cluster**(8) man page.
70
The ``--specs-...`` and ``--ipol-disk-templates`` options specify
71
instance policies on the node group, and are documented in the
72
**gnt-cluster**(8) man page.
72 73

  
73 74
ASSIGN-NODES
74 75
~~~~~~~~~~~~
......
100 101
| [--specs-disk-size *spec-param*=*value* [,*spec-param*=*value*...]]
101 102
| [--specs-mem-size *spec-param*=*value* [,*spec-param*=*value*...]]
102 103
| [--specs-nic-count *spec-param*=*value* [,*spec-param*=*value*...]]
103
| [--specs-disk-templates *template* [,*template*...]]
104
| [--ipol-disk-templates *template* [,*template*...]]
104 105
| {*group*}
105 106

  
106 107
Modifies some parameters from the node group.
......
113 114
(--disk-parameters)`` options are documented in the **add** command
114 115
above.
115 116

  
116
The ``--specs-...`` options specify instance policies on the node group,
117
and are documented in the **gnt-cluster**(8) man page.
117
The ``--specs-...`` and ``--ipol-disk-templates`` options specify
118
instance policies on the node group, and are documented in the
119
**gnt-cluster**(8) man page.
118 120

  
119 121
REMOVE
120 122
~~~~~~

Also available in: Unified diff