Revision 3583908a

b/daemons/ganeti-masterd
525 525
    try:
526 526
      # activate ip
527 527
      master_node = ssconf.SimpleConfigReader().GetMasterNode()
528
      result = rpc.RpcRunner.call_node_start_master(master_node, False)
528
      result = rpc.RpcRunner.call_node_start_master(master_node, False, False)
529 529
      msg = result.RemoteFailMsg()
530 530
      if msg:
531 531
        logging.error("Can't activate master IP address: %s", msg)
b/daemons/ganeti-noded
529 529
    """Promote this node to master status.
530 530

  
531 531
    """
532
    return backend.StartMaster(params[0])
532
    return backend.StartMaster(params[0], params[1])
533 533

  
534 534
  @staticmethod
535 535
  def perspective_node_stop_master(params):
b/lib/backend.py
177 177
  return (master_netdev, master_ip, master_node)
178 178

  
179 179

  
180
def StartMaster(start_daemons):
180
def StartMaster(start_daemons, no_voting):
181 181
  """Activate local node as master node.
182 182

  
183 183
  The function will always try activate the IP address of the master
......
187 187
  @type start_daemons: boolean
188 188
  @param start_daemons: whether to also start the master
189 189
      daemons (ganeti-masterd and ganeti-rapi)
190
  @type no_voting: boolean
191
  @param no_voting: whether to start ganeti-masterd without a node vote
192
      (if start_daemons is True), but still non-interactively
190 193
  @rtype: None
191 194

  
192 195
  """
......
217 220

  
218 221
  # and now start the master and rapi daemons
219 222
  if start_daemons:
220
    for daemon in 'ganeti-masterd', 'ganeti-rapi':
221
      result = utils.RunCmd([daemon])
223
    daemons_params = {
224
        'ganeti-masterd': [],
225
        'ganeti-rapi': [],
226
        }
227
    if no_voting:
228
      daemons_params['ganeti-masterd'].append('--no-voting')
229
      daemons_params['ganeti-masterd'].append('--yes-do-it')
230
    for daemon in daemons_params:
231
      cmd = [daemon]
232
      cmd.extend(daemons_params[daemon])
233
      result = utils.RunCmd(cmd)
222 234
      if result.failed:
223 235
        msg = "Can't start daemon %s: %s" % (daemon, result.output)
224 236
        logging.error(msg)
b/lib/bootstrap.py
275 275
  # start the master ip
276 276
  # TODO: Review rpc call from bootstrap
277 277
  # TODO: Warn on failed start master
278
  rpc.RpcRunner.call_node_start_master(hostname.name, True)
278
  rpc.RpcRunner.call_node_start_master(hostname.name, True, False)
279 279

  
280 280

  
281 281
def InitConfig(version, cluster_config, master_node_config,
......
457 457
  # cluster info
458 458
  cfg.Update(cluster_info)
459 459

  
460
  # 2.0.X: Don't start the master if no_voting is true
461
  result = rpc.RpcRunner.call_node_start_master(new_master, not no_voting)
460
  result = rpc.RpcRunner.call_node_start_master(new_master, True, no_voting)
462 461
  msg = result.RemoteFailMsg()
463 462
  if msg:
464 463
    logging.error("Could not start the master role on the new master"
b/lib/cmdlib.py
1440 1440
          self.proc.LogWarning(msg)
1441 1441

  
1442 1442
    finally:
1443
      result = self.rpc.call_node_start_master(master, False)
1443
      result = self.rpc.call_node_start_master(master, False, False)
1444 1444
      msg = result.fail_msg
1445 1445
      if msg:
1446 1446
        self.LogWarning("Could not re-enable the master role on"
b/lib/rpc.py
676 676
                               [checkdict, cluster_name])
677 677

  
678 678
  @classmethod
679
  def call_node_start_master(cls, node, start_daemons):
679
  def call_node_start_master(cls, node, start_daemons, no_voting):
680 680
    """Tells a node to activate itself as a master.
681 681

  
682 682
    This is a single-node call.
683 683

  
684 684
    """
685 685
    return cls._StaticSingleNodeCall(node, "node_start_master",
686
                                     [start_daemons])
686
                                     [start_daemons, no_voting])
687 687

  
688 688
  @classmethod
689 689
  def call_node_stop_master(cls, node, stop_daemons):
b/man/gnt-cluster.sgml
483 483
        and gnt-cluster redist-conf to make sure the cluster is consistent again.
484 484
      </para>
485 485

  
486
      <para>
487
        In version 2.0.X ganeti-masterd will not be able to start if
488
        masterfailover is called with the --no-voting option (which, again,
489
        should only be used on 2 nodes clusters with the former master being
490
        down). In that case just start it manually passing --no-voting to it
491
        as well, until you have restored cluster redundancy.
492
      </para>
493

  
494 486
    </refsect2>
495 487

  
496 488
    <refsect2>

Also available in: Unified diff