Marks mysql slave read-only
When a slave is attached to a master site, this change will mark the slave site as read-only to prevent the slave site from being updated by users. Only users with root privileges or slave priveleges will be able to update the database. Change-Id: Idb6c54b85a23af9a468ff9d62b3110fa72ff7da0 Closes-bug: #1359392
This commit is contained in:
parent
02a48b26e0
commit
b4250c05f9
|
@ -39,6 +39,7 @@ SLAVE_CONFIG = """
|
|||
[mysqld]
|
||||
log_bin = /var/lib/mysql/mysql-bin.log
|
||||
relay_log = /var/lib/mysql/mysql-relay-bin.log
|
||||
read_only = true
|
||||
"""
|
||||
|
||||
REPL_BACKUP_NAMESPACE = 'trove.guestagent.strategies.backup.mysql_impl'
|
||||
|
|
|
@ -116,6 +116,13 @@ class VerifySlave(object):
|
|||
poll_until(slave_is_running())
|
||||
|
||||
@test(depends_on=[test_correctly_started_replication])
|
||||
def test_slave_is_read_only(self):
|
||||
cmd = "mysql -BNq -e \\\'select @@read_only\\\'"
|
||||
server = create_server_connection(slave_instance.id)
|
||||
stdout, stderr = server.execute(cmd)
|
||||
assert_equal(stdout, "1\n")
|
||||
|
||||
@test(depends_on=[test_slave_is_read_only])
|
||||
def test_create_db_on_master(self):
|
||||
databases = [{'name': slave_instance.replicated_db}]
|
||||
instance_info.dbaas.databases.create(instance_info.id, databases)
|
||||
|
@ -174,6 +181,16 @@ class DetachReplica(object):
|
|||
|
||||
poll_until(slave_is_running(False))
|
||||
|
||||
@test(depends_on=[test_detach_replica])
|
||||
def test_slave_is_not_read_only(self):
|
||||
if CONFIG.fake_mode:
|
||||
raise SkipTest("Test not_read_only not supported in fake mode")
|
||||
|
||||
cmd = "mysql -BNq -e \\\'select @@read_only\\\'"
|
||||
server = create_server_connection(slave_instance.id)
|
||||
stdout, stderr = server.execute(cmd)
|
||||
assert_equal(stdout, "0\n")
|
||||
|
||||
|
||||
@test(groups=[GROUP],
|
||||
depends_on=[WaitForCreateSlaveToFinish],
|
||||
|
|
Loading…
Reference in New Issue