(group_name,) = args
diskparams = dict(opts.diskparams)
+
+ if opts.disk_state:
+ disk_state = utils.FlatToDict(opts.disk_state)
+ else:
+ disk_state = {}
+ hv_state = dict(opts.hv_state)
+
op = opcodes.OpGroupAdd(group_name=group_name, ndparams=opts.ndparams,
alloc_policy=opts.alloc_policy,
- diskparams=diskparams, ipolicy=ipolicy)
+ diskparams=diskparams, ipolicy=ipolicy,
+ hv_state=hv_state,
+ disk_state=disk_state)
SubmitOpCode(op, opts=opts)
commands = {
"add": (
AddGroup, ARGS_ONE_GROUP,
- [DRY_RUN_OPT, ALLOC_POLICY_OPT, NODE_PARAMS_OPT, DISK_PARAMS_OPT] +
- INSTANCE_POLICY_OPTS,
+ [DRY_RUN_OPT, ALLOC_POLICY_OPT, NODE_PARAMS_OPT, DISK_PARAMS_OPT,
+ HV_STATE_OPT, DISK_STATE_OPT] + INSTANCE_POLICY_OPTS,
"<group_name>", "Add a new node group to the cluster"),
"assign-nodes": (
AssignNodes, ARGS_ONE_GROUP + ARGS_MANY_NODES, [DRY_RUN_OPT, FORCE_OPT],
if self.op.ndparams:
utils.ForceDictType(self.op.ndparams, constants.NDS_PARAMETER_TYPES)
+ if self.op.hv_state:
+ self.new_hv_state = _MergeAndVerifyHvState(self.op.hv_state, None)
+ else:
+ self.new_hv_state = None
+
+ if self.op.disk_state:
+ self.new_disk_state = _MergeAndVerifyDiskState(self.op.disk_state, None)
+ else:
+ self.new_disk_state = None
+
if self.op.diskparams:
for templ in constants.DISK_TEMPLATES:
if templ not in self.op.diskparams:
alloc_policy=self.op.alloc_policy,
ndparams=self.op.ndparams,
diskparams=self.op.diskparams,
- ipolicy=self.op.ipolicy)
+ ipolicy=self.op.ipolicy,
+ hv_state_static=self.new_hv_state,
+ disk_state_static=self.new_disk_state)
self.cfg.AddNodeGroup(group_obj, self.proc.GetECId(), check_uuid=False)
del self.remove_locks[locking.LEVEL_NODEGROUP]
_PNodeGroupAllocPolicy,
_PGroupNodeParams,
_PDiskParams,
+ _PHvState,
+ _PDiskState,
("ipolicy", None, ht.TMaybeDict, "Group-wide instance policy specs"),
]
| [--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*...]]
+| [--disk-state *diskstate*]
+| [--hypervisor-state *hvstate*]
| {*group*}
Creates a new group with the given name. The node group will be
The ``--node-parameters`` option allows you to set default node
parameters for nodes in the group. Please see **ganeti**(7) for more
-information about supported key=value pairs.
+information about supported key=value pairs and their corresponding
+options.
The ``--alloc-policy`` option allows you to set an allocation policy for
the group at creation time. Possible values are: