Revision 2503680f

b/daemons/ganeti-masterd
517 517
    try:
518 518
      # activate ip
519 519
      master_node = ssconf.SimpleConfigReader().GetMasterNode()
520
      if not rpc.RpcRunner.call_node_start_master(master_node, False):
520
      if not rpc.RpcRunner.call_node_start_master(master_node, False, False):
521 521
        logging.error("Can't activate master IP address")
522 522

  
523 523
      master.setup_queue()
b/daemons/ganeti-noded
520 520
    """Promote this node to master status.
521 521

  
522 522
    """
523
    return backend.StartMaster(params[0])
523
    return backend.StartMaster(params[0], params[1])
524 524

  
525 525
  @staticmethod
526 526
  def perspective_node_stop_master(params):
b/lib/backend.py
147 147
  return (master_netdev, master_ip, master_node)
148 148

  
149 149

  
150
def StartMaster(start_daemons):
150
def StartMaster(start_daemons, no_voting):
151 151
  """Activate local node as master node.
152 152

  
153 153
  The function will always try activate the IP address of the master
......
157 157
  @type start_daemons: boolean
158 158
  @param start_daemons: whther to also start the master
159 159
      daemons (ganeti-masterd and ganeti-rapi)
160
  @type no_voting: boolean
161
  @param no_voting: whether to start ganeti-masterd without a node vote
162
      (if start_daemons is True), but still non-interactively
160 163
  @rtype: None
161 164

  
162 165
  """
......
186 189

  
187 190
  # and now start the master and rapi daemons
188 191
  if start_daemons:
189
    for daemon in 'ganeti-masterd', 'ganeti-rapi':
190
      result = utils.RunCmd([daemon])
192
    daemons_params = {
193
        'ganeti-masterd': [],
194
        'ganeti-rapi': [],
195
        }
196
    if no_voting:
197
      daemons_params['ganeti-masterd'].append('--no-voting')
198
      daemons_params['ganeti-masterd'].append('--yes-do-it')
199
    for daemon in daemons_params:
200
      cmd = [daemon]
201
      cmd.extend(daemons_params[daemon])
202
      result = utils.RunCmd(cmd)
191 203
      if result.failed:
192 204
        logging.error("Can't start daemon %s: %s", daemon, result.output)
193 205
        ok = False
b/lib/bootstrap.py
264 264

  
265 265
  # start the master ip
266 266
  # TODO: Review rpc call from bootstrap
267
  rpc.RpcRunner.call_node_start_master(hostname.name, True)
267
  rpc.RpcRunner.call_node_start_master(hostname.name, True, False)
268 268

  
269 269

  
270 270
def InitConfig(version, cluster_config, master_node_config,
......
442 442
  # cluster info
443 443
  cfg.Update(cluster_info)
444 444

  
445
  # 2.0.X: Don't start the master if no_voting is true
446
  result = rpc.RpcRunner.call_node_start_master(new_master, not no_voting)
445
  result = rpc.RpcRunner.call_node_start_master(new_master, True, no_voting)
447 446
  if result.failed or not result.data:
448 447
    logging.error("Could not start the master role on the new master"
449 448
                  " %s, please check", new_master)
b/lib/cmdlib.py
1403 1403
                        constants.SSH_KNOWN_HOSTS_FILE, to_node)
1404 1404

  
1405 1405
    finally:
1406
      result = self.rpc.call_node_start_master(master, False)
1406
      result = self.rpc.call_node_start_master(master, False, False)
1407 1407
      if result.failed or not result.data:
1408 1408
        self.LogWarning("Could not re-enable the master role on"
1409 1409
                        " the master, please restart manually.")
b/lib/rpc.py
682 682
                               [checkdict, cluster_name])
683 683

  
684 684
  @classmethod
685
  def call_node_start_master(cls, node, start_daemons):
685
  def call_node_start_master(cls, node, start_daemons, no_voting):
686 686
    """Tells a node to activate itself as a master.
687 687

  
688 688
    This is a single-node call.
689 689

  
690 690
    """
691 691
    return cls._StaticSingleNodeCall(node, "node_start_master",
692
                                     [start_daemons])
692
                                     [start_daemons, no_voting])
693 693

  
694 694
  @classmethod
695 695
  def call_node_stop_master(cls, node, stop_daemons):
b/man/gnt-cluster.sgml
460 460
        and gnt-cluster redist-conf to make sure the cluster is consistent again.
461 461
      </para>
462 462

  
463
      <para>
464
        In version 2.0.X ganeti-masterd will not be able to start if
465
        masterfailover is called with the --no-voting option (which, again,
466
        should only be used on 2 nodes clusters with the former master being
467
        down). In that case just start it manually passing --no-voting to it
468
        as well, until you have restored cluster redundancy.
469
      </para>
470

  
471 463
    </refsect2>
472 464

  
473 465
    <refsect2>

Also available in: Unified diff