hvparams=None, enabled_hypervisors=None, modify_etc_hosts=True,
modify_ssh_setup=True, maintain_node_health=False,
drbd_helper=None, uid_pool=None, default_iallocator=None,
- primary_ip_version=None, prealloc_wipe_disks=False):
+ primary_ip_version=None, prealloc_wipe_disks=False,
+ use_external_mip_script=False):
"""Initialise the cluster.
@type candidate_pool_size: int
default_iallocator=default_iallocator,
primary_ip_family=ipcls.family,
prealloc_wipe_disks=prealloc_wipe_disks,
+ use_external_mip_script=use_external_mip_script,
)
master_node_config = objects.Node(name=hostname.name,
primary_ip=hostname.ip,
"TO_GROUP_OPT",
"UIDPOOL_OPT",
"USEUNITS_OPT",
+ "USE_EXTERNAL_MIP_SCRIPT",
"USE_REPL_NET_OPT",
"VERBOSE_OPT",
"VG_NAME_OPT",
metavar="NETMASK",
default=None)
+USE_EXTERNAL_MIP_SCRIPT = cli_option("--use-external-mip-script",
+ dest="use_external_mip_script",
+ help="Specify whether to run a user-provided"
+ " script for the master IP address turnup and"
+ " turndown operations",
+ type="bool", metavar=_YORNO, default=None)
+
GLOBAL_FILEDIR_OPT = cli_option("--file-storage-dir", dest="file_storage_dir",
help="Specify the default directory (cluster-"
"wide) for storing the file-based disks [%s]" %
if opts.prealloc_wipe_disks is None:
opts.prealloc_wipe_disks = False
+ external_ip_setup_script = opts.use_external_mip_script
+ if external_ip_setup_script is None:
+ external_ip_setup_script = False
+
try:
primary_ip_version = int(opts.primary_ip_version)
except (ValueError, TypeError), err:
default_iallocator=opts.default_iallocator,
primary_ip_version=primary_ip_version,
prealloc_wipe_disks=opts.prealloc_wipe_disks,
+ use_external_mip_script=external_ip_setup_script,
)
op = opcodes.OpClusterPostInit()
SubmitOpCode(op, opts=opts)
convert=opts.roman_integers))
ToStdout(" - master netdev: %s", result["master_netdev"])
ToStdout(" - master netmask: %s", result["master_netmask"])
+ ToStdout(" - use external master IP address setup script: %s",
+ result["use_external_mip_script"])
ToStdout(" - lvm volume group: %s", result["volume_group_name"])
if result["reserved_lvs"]:
reserved_lvs = utils.CommaJoin(result["reserved_lvs"])
opts.reserved_lvs is not None or
opts.master_netdev is not None or
opts.master_netmask is not None or
+ opts.use_external_mip_script is not None or
opts.prealloc_wipe_disks is not None):
ToStderr("Please give at least one of the parameters.")
return 1
ToStderr("The --master-netmask option expects an int parameter.")
return 1
+ ext_ip_script = opts.use_external_mip_script
+
op = opcodes.OpClusterSetParams(vg_name=vg_name,
drbd_helper=drbd_helper,
enabled_hypervisors=hvlist,
prealloc_wipe_disks=opts.prealloc_wipe_disks,
master_netdev=opts.master_netdev,
master_netmask=opts.master_netmask,
- reserved_lvs=opts.reserved_lvs)
+ reserved_lvs=opts.reserved_lvs,
+ use_external_mip_script=ext_ip_script,
+ )
SubmitOpCode(op, opts=opts)
return 0
NOMODIFY_SSH_SETUP_OPT, SECONDARY_IP_OPT, VG_NAME_OPT,
MAINTAIN_NODE_HEALTH_OPT, UIDPOOL_OPT, DRBD_HELPER_OPT, NODRBD_STORAGE_OPT,
DEFAULT_IALLOCATOR_OPT, PRIMARY_IP_VERSION_OPT, PREALLOC_WIPE_DISKS_OPT,
- NODE_PARAMS_OPT, GLOBAL_SHARED_FILEDIR_OPT],
+ NODE_PARAMS_OPT, GLOBAL_SHARED_FILEDIR_OPT, USE_EXTERNAL_MIP_SCRIPT],
"[opts...] <cluster_name>", "Initialises a new cluster configuration"),
"destroy": (
DestroyCluster, ARGS_NONE, [YES_DOIT_OPT],
MAINTAIN_NODE_HEALTH_OPT, UIDPOOL_OPT, ADD_UIDS_OPT, REMOVE_UIDS_OPT,
DRBD_HELPER_OPT, NODRBD_STORAGE_OPT, DEFAULT_IALLOCATOR_OPT,
RESERVED_LVS_OPT, DRY_RUN_OPT, PRIORITY_OPT, PREALLOC_WIPE_DISKS_OPT,
- NODE_PARAMS_OPT],
+ NODE_PARAMS_OPT, USE_EXTERNAL_MIP_SCRIPT],
"[opts...]",
"Alters the parameters of the cluster"),
"renew-crypto": (
if self.op.reserved_lvs is not None:
self.cluster.reserved_lvs = self.op.reserved_lvs
+ if self.op.use_external_mip_script is not None:
+ self.cluster.use_external_mip_script = self.op.use_external_mip_script
+
def helper_os(aname, mods, desc):
desc += " OS list"
lst = getattr(self.cluster, aname)
SYSCONFDIR = _autoconf.SYSCONFDIR
TOOLSDIR = _autoconf.TOOLSDIR
CONF_DIR = SYSCONFDIR + "/ganeti"
+USER_SCRIPTS_DIR = CONF_DIR + "/scripts"
#: Lock file for watcher, locked in shared mode by watcher; lock in exclusive
# mode to block watcher (see L{cli._RunWhileClusterStoppedHelper.Call}
#: File containing Unix timestamp until which watcher should be paused
WATCHER_PAUSEFILE = DATA_DIR + "/watcher.pause"
+# Master IP address setup scripts paths (default and user-provided)
+DEFAULT_MASTER_SETUP_SCRIPT = TOOLSDIR + "/master-ip-setup"
+EXTERNAL_MASTER_SETUP_SCRIPT = USER_SCRIPTS_DIR + "/master-ip-setup"
+
ALL_CERT_FILES = frozenset([
NODED_CERT_FILE,
RAPI_CERT_FILE,
"Modify list of blacklisted operating systems. Each modification must have"
" two items, the operation and the OS name. The operation can be"
" ``%s`` or ``%s``." % (constants.DDM_ADD, constants.DDM_REMOVE)),
+ ("use_external_mip_script", None, ht.TMaybeBool,
+ "Whether to use an external master IP address setup script"),
]
| [--vg-name *vg-name*]
| [--master-netdev *interface-name*]
| [--master-netmask *netmask*]
+| [--use-external-mip-script {yes \| no}]
| [{-m|--mac-prefix} *mac-prefix*]
| [--no-lvm-storage]
| [--no-etc-hosts]
interpreted as a CIDR netmask. The default value is 32 for an IPv4
address and 128 for an IPv6 address.
+The ``--use-external-mip-script`` options allows to specify
+whether to use an user-supplied master IP address setup script, whose
+location is ``/etc/ganeti/scripts/master-ip-setup``. If the option value
+is set to False, the default script, whose location is
+``/usr/local/lib/ganeti/tools/master-ip-setup``, will be executed.
+
The ``-m (--mac-prefix)`` option will let you specify a three byte
prefix under which the virtual MAC addresses of your instances will be
generated. The prefix must be specified in the format ``XX:XX:XX`` and
| [--node-parameters *ndparams*]
| [--master-netdev *interface-name*]
| [--master-netmask *netmask*]
+| [--use-external-mip-script {yes \| no}]
Modify the options for the cluster.
``-H (--hypervisor-parameters)``, ``-B (--backend-parameters)``,
``--nic-parameters``, ``-C (--candidate-pool-size)``,
``--maintain-node-health``, ``--prealloc-wipe-disks``, ``--uid-pool``,
-``--node-parameters``, ``--master-netdev`` and ``--master-netmask``
-options are described in the **init** command.
+``--node-parameters``, ``--master-netdev``, ``--master-netmask`` and
+``--use-external-mip-script`` options are described in the
+**init** command.
The ``--add-uids`` and ``--remove-uids`` options can be used to
modify the user-id pool by adding/removing a list of user-ids or