Revision b31c8676 scripts/gnt-node
b/scripts/gnt-node | ||
---|---|---|
365 | 365 |
return 0 |
366 | 366 |
|
367 | 367 |
|
368 |
def SetNodeParams(opts, args): |
|
369 |
"""Modifies a node. |
|
370 |
|
|
371 |
@param opts: the command line options selected by the user |
|
372 |
@type args: list |
|
373 |
@param args: should contain only one element, the node name |
|
374 |
@rtype: int |
|
375 |
@return: the desired exit code |
|
376 |
|
|
377 |
""" |
|
378 |
if opts.master_candidate is None: |
|
379 |
ToStderr("Please give at least one of the parameters.") |
|
380 |
return 1 |
|
381 |
|
|
382 |
candidate = opts.master_candidate == 'yes' |
|
383 |
op = opcodes.OpSetNodeParams(node_name=args[0], |
|
384 |
master_candidate=candidate, |
|
385 |
force=opts.force) |
|
386 |
|
|
387 |
# even if here we process the result, we allow submit only |
|
388 |
result = SubmitOrSend(op, opts) |
|
389 |
|
|
390 |
if result: |
|
391 |
ToStdout("Modified node %s", args[0]) |
|
392 |
for param, data in result: |
|
393 |
ToStdout(" - %-5s -> %s", param, data) |
|
394 |
return 0 |
|
395 |
|
|
396 |
|
|
368 | 397 |
commands = { |
369 | 398 |
'add': (AddNode, ARGS_ONE, |
370 | 399 |
[DEBUG_OPT, |
... | ... | |
408 | 437 |
" The default field list is" |
409 | 438 |
" (in order): %s." % ", ".join(_LIST_DEF_FIELDS), |
410 | 439 |
), |
440 |
'modify': (SetNodeParams, ARGS_ONE, |
|
441 |
[DEBUG_OPT, FORCE_OPT, |
|
442 |
SUBMIT_OPT, |
|
443 |
make_option("-C", "--master-candidate", dest="master_candidate", |
|
444 |
choices=('yes', 'no'), default=None, |
|
445 |
help="Set the master_candidate flag on the node"), |
|
446 |
], |
|
447 |
"<instance>", "Alters the parameters of an instance"), |
|
411 | 448 |
'remove': (RemoveNode, ARGS_ONE, [DEBUG_OPT], |
412 | 449 |
"<node_name>", "Removes a node from the cluster"), |
413 | 450 |
'volumes': (ListVolumes, ARGS_ANY, |
Also available in: Unified diff