Revision bf689b7a

b/lib/bootstrap.py
289 289
                hvparams=None, enabled_hypervisors=None, modify_etc_hosts=True,
290 290
                modify_ssh_setup=True, maintain_node_health=False,
291 291
                drbd_helper=None, uid_pool=None, default_iallocator=None,
292
                primary_ip_version=None, prealloc_wipe_disks=False):
292
                primary_ip_version=None, prealloc_wipe_disks=False,
293
                use_external_mip_script=False):
293 294
  """Initialise the cluster.
294 295

  
295 296
  @type candidate_pool_size: int
......
482 483
    default_iallocator=default_iallocator,
483 484
    primary_ip_family=ipcls.family,
484 485
    prealloc_wipe_disks=prealloc_wipe_disks,
486
    use_external_mip_script=use_external_mip_script,
485 487
    )
486 488
  master_node_config = objects.Node(name=hostname.name,
487 489
                                    primary_ip=hostname.ip,
b/lib/cli.py
177 177
  "TO_GROUP_OPT",
178 178
  "UIDPOOL_OPT",
179 179
  "USEUNITS_OPT",
180
  "USE_EXTERNAL_MIP_SCRIPT",
180 181
  "USE_REPL_NET_OPT",
181 182
  "VERBOSE_OPT",
182 183
  "VG_NAME_OPT",
......
1016 1017
                                metavar="NETMASK",
1017 1018
                                default=None)
1018 1019

  
1020
USE_EXTERNAL_MIP_SCRIPT = cli_option("--use-external-mip-script",
1021
                                dest="use_external_mip_script",
1022
                                help="Specify whether to run a user-provided"
1023
                                " script for the master IP address turnup and"
1024
                                " turndown operations",
1025
                                type="bool", metavar=_YORNO, default=None)
1026

  
1019 1027
GLOBAL_FILEDIR_OPT = cli_option("--file-storage-dir", dest="file_storage_dir",
1020 1028
                                help="Specify the default directory (cluster-"
1021 1029
                                "wide) for storing the file-based disks [%s]" %
b/lib/client/gnt_cluster.py
133 133
  if opts.prealloc_wipe_disks is None:
134 134
    opts.prealloc_wipe_disks = False
135 135

  
136
  external_ip_setup_script = opts.use_external_mip_script
137
  if external_ip_setup_script is None:
138
    external_ip_setup_script = False
139

  
136 140
  try:
137 141
    primary_ip_version = int(opts.primary_ip_version)
138 142
  except (ValueError, TypeError), err:
......
169 173
                        default_iallocator=opts.default_iallocator,
170 174
                        primary_ip_version=primary_ip_version,
171 175
                        prealloc_wipe_disks=opts.prealloc_wipe_disks,
176
                        use_external_mip_script=external_ip_setup_script,
172 177
                        )
173 178
  op = opcodes.OpClusterPostInit()
174 179
  SubmitOpCode(op, opts=opts)
......
381 386
                              convert=opts.roman_integers))
382 387
  ToStdout("  - master netdev: %s", result["master_netdev"])
383 388
  ToStdout("  - master netmask: %s", result["master_netmask"])
389
  ToStdout("  - use external master IP address setup script: %s",
390
           result["use_external_mip_script"])
384 391
  ToStdout("  - lvm volume group: %s", result["volume_group_name"])
385 392
  if result["reserved_lvs"]:
386 393
    reserved_lvs = utils.CommaJoin(result["reserved_lvs"])
......
879 886
          opts.reserved_lvs is not None or
880 887
          opts.master_netdev is not None or
881 888
          opts.master_netmask is not None or
889
          opts.use_external_mip_script is not None or
882 890
          opts.prealloc_wipe_disks is not None):
883 891
    ToStderr("Please give at least one of the parameters.")
884 892
    return 1
......
945 953
      ToStderr("The --master-netmask option expects an int parameter.")
946 954
      return 1
947 955

  
956
  ext_ip_script = opts.use_external_mip_script
957

  
948 958
  op = opcodes.OpClusterSetParams(vg_name=vg_name,
949 959
                                  drbd_helper=drbd_helper,
950 960
                                  enabled_hypervisors=hvlist,
......
962 972
                                  prealloc_wipe_disks=opts.prealloc_wipe_disks,
963 973
                                  master_netdev=opts.master_netdev,
964 974
                                  master_netmask=opts.master_netmask,
965
                                  reserved_lvs=opts.reserved_lvs)
975
                                  reserved_lvs=opts.reserved_lvs,
976
                                  use_external_mip_script=ext_ip_script,
977
                                  )
966 978
  SubmitOpCode(op, opts=opts)
967 979
  return 0
968 980

  
......
1364 1376
     NOMODIFY_SSH_SETUP_OPT, SECONDARY_IP_OPT, VG_NAME_OPT,
1365 1377
     MAINTAIN_NODE_HEALTH_OPT, UIDPOOL_OPT, DRBD_HELPER_OPT, NODRBD_STORAGE_OPT,
1366 1378
     DEFAULT_IALLOCATOR_OPT, PRIMARY_IP_VERSION_OPT, PREALLOC_WIPE_DISKS_OPT,
1367
     NODE_PARAMS_OPT, GLOBAL_SHARED_FILEDIR_OPT],
1379
     NODE_PARAMS_OPT, GLOBAL_SHARED_FILEDIR_OPT, USE_EXTERNAL_MIP_SCRIPT],
1368 1380
    "[opts...] <cluster_name>", "Initialises a new cluster configuration"),
1369 1381
  "destroy": (
1370 1382
    DestroyCluster, ARGS_NONE, [YES_DOIT_OPT],
......
1441 1453
     MAINTAIN_NODE_HEALTH_OPT, UIDPOOL_OPT, ADD_UIDS_OPT, REMOVE_UIDS_OPT,
1442 1454
     DRBD_HELPER_OPT, NODRBD_STORAGE_OPT, DEFAULT_IALLOCATOR_OPT,
1443 1455
     RESERVED_LVS_OPT, DRY_RUN_OPT, PRIORITY_OPT, PREALLOC_WIPE_DISKS_OPT,
1444
     NODE_PARAMS_OPT],
1456
     NODE_PARAMS_OPT, USE_EXTERNAL_MIP_SCRIPT],
1445 1457
    "[opts...]",
1446 1458
    "Alters the parameters of the cluster"),
1447 1459
  "renew-crypto": (
b/lib/cmdlib.py
3683 3683
    if self.op.reserved_lvs is not None:
3684 3684
      self.cluster.reserved_lvs = self.op.reserved_lvs
3685 3685

  
3686
    if self.op.use_external_mip_script is not None:
3687
      self.cluster.use_external_mip_script = self.op.use_external_mip_script
3688

  
3686 3689
    def helper_os(aname, mods, desc):
3687 3690
      desc += " OS list"
3688 3691
      lst = getattr(self.cluster, aname)
b/lib/constants.py
180 180
SYSCONFDIR = _autoconf.SYSCONFDIR
181 181
TOOLSDIR = _autoconf.TOOLSDIR
182 182
CONF_DIR = SYSCONFDIR + "/ganeti"
183
USER_SCRIPTS_DIR = CONF_DIR + "/scripts"
183 184

  
184 185
#: Lock file for watcher, locked in shared mode by watcher; lock in exclusive
185 186
# mode to block watcher (see L{cli._RunWhileClusterStoppedHelper.Call}
......
195 196
#: File containing Unix timestamp until which watcher should be paused
196 197
WATCHER_PAUSEFILE = DATA_DIR + "/watcher.pause"
197 198

  
199
# Master IP address setup scripts paths (default and user-provided)
200
DEFAULT_MASTER_SETUP_SCRIPT = TOOLSDIR + "/master-ip-setup"
201
EXTERNAL_MASTER_SETUP_SCRIPT = USER_SCRIPTS_DIR + "/master-ip-setup"
202

  
198 203
ALL_CERT_FILES = frozenset([
199 204
  NODED_CERT_FILE,
200 205
  RAPI_CERT_FILE,
b/lib/opcodes.py
796 796
     "Modify list of blacklisted operating systems. Each modification must have"
797 797
     " two items, the operation and the OS name. The operation can be"
798 798
     " ``%s`` or ``%s``." % (constants.DDM_ADD, constants.DDM_REMOVE)),
799
    ("use_external_mip_script", None, ht.TMaybeBool,
800
     "Whether to use an external master IP address setup script"),
799 801
    ]
800 802

  
801 803

  
b/man/gnt-cluster.rst
167 167
| [--vg-name *vg-name*]
168 168
| [--master-netdev *interface-name*]
169 169
| [--master-netmask *netmask*]
170
| [--use-external-mip-script {yes \| no}]
170 171
| [{-m|--mac-prefix} *mac-prefix*]
171 172
| [--no-lvm-storage]
172 173
| [--no-etc-hosts]
......
228 229
interpreted as a CIDR netmask. The default value is 32 for an IPv4
229 230
address and 128 for an IPv6 address.
230 231

  
232
The ``--use-external-mip-script`` options allows to specify
233
whether to use an user-supplied master IP address setup script, whose
234
location is ``/etc/ganeti/scripts/master-ip-setup``. If the option value
235
is set to False, the default script, whose location is
236
``/usr/local/lib/ganeti/tools/master-ip-setup``, will be executed.
237

  
231 238
The ``-m (--mac-prefix)`` option will let you specify a three byte
232 239
prefix under which the virtual MAC addresses of your instances will be
233 240
generated. The prefix must be specified in the format ``XX:XX:XX`` and
......
438 445
| [--node-parameters *ndparams*]
439 446
| [--master-netdev *interface-name*]
440 447
| [--master-netmask *netmask*]
448
| [--use-external-mip-script {yes \| no}]
441 449

  
442 450
Modify the options for the cluster.
443 451

  
......
445 453
``-H (--hypervisor-parameters)``, ``-B (--backend-parameters)``,
446 454
``--nic-parameters``, ``-C (--candidate-pool-size)``,
447 455
``--maintain-node-health``, ``--prealloc-wipe-disks``, ``--uid-pool``,
448
``--node-parameters``, ``--master-netdev`` and ``--master-netmask``
449
options are described in the **init** command.
456
``--node-parameters``, ``--master-netdev``, ``--master-netmask`` and
457
``--use-external-mip-script`` options are described in the
458
**init** command.
450 459

  
451 460
The ``--add-uids`` and ``--remove-uids`` options can be used to
452 461
modify the user-id pool by adding/removing a list of user-ids or

Also available in: Unified diff