Commit 1338f2b4 authored by Balazs Lecz's avatar Balazs Lecz

Add --uid-pool option to gnt-cluster modify

Signed-off-by: default avatarBalazs Lecz <leczb@google.com>
Reviewed-by: default avatarGuido Trotter <ultrotter@google.com>
parent 6d127406
......@@ -116,6 +116,7 @@ pkgpython_PYTHON = \
lib/ssh.py \
lib/storage.py \
lib/utils.py \
lib/uidpool.py \
lib/workerpool.py
hypervisor_PYTHON = \
......
......@@ -124,6 +124,7 @@ __all__ = [
"SYNC_OPT",
"TAG_SRC_OPT",
"TIMEOUT_OPT",
"UIDPOOL_OPT",
"USEUNITS_OPT",
"USE_REPL_NET_OPT",
"VERBOSE_OPT",
......@@ -929,6 +930,11 @@ IDENTIFY_DEFAULTS_OPT = \
" the current cluster defaults and set them as such, instead"
" of marking them as overridden")
UIDPOOL_OPT = cli_option("--uid-pool", default=None,
action="store", dest="uid_pool",
help=("A list of user-ids or user-id"
" ranges separated by commas"))
def _ParseArgs(argv, commands, aliases):
"""Parser for the command line arguments.
......
......@@ -44,6 +44,7 @@ from ganeti import constants
from ganeti import objects
from ganeti import serializer
from ganeti import ssconf
from ganeti import uidpool
class LogicalUnit(object):
......@@ -2265,8 +2266,12 @@ class LUSetClusterParams(LogicalUnit):
if self.op.candidate_pool_size < 1:
raise errors.OpPrereqError("At least one master candidate needed",
errors.ECODE_INVAL)
_CheckBooleanOpField(self.op, "maintain_node_health")
if self.op.uid_pool:
uidpool.CheckUidPool(self.op.uid_pool)
def ExpandNames(self):
# FIXME: in the future maybe other cluster params won't require checking on
# all nodes to be modified.
......@@ -2461,6 +2466,9 @@ class LUSetClusterParams(LogicalUnit):
if self.op.maintain_node_health is not None:
self.cluster.maintain_node_health = self.op.maintain_node_health
if self.op.uid_pool is not None:
self.cluster.uid_pool = self.op.uid_pool
self.cfg.Update(self.cluster, feedback_fn)
......@@ -3719,6 +3727,7 @@ class LUQueryClusterInfo(NoHooksLU):
"mtime": cluster.mtime,
"uuid": cluster.uuid,
"tags": list(cluster.GetTags()),
"uid_pool": cluster.uid_pool,
}
return result
......
......@@ -306,6 +306,7 @@ class OpSetClusterParams(OpCode):
"nicparams",
"candidate_pool_size",
"maintain_node_health",
"uid_pool",
]
......
......@@ -39,6 +39,7 @@ from ganeti import utils
from ganeti import bootstrap
from ganeti import ssh
from ganeti import objects
from ganeti import uidpool
@UsesRPC
......@@ -601,6 +602,7 @@ def SetClusterParams(opts, args):
opts.enabled_hypervisors or opts.hvparams or
opts.beparams or opts.nicparams or
opts.candidate_pool_size is not None or
opts.uid_pool is not None or
opts.maintain_node_health is not None):
ToStderr("Please give at least one of the parameters.")
return 1
......@@ -628,8 +630,13 @@ def SetClusterParams(opts, args):
nicparams = opts.nicparams
utils.ForceDictType(nicparams, constants.NICS_PARAMETER_TYPES)
mnh = opts.maintain_node_health
uid_pool = opts.uid_pool
if uid_pool is not None:
uid_pool = uidpool.ParseUidPool(uid_pool)
op = opcodes.OpSetClusterParams(vg_name=vg_name,
enabled_hypervisors=hvlist,
hvparams=hvparams,
......@@ -637,7 +644,8 @@ def SetClusterParams(opts, args):
beparams=beparams,
nicparams=nicparams,
candidate_pool_size=opts.candidate_pool_size,
maintain_node_health=mnh)
maintain_node_health=mnh,
uid_pool=uid_pool)
SubmitOpCode(op, opts=opts)
return 0
......@@ -788,7 +796,8 @@ commands = {
'modify': (
SetClusterParams, ARGS_NONE,
[BACKEND_OPT, CP_SIZE_OPT, ENABLED_HV_OPT, HVLIST_OPT,
NIC_PARAMS_OPT, NOLVM_STORAGE_OPT, VG_NAME_OPT, MAINTAIN_NODE_HEALTH_OPT],
NIC_PARAMS_OPT, NOLVM_STORAGE_OPT, VG_NAME_OPT, MAINTAIN_NODE_HEALTH_OPT,
UIDPOOL_OPT],
"[opts...]",
"Alters the parameters of the cluster"),
"renew-crypto": (
......
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