Commit 085e0d9f authored by René Nussbaumer's avatar René Nussbaumer
Browse files

gnt-node: Add hv/disk state to add


Signed-off-by: default avatarRené Nussbaumer <rn@google.com>
Reviewed-by: default avatarMichael Hanselmann <hansmi@google.com>
parent e4c03256
......@@ -216,10 +216,19 @@ def AddNode(opts, args):
bootstrap.SetupNodeDaemon(cluster_name, node, opts.ssh_key_check)
if opts.disk_state:
disk_state = utils.FlatToDict(opts.disk_state)
else:
disk_state = {}
hv_state = dict(opts.hv_state)
op = opcodes.OpNodeAdd(node_name=args[0], secondary_ip=sip,
readd=opts.readd, group=opts.nodegroup,
vm_capable=opts.vm_capable, ndparams=opts.ndparams,
master_capable=opts.master_capable)
master_capable=opts.master_capable,
disk_state=disk_state,
hv_state=hv_state)
SubmitOpCode(op, opts=opts)
......@@ -868,7 +877,8 @@ commands = {
AddNode, [ArgHost(min=1, max=1)],
[SECONDARY_IP_OPT, READD_OPT, NOSSH_KEYCHECK_OPT, NODE_FORCE_JOIN_OPT,
NONODE_SETUP_OPT, VERBOSE_OPT, NODEGROUP_OPT, PRIORITY_OPT,
CAPAB_MASTER_OPT, CAPAB_VM_OPT, NODE_PARAMS_OPT],
CAPAB_MASTER_OPT, CAPAB_VM_OPT, NODE_PARAMS_OPT, HV_STATE_OPT,
DISK_STATE_OPT],
"[-s ip] [--readd] [--no-ssh-key-check] [--force-join]"
" [--no-node-setup] [--verbose]"
" <node_name>",
......
......@@ -5377,6 +5377,12 @@ class LUNodeAdd(LogicalUnit):
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)
if self.op.disk_state:
self.new_disk_state = _MergeAndVerifyDiskState(self.op.disk_state, None)
def Exec(self, feedback_fn):
"""Adds the new node to the cluster.
 
......@@ -5415,6 +5421,12 @@ class LUNodeAdd(LogicalUnit):
else:
new_node.ndparams = {}
 
if self.op.hv_state:
new_node.hv_state_static = self.new_hv_state
if self.op.disk_state:
new_node.disk_state_static = self.new_disk_state
# check connectivity
result = self.rpc.call_version([node])[node]
result.Raise("Can't get version information from node %s" % node)
......
......@@ -932,6 +932,8 @@ class OpNodeAdd(OpCode):
OP_DSC_FIELD = "node_name"
OP_PARAMS = [
_PNodeName,
_PHvState,
_PDiskState,
("primary_ip", None, ht.NoType, "Primary IP address"),
("secondary_ip", None, ht.TMaybeString, "Secondary IP address"),
("readd", False, ht.TBool, "Whether node is re-added to cluster"),
......
......@@ -27,6 +27,8 @@ ADD
| [{-g|--node-group} *nodegroup*]
| [--master-capable=``yes|no``] [--vm-capable=``yes|no``]
| [--node-parameters *ndparams*]
| [--disk-state *diskstate*]
| [--hypervisor-state *hvstate*]
| {*nodename*}
Adds the given node to the cluster.
......@@ -58,9 +60,9 @@ The ``-g (--node-group)`` option is used to add the new node into a
specific node group, specified by UUID or name. If only one node group
exists you can skip this option, otherwise it's mandatory.
The ``vm_capable``, ``master_capable`` and ``ndparams`` options are
described in **ganeti**(7), and are used to set the properties of the
new node.
The ``vm_capable``, ``master_capable``, ``ndparams``, ``diskstate`` and
``hvstate`` options are described in **ganeti**(7), and are used to set
the properties of the new node.
Example::
......
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