Revision 5fbbd028
b/lib/cli.py | ||
---|---|---|
99 | 99 |
"NIC_PARAMS_OPT", |
100 | 100 |
"NODE_LIST_OPT", |
101 | 101 |
"NODE_PLACEMENT_OPT", |
102 |
"NODEGROUP_OPT", |
|
102 | 103 |
"NODRBD_STORAGE_OPT", |
103 | 104 |
"NOHDR_OPT", |
104 | 105 |
"NOIPCHECK_OPT", |
... | ... | |
737 | 738 |
" times, if not given defaults to all nodes)", |
738 | 739 |
completion_suggest=OPT_COMPL_ONE_NODE) |
739 | 740 |
|
741 |
NODEGROUP_OPT = cli_option("-g", "--nodegroup", |
|
742 |
dest="nodegroup", |
|
743 |
help="Node group (name or uuid)", |
|
744 |
metavar="<nodegroup>", |
|
745 |
default=None, type="string", |
|
746 |
completion_suggest=OPT_COMPL_ONE_NODEGROUP) |
|
747 |
|
|
740 | 748 |
SINGLE_NODE_OPT = cli_option("-n", "--node", dest="node", help="Target node", |
741 | 749 |
metavar="<node>", |
742 | 750 |
completion_suggest=OPT_COMPL_ONE_NODE) |
b/lib/cmdlib.py | ||
---|---|---|
3668 | 3668 |
("primary_ip", None, _NoType), |
3669 | 3669 |
("secondary_ip", None, _TMaybeString), |
3670 | 3670 |
("readd", False, _TBool), |
3671 |
("nodegroup", None, _TMaybeString) |
|
3671 | 3672 |
] |
3672 | 3673 |
|
3673 | 3674 |
def CheckArguments(self): |
... | ... | |
3676 | 3677 |
self.hostname = netutils.GetHostname(name=self.op.node_name, |
3677 | 3678 |
family=self.primary_ip_family) |
3678 | 3679 |
self.op.node_name = self.hostname.name |
3680 |
if self.op.readd and self.op.nodegroup: |
|
3681 |
raise errors.OpPrereqError("Cannot pass a nodegroup when a node is" |
|
3682 |
" being readded", errors.ECODE_INVAL) |
|
3679 | 3683 |
|
3680 | 3684 |
def BuildHooksEnv(self): |
3681 | 3685 |
"""Build hooks env. |
... | ... | |
3790 | 3794 |
self.new_node = self.cfg.GetNodeInfo(node) |
3791 | 3795 |
assert self.new_node is not None, "Can't retrieve locked node %s" % node |
3792 | 3796 |
else: |
3793 |
# TODO: process an arbitrary non-default nodegroup |
|
3794 |
nodegroup = cfg.LookupNodeGroup(None) |
|
3797 |
nodegroup = cfg.LookupNodeGroup(self.op.nodegroup) |
|
3795 | 3798 |
self.new_node = objects.Node(name=node, |
3796 | 3799 |
primary_ip=primary_ip, |
3797 | 3800 |
secondary_ip=secondary_ip, |
b/lib/opcodes.py | ||
---|---|---|
363 | 363 |
""" |
364 | 364 |
OP_ID = "OP_NODE_ADD" |
365 | 365 |
OP_DSC_FIELD = "node_name" |
366 |
__slots__ = ["node_name", "primary_ip", "secondary_ip", "readd"] |
|
366 |
__slots__ = ["node_name", "primary_ip", "secondary_ip", "readd", "nodegroup"]
|
|
367 | 367 |
|
368 | 368 |
|
369 | 369 |
class OpQueryNodes(OpCode): |
b/man/gnt-node.sgml | ||
---|---|---|
64 | 64 |
<command>add</command> |
65 | 65 |
<arg>--readd</arg> |
66 | 66 |
<arg>-s <replaceable>secondary_ip</replaceable></arg> |
67 |
<arg>-g <replaceable>nodegroup</replaceable></arg> |
|
67 | 68 |
<arg choice="req"><replaceable>nodename</replaceable></arg> |
68 | 69 |
</cmdsynopsis> |
69 | 70 |
|
... | ... | |
104 | 105 |
</para> |
105 | 106 |
|
106 | 107 |
<para> |
108 |
The <option>-g</option> is used to add the new node into a specific |
|
109 |
node group, specified by uuid or name. If only one node group exists |
|
110 |
you can skip this option, otherwise it's mandatory. |
|
111 |
</para> |
|
112 |
|
|
113 |
<para> |
|
107 | 114 |
Example: |
108 | 115 |
<screen> |
109 | 116 |
# gnt-node add node5.example.com |
110 | 117 |
# gnt-node add -s 192.0.2.5 node5.example.com |
118 |
# gnt-node add -g group2 -s 192.0.2.9 node9.group2.example.com |
|
111 | 119 |
</screen> |
112 | 120 |
</para> |
113 | 121 |
</refsect2> |
b/scripts/gnt-node | ||
---|---|---|
214 | 214 |
bootstrap.SetupNodeDaemon(cluster_name, node, opts.ssh_key_check) |
215 | 215 |
|
216 | 216 |
op = opcodes.OpAddNode(node_name=args[0], secondary_ip=sip, |
217 |
readd=opts.readd) |
|
217 |
readd=opts.readd, nodegroup=opts.nodegroup)
|
|
218 | 218 |
SubmitOpCode(op, opts=opts) |
219 | 219 |
|
220 | 220 |
|
... | ... | |
674 | 674 |
'add': ( |
675 | 675 |
AddNode, [ArgHost(min=1, max=1)], |
676 | 676 |
[SECONDARY_IP_OPT, READD_OPT, NOSSH_KEYCHECK_OPT, NONODE_SETUP_OPT, |
677 |
VERBOSE_OPT], |
|
677 |
VERBOSE_OPT, NODEGROUP_OPT],
|
|
678 | 678 |
"[-s ip] [--readd] [--no-ssh-key-check] [--no-node-setup] [--verbose] " |
679 | 679 |
" <node_name>", |
680 | 680 |
"Add a node to the cluster"), |
Also available in: Unified diff