Revision 79829d23

b/doc/admin.rst
912 912
This will deconfigure the node, stop the ganeti daemons on it and leave
913 913
it hopefully like before it joined to the cluster.
914 914

  
915
Replication network changes
916
+++++++++++++++++++++++++++
917

  
918
The :command:`gnt-node modify -s` command can be used to change the
919
secondary IP of a node. This operation can only be performed if:
920

  
921
- No instance is active on the target node
922
- The new target IP is reachable from the master's secondary IP
923

  
924
Also this operation will not allow to change a node from single-homed
925
(same primary and secondary ip) to multi-homed (separate replication
926
network) or vice versa, unless:
927

  
928
- The target node is the master node and `--force` is passed.
929
- The target cluster is single-homed and the new primary ip is a change
930
  to single homed for a particular node.
931
- The target cluster is multi-homed and the new primary ip is a change
932
  to multi homed for a particular node.
933

  
934
For example to do a single-homed to multi-homed conversion::
935

  
936
  $ gnt-node modify --force -s %SECONDARY_IP% %MASTER_NAME%
937
  $ gnt-node modify -s %SECONDARY_IP% %NODE1_NAME%
938
  $ gnt-node modify -s %SECONDARY_IP% %NODE2_NAME%
939
  $ gnt-node modify -s %SECONDARY_IP% %NODE3_NAME%
940
  ...
941

  
942
The same commands can be used for multi-homed to single-homed except the
943
secondary IPs should be the same as the primaries for each node, for
944
that case.
945

  
915 946
Storage handling
916 947
++++++++++++++++
917 948

  
b/lib/cmdlib.py
5996 5996
                        " without using re-add. Please make sure the node"
5997 5997
                        " is healthy!")
5998 5998

  
5999
    # When changing the secondary ip, verify if this is a single-homed to
6000
    # multi-homed transition or vice versa, and apply the relevant
6001
    # restrictions.
5999 6002
    if self.op.secondary_ip:
6000 6003
      # Ok even without locking, because this can't be changed by any LU
6001 6004
      master = self.cfg.GetNodeInfo(self.cfg.GetMasterNode())
6002 6005
      master_singlehomed = master.secondary_ip == master.primary_ip
6003
      if master_singlehomed and self.op.secondary_ip:
6004
        raise errors.OpPrereqError("Cannot change the secondary ip on a single"
6005
                                   " homed cluster", errors.ECODE_INVAL)
6006
      if master_singlehomed and self.op.secondary_ip != node.primary_ip:
6007
        if self.op.force and node.name == master.name:
6008
          self.LogWarning("Transitioning from single-homed to multi-homed"
6009
                          " cluster. All nodes will require a secondary ip.")
6010
        else:
6011
          raise errors.OpPrereqError("Changing the secondary ip on a"
6012
                                     " single-homed cluster requires the"
6013
                                     " --force option to be passed, and the"
6014
                                     " target node to be the master",
6015
                                     errors.ECODE_INVAL)
6016
      elif not master_singlehomed and self.op.secondary_ip == node.primary_ip:
6017
        if self.op.force and node.name == master.name:
6018
          self.LogWarning("Transitioning from multi-homed to single-homed"
6019
                          " cluster. Secondary IPs will have to be removed.")
6020
        else:
6021
          raise errors.OpPrereqError("Cannot set the secondary IP to be the"
6022
                                     " same as the primary IP on a multi-homed"
6023
                                     " cluster, unless the --force option is"
6024
                                     " passed, and the target node is the"
6025
                                     " master", errors.ECODE_INVAL)
6006 6026

  
6007 6027
      assert not (frozenset(affected_instances) -
6008 6028
                  self.owned_locks(locking.LEVEL_INSTANCE))
b/man/gnt-node.rst
313 313

  
314 314
The ``-s (--secondary-ip)`` option can be used to change the node's
315 315
secondary ip. No drbd instances can be running on the node, while this
316
operation is taking place.
316
operation is taking place. Remember that the secondary ip must be
317
reachable from the master secondary ip, when being changed, so be sure
318
that the node has the new IP already configured and active. In order to
319
convert a cluster from single homed to multi-homed or vice versa
320
``--force`` is needed as well, and the target node for the first change
321
must be the master.
317 322

  
318 323
See **ganeti(7)** for a description of ``--submit`` and other common
319 324
options.

Also available in: Unified diff