Revision e4c03256

b/lib/client/gnt_group.py
60 60

  
61 61
  (group_name,) = args
62 62
  diskparams = dict(opts.diskparams)
63

  
64
  if opts.disk_state:
65
    disk_state = utils.FlatToDict(opts.disk_state)
66
  else:
67
    disk_state = {}
68
  hv_state = dict(opts.hv_state)
69

  
63 70
  op = opcodes.OpGroupAdd(group_name=group_name, ndparams=opts.ndparams,
64 71
                          alloc_policy=opts.alloc_policy,
65
                          diskparams=diskparams, ipolicy=ipolicy)
72
                          diskparams=diskparams, ipolicy=ipolicy,
73
                          hv_state=hv_state,
74
                          disk_state=disk_state)
66 75
  SubmitOpCode(op, opts=opts)
67 76

  
68 77

  
......
279 288
commands = {
280 289
  "add": (
281 290
    AddGroup, ARGS_ONE_GROUP,
282
    [DRY_RUN_OPT, ALLOC_POLICY_OPT, NODE_PARAMS_OPT, DISK_PARAMS_OPT] +
283
    INSTANCE_POLICY_OPTS,
291
    [DRY_RUN_OPT, ALLOC_POLICY_OPT, NODE_PARAMS_OPT, DISK_PARAMS_OPT,
292
     HV_STATE_OPT, DISK_STATE_OPT] + INSTANCE_POLICY_OPTS,
284 293
    "<group_name>", "Add a new node group to the cluster"),
285 294
  "assign-nodes": (
286 295
    AssignNodes, ARGS_ONE_GROUP + ARGS_MANY_NODES, [DRY_RUN_OPT, FORCE_OPT],
b/lib/cmdlib.py
12786 12786
    if self.op.ndparams:
12787 12787
      utils.ForceDictType(self.op.ndparams, constants.NDS_PARAMETER_TYPES)
12788 12788

  
12789
    if self.op.hv_state:
12790
      self.new_hv_state = _MergeAndVerifyHvState(self.op.hv_state, None)
12791
    else:
12792
      self.new_hv_state = None
12793

  
12794
    if self.op.disk_state:
12795
      self.new_disk_state = _MergeAndVerifyDiskState(self.op.disk_state, None)
12796
    else:
12797
      self.new_disk_state = None
12798

  
12789 12799
    if self.op.diskparams:
12790 12800
      for templ in constants.DISK_TEMPLATES:
12791 12801
        if templ not in self.op.diskparams:
......
12823 12833
                                  alloc_policy=self.op.alloc_policy,
12824 12834
                                  ndparams=self.op.ndparams,
12825 12835
                                  diskparams=self.op.diskparams,
12826
                                  ipolicy=self.op.ipolicy)
12836
                                  ipolicy=self.op.ipolicy,
12837
                                  hv_state_static=self.new_hv_state,
12838
                                  disk_state_static=self.new_disk_state)
12827 12839

  
12828 12840
    self.cfg.AddNodeGroup(group_obj, self.proc.GetECId(), check_uuid=False)
12829 12841
    del self.remove_locks[locking.LEVEL_NODEGROUP]
b/lib/opcodes.py
1413 1413
    _PNodeGroupAllocPolicy,
1414 1414
    _PGroupNodeParams,
1415 1415
    _PDiskParams,
1416
    _PHvState,
1417
    _PDiskState,
1416 1418
    ("ipolicy", None, ht.TMaybeDict, "Group-wide instance policy specs"),
1417 1419
    ]
1418 1420

  
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
| [--disk-state *diskstate*]
36
| [--hypervisor-state *hvstate*]
35 37
| {*group*}
36 38

  
37 39
Creates a new group with the given name. The node group will be
......
39 41

  
40 42
The ``--node-parameters`` option allows you to set default node
41 43
parameters for nodes in the group. Please see **ganeti**(7) for more
42
information about supported key=value pairs.
44
information about supported key=value pairs and their corresponding
45
options.
43 46

  
44 47
The ``--alloc-policy`` option allows you to set an allocation policy for
45 48
the group at creation time. Possible values are:

Also available in: Unified diff