projects
/
ganeti-local
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
gnt-cluster init, handle candidate_pool_size
[ganeti-local]
/
scripts
/
gnt-cluster
diff --git
a/scripts/gnt-cluster
b/scripts/gnt-cluster
index
fcf0fc9
..
1c9134b
100755
(executable)
--- a/
scripts/gnt-cluster
+++ b/
scripts/gnt-cluster
@@
-60,13
+60,14
@@
def InitCluster(opts, args):
if hvlist is not None:
hvlist = hvlist.split(",")
else:
if hvlist is not None:
hvlist = hvlist.split(",")
else:
- hvlist = [constants.DEFAULT_ENABLED_HYPERVISOR]
+ hvlist = [opts.default_hypervisor]
# avoid an impossible situation
# avoid an impossible situation
- if opts.default_hypervisor in hvlist:
- default_hypervisor = opts.default_hypervisor
- else:
- default_hypervisor = hvlist[0]
+ if opts.default_hypervisor not in hvlist:
+ ToStderr("The default hypervisor requested (%s) is not"
+ " within the enabled hypervisor list (%s)" %
+ (opts.default_hypervisor, hvlist))
+ return 1
hvparams = opts.hvparams
if hvparams:
hvparams = opts.hvparams
if hvparams:
@@
-120,9
+121,11
@@
def InitCluster(opts, args):
master_netdev=opts.master_netdev,
file_storage_dir=opts.file_storage_dir,
enabled_hypervisors=hvlist,
master_netdev=opts.master_netdev,
file_storage_dir=opts.file_storage_dir,
enabled_hypervisors=hvlist,
- default_hypervisor=default_hypervisor,
+ default_hypervisor=opts.default_hypervisor,
hvparams=hvparams,
hvparams=hvparams,
- beparams=beparams)
+ beparams=beparams,
+ candidate_pool_size=opts.candidate_pool_size,
+ )
return 0
return 0
@@
-238,6
+241,9
@@
def ShowClusterConfig(opts, args):
ToStdout(" %s: %s", item, val)
ToStdout("Cluster parameters:")
ToStdout(" %s: %s", item, val)
ToStdout("Cluster parameters:")
+ ToStdout(" - candidate pool size: %s", result["candidate_pool_size"])
+
+ ToStdout("Default instance parameters:")
for gr_name, gr_dict in result["beparams"].items():
ToStdout(" - %s:", gr_name)
for item, val in gr_dict.iteritems():
for gr_name, gr_dict in result["beparams"].items():
ToStdout(" - %s:", gr_name)
for item, val in gr_dict.iteritems():
@@
-448,7
+454,7
@@
def SetClusterParams(opts, args):
"""
if not (not opts.lvm_storage or opts.vg_name or
opts.enabled_hypervisors or opts.hvparams or
"""
if not (not opts.lvm_storage or opts.vg_name or
opts.enabled_hypervisors or opts.hvparams or
- opts.beparams):
+ opts.beparams or opts.candidate_pool_size is not None):
ToStderr("Please give at least one of the parameters.")
return 1
ToStderr("Please give at least one of the parameters.")
return 1
@@
-471,7
+477,8
@@
def SetClusterParams(opts, args):
op = opcodes.OpSetClusterParams(vg_name=opts.vg_name,
enabled_hypervisors=hvlist,
hvparams=hvparams,
op = opcodes.OpSetClusterParams(vg_name=opts.vg_name,
enabled_hypervisors=hvlist,
hvparams=hvparams,
- beparams=beparams)
+ beparams=beparams,
+ candidate_pool_size=opts.candidate_pool_size)
SubmitOpCode(op)
return 0
SubmitOpCode(op)
return 0
@@
-565,6
+572,10
@@
commands = {
keyval_option("-B", "--backend-parameters", dest="beparams",
type="keyval", default={},
help="Backend parameters"),
keyval_option("-B", "--backend-parameters", dest="beparams",
type="keyval", default={},
help="Backend parameters"),
+ make_option("-C", "--candidate-pool-size",
+ default=constants.MASTER_POOL_SIZE_DEFAULT,
+ help="Set the candidate pool size",
+ dest="candidate_pool_size", type="int"),
],
"[opts...] <cluster_name>",
"Initialises a new cluster configuration"),
],
"[opts...] <cluster_name>",
"Initialises a new cluster configuration"),
@@
-636,6
+647,9
@@
commands = {
keyval_option("-B", "--backend-parameters", dest="beparams",
type="keyval", default={},
help="Backend parameters"),
keyval_option("-B", "--backend-parameters", dest="beparams",
type="keyval", default={},
help="Backend parameters"),
+ make_option("-C", "--candidate-pool-size", default=None,
+ help="Set the candidate pool size",
+ dest="candidate_pool_size", type="int"),
],
"[opts...]",
"Alters the parameters of the cluster"),
],
"[opts...]",
"Alters the parameters of the cluster"),