+def AssignNodes(opts, args):
+ """Assign nodes to a group.
+
+ @param opts: the command line options selected by the user
+ @type args: list
+ @param args: args[0]: group to assign nodes to; args[1:]: nodes to assign
+ @rtype: int
+ @return: the desired exit code
+
+ """
+ group_name = args[0]
+ node_names = args[1:]
+
+ op = opcodes.OpGroupAssignNodes(group_name=group_name, nodes=node_names,
+ force=opts.force)
+ SubmitOpCode(op, opts=opts)
+
+
+def _FmtDict(data):
+ """Format dict data into command-line format.
+
+ @param data: The input dict to be formatted
+ @return: The formatted dict
+
+ """
+ if not data:
+ return "(empty)"
+
+ return utils.CommaJoin(["%s=%s" % (key, value)
+ for key, value in data.items()])
+
+