switchover.py: Add new options --replicating-master & --read-only-master

Authored by jcrespo on Jul 3 2019, 8:28 AM.


switchover.py: Add new options --replicating-master & --read-only-master

--replicating-master allows a master switchover to happen on even
if the master is replicating originally, and it stops and resets
its replication; and after switchover happens, it sets it back on
the newly promoted master.

This option, disabled by default, allows a switchover to happen on
intermediate masters or circular replicating masters, automating
the disabling and reenabling of replication.

Note that it still requires the master to be a real master (read
only option must be disabled). If a master is an intermediate or
passive master (where both hosts will always be in read only),
--read-only-master must be used, so the switchover
can happen, but read_only is kept as 1 on all servers during all
This option will also be useful on its own if the master is in a
weird state and writes are disallowed there (it still requires the
master to replicate correctly to the replica, otherwise, this
would not be a controlled switchover).

Switchover on a master-master setup is not allowed, as no topology
change is to be done in that case.

Aside from the new procedures, new verifications were added to
check that both options have expected initial and ending state.

Change-Id: Ica66fe925f2f53a67e3cbc7a0e760b395ad604b6