Revision 96e0d5cc

b/lib/backend.py
375 375

  
376 376
@RunLocalHooks(constants.FAKE_OP_MASTER_TURNDOWN, "master-ip-turndown",
377 377
               _BuildMasterIpHookEnv)
378
def DeactivateMasterIp():
378
def DeactivateMasterIp(master_ip, master_netmask, master_netdev):
379 379
  """Deactivate the master IP on this node.
380 380

  
381
  @param master_ip: the master IP
382
  @param master_netmask: the master IP netmask
383
  @param master_netdev: the master network device
384

  
381 385
  """
382 386
  # TODO: log and report back to the caller the error failures; we
383 387
  # need to decide in which case we fail the RPC for this
384 388

  
385
  # GetMasterInfo will raise an exception if not able to return data
386
  master_netdev, master_ip, _, _, master_netmask = GetMasterInfo()
387

  
388 389
  result = utils.RunCmd([constants.IP_COMMAND_PATH, "address", "del",
389 390
                         "%s/%s" % (master_ip, master_netmask),
390 391
                         "dev", master_netdev])
b/lib/bootstrap.py
567 567
  modify_ssh_setup = cfg.GetClusterInfo().modify_ssh_setup
568 568
  runner = rpc.BootstrapRunner()
569 569

  
570
  result = runner.call_node_deactivate_master_ip(master)
570
  (_, ip, netdev, netmask, _) = cfg.GetMasterNetworkParameters()
571
  result = runner.call_node_deactivate_master_ip(master, ip, netmask, netdev)
571 572
  msg = result.fail_msg
572 573
  if msg:
573 574
    logging.warning("Could not disable the master IP: %s", msg)
......
706 707
  logging.info("Stopping the master daemon on node %s", old_master)
707 708

  
708 709
  runner = rpc.BootstrapRunner()
709
  result = runner.call_node_deactivate_master_ip(old_master)
710
  (_, ip, netdev, netmask, _) = cfg.GetMasterNetworkParameters()
711
  result = runner.call_node_deactivate_master_ip(old_master, ip, netmask,
712
                                                 netdev)
710 713
  msg = result.fail_msg
711 714
  if msg:
712 715
    logging.warning("Could not disable the master IP: %s", msg)
b/lib/cmdlib.py
1355 1355
    """Destroys the cluster.
1356 1356

  
1357 1357
    """
1358
    master = self.cfg.GetMasterNode()
1358
    (master, ip, dev, netmask, _) = self.cfg.GetMasterNetworkParameters()
1359 1359

  
1360 1360
    # Run post hooks on master node before it's removed
1361 1361
    _RunPostHook(self, master)
1362 1362

  
1363
    result = self.rpc.call_node_deactivate_master_ip(master)
1363
    result = self.rpc.call_node_deactivate_master_ip(master, ip, netmask, dev)
1364 1364
    result.Raise("Could not disable the master role")
1365 1365

  
1366 1366
    return master
......
3326 3326
    new_ip = self.ip
3327 3327

  
3328 3328
    # shutdown the master IP
3329
    (master, _, dev, netmask, family) = self.cfg.GetMasterNetworkParameters()
3330
    result = self.rpc.call_node_deactivate_master_ip(master)
3329
    (master, ip, dev, netmask, family) = self.cfg.GetMasterNetworkParameters()
3330
    result = self.rpc.call_node_deactivate_master_ip(master, ip, netmask, dev)
3331 3331
    result.Raise("Could not disable the master role")
3332 3332

  
3333 3333
    try:
......
3700 3700
      helper_os("blacklisted_os", self.op.blacklisted_os, "blacklisted")
3701 3701

  
3702 3702
    if self.op.master_netdev:
3703
      master = self.cfg.GetMasterNode()
3703
      (master, ip, dev, netmask, _) = self.cfg.GetMasterNetworkParameters()
3704 3704
      feedback_fn("Shutting down master ip on the current netdev (%s)" %
3705 3705
                  self.cluster.master_netdev)
3706
      result = self.rpc.call_node_deactivate_master_ip(master)
3706
      result = self.rpc.call_node_deactivate_master_ip(master, ip, netmask, dev)
3707 3707
      result.Raise("Could not disable the master ip")
3708 3708
      feedback_fn("Changing master_netdev from %s to %s" %
3709
                  (self.cluster.master_netdev, self.op.master_netdev))
3709
                  (dev, self.op.master_netdev))
3710 3710
      self.cluster.master_netdev = self.op.master_netdev
3711 3711

  
3712 3712
    if self.op.master_netmask:
......
3902 3902
    """Deactivate the master IP.
3903 3903

  
3904 3904
    """
3905
    master = self.cfg.GetMasterNode()
3906
    self.rpc.call_node_deactivate_master_ip(master)
3905
    (master, ip, dev, netmask, _) = self.cfg.GetMasterNetworkParameters()
3906
    self.rpc.call_node_deactivate_master_ip(master, ip, netmask, dev)
3907 3907

  
3908 3908

  
3909 3909
def _WaitForSync(lu, instance, disks=None, oneshot=False):
b/lib/rpc_defs.py
407 407
      "Activates master IP on a node"),
408 408
    ("node_stop_master", SINGLE, TMO_FAST, [], None,
409 409
     "Deactivates master IP and stops master daemons on a node"),
410
    ("node_deactivate_master_ip", SINGLE, TMO_FAST, [], None,
410
    ("node_deactivate_master_ip", SINGLE, TMO_FAST, [
411
      ("master_ip", None, "The master IP"),
412
      ("master_netmask", None, "The master IP netmask"),
413
      ("master_netdev", None, "The master network device"),
414
      ], None,
411 415
     "Deactivates master IP on a node"),
412 416
    ("node_change_master_netmask", SINGLE, TMO_FAST, [
413 417
      ("netmask", None, None),
b/lib/server/noded.py
704 704
    """Deactivate the master IP on this node.
705 705

  
706 706
    """
707
    return backend.DeactivateMasterIp()
707
    return backend.DeactivateMasterIp(params[0], params[1], params[2])
708 708

  
709 709
  @staticmethod
710 710
  def perspective_node_stop_master(params):

Also available in: Unified diff