Revision 66e884e1

b/doc/design-2.3.rst
52 52
commands and flags will be introduced::
53 53

  
54 54
  gnt-group add <group> # add a new node group
55
  gnt-group del <group> # delete an empty node group
55
  gnt-group remove <group> # delete an empty node group
56 56
  gnt-group list # list node groups
57 57
  gnt-group rename <oldname> <newname> # rename a node group
58 58
  gnt-node {list,info} -g <group> # list only nodes belonging to a node group
b/lib/client/gnt_group.py
26 26

  
27 27
from ganeti.cli import *
28 28
from ganeti import compat
29
from ganeti import opcodes
29 30
from ganeti import utils
30 31

  
31 32

  
......
42 43
}
43 44

  
44 45

  
46
def AddGroup(opts, args):
47
  """Add a node group to the cluster.
48

  
49
  @param opts: the command line options selected by the user
50
  @type args: list
51
  @param args: a list of length 1 with the name of the group to create
52
  @rtype: int
53
  @return: the desired exit code
54

  
55
  """
56
  (group_name,) = args
57
  op = opcodes.OpAddGroup(group_name=group_name)
58
  SubmitOpCode(op, opts=opts)
59

  
60

  
45 61
def ListGroups(opts, args):
46 62
  """List node groups and their properties.
47 63

  
......
89 105
  return 0
90 106

  
91 107

  
108
def RemoveGroup(opts, args):
109
  """Remove a node group from the cluster.
110

  
111
  @param opts: the command line options selected by the user
112
  @type args: list
113
  @param args: a list of length 1 with the name of the group to remove
114
  @rtype: int
115
  @return: the desired exit code
116

  
117
  """
118
  (group_name,) = args
119
  op = opcodes.OpRemoveGroup(group_name=group_name)
120
  SubmitOpCode(op, opts=opts)
121

  
122

  
123
def RenameGroup(opts, args):
124
  """Rename a node group.
125

  
126
  @param opts: the command line options selected by the user
127
  @type args: list
128
  @param args: a list of length 2, [old_name, new_name]
129
  @rtype: int
130
  @return: the desired exit code
131

  
132
  """
133
  old_name, new_name = args
134
  op = opcodes.OpRenameGroup(old_name=old_name, new_name=new_name)
135
  SubmitOpCode(op, opts=opts)
136

  
137

  
92 138
commands = {
139
  "add": (
140
    AddGroup, ARGS_ONE_GROUP, [DRY_RUN_OPT],
141
    "<group_name>", "Add a new node group to the cluster"),
93 142
  "list": (
94 143
    ListGroups, ARGS_MANY_GROUPS,
95 144
    [NOHDR_OPT, SEP_OPT, FIELDS_OPT, SYNC_OPT, ROMAN_OPT],
......
97 146
    "Lists the node groups in the cluster. The available fields are (see"
98 147
    " the man page for details): %s. The default list is (in order): %s." %
99 148
    (utils.CommaJoin(_LIST_HEADERS), utils.CommaJoin(_LIST_DEF_FIELDS))),
149
  "remove": (
150
    RemoveGroup, ARGS_ONE_GROUP, [DRY_RUN_OPT],
151
    "[--dry-run] <group_name>",
152
    "Remove an (empty) node group from the cluster"),
153
  "rename": (
154
    RenameGroup, [ArgGroup(min=2, max=2)], [DRY_RUN_OPT],
155
    "[--dry-run] <old_name> <new_name>", "Rename a node group"),
100 156
}
101 157

  
102 158

  
b/man/gnt-group.rst
20 20
COMMANDS
21 21
--------
22 22

  
23
ADD
24
~~~
25

  
26
| **add** {*group*}
27

  
28
Creates a new group with the given name. The node group will be
29
initially empty.
30

  
31
REMOVE
32
~~~~~~
33

  
34
| **remove** {*group*}
35

  
36
Deletes the indicated node group, which must be empty.
37

  
23 38
LIST
24 39
~~~~
25 40

  
......
78 93

  
79 94
If no group names are given, then all groups are included. Otherwise,
80 95
only the named groups will be listed.
96

  
97
RENAME
98
~~~~~~
99

  
100
| **rename** {*oldname*} {*newname*}
101

  
102
Renames a given group from *oldname* to *newname*.

Also available in: Unified diff