本文整理汇总了Python中trove.tests.util.server_connection.create_server_connection函数的典型用法代码示例。如果您正苦于以下问题:Python create_server_connection函数的具体用法?Python create_server_connection怎么用?Python create_server_connection使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了create_server_connection函数的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: mess_up_mysql
def mess_up_mysql(self):
"""Ruin MySQL's ability to restart."""
self.fix_mysql() # kill files
server = create_server_connection(self.instance_id)
cmd = "sudo cp /dev/null /var/lib/mysql/ib_logfile%d"
for index in range(2):
server.execute(cmd % index)
开发者ID:ReVolly,项目名称:trove,代码行数:7,代码来源:instances_actions.py
示例2: check_slave_is_running
def check_slave_is_running():
server = create_server_connection(slave_instance.id)
cmd = ("mysqladmin extended-status "
"| awk '/Slave_running/{print $4}'")
stdout, stderr = server.execute(cmd)
expected = "ON" if running else "OFF"
return stdout.rstrip() == expected
开发者ID:rmyers,项目名称:trove,代码行数:7,代码来源:replication.py
示例3: mess_up_mysql
def mess_up_mysql(self):
"""Ruin MySQL's ability to restart."""
server = create_server_connection(self.instance_id)
cmd = "sudo cp /dev/null /var/lib/mysql/ib_logfile%d"
instance_info.dbaas_admin.management.stop(self.instance_id)
for index in range(2):
server.execute(cmd % index)
开发者ID:VinodKrGupta,项目名称:trove,代码行数:7,代码来源:instances_actions.py
示例4: find_mysql_proc_on_instance
def find_mysql_proc_on_instance(self):
server = create_server_connection(self.instance_id)
cmd = "ps aux | grep /usr/sbin/mysqld " "| awk '{print $2}'"
stdout, stderr = server.execute(cmd)
try:
return int(stdout)
except ValueError:
return None
开发者ID:ReVolly,项目名称:trove,代码行数:8,代码来源:instances_actions.py
示例5: check_not_read_only
def check_not_read_only():
cmd = "mysql -BNq -e \\\'select @@read_only\\\'"
server = create_server_connection(slave_instance.id)
stdout, stderr = server.execute(cmd)
if (stdout.rstrip() != "0"):
return False
else:
return True
开发者ID:rmyers,项目名称:trove,代码行数:8,代码来源:replication.py
示例6: disable_master
def disable_master(self):
if CONFIG.fake_mode:
raise SkipTest("eject_replica_source not supported in fake mode")
cmd = "sudo service trove-guestagent stop"
server = create_server_connection(self._third_slave.id)
stdout, stderr = server.execute(cmd)
assert_equal(stdout, "1\n")
开发者ID:Tesora-Release,项目名称:tesora-trove,代码行数:8,代码来源:replication.py
示例7: test_slave_is_not_read_only
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")
开发者ID:AlexeyDeyneko,项目名称:trove,代码行数:8,代码来源:replication.py
示例8: find_mysql_proc_on_instance
def find_mysql_proc_on_instance(self):
server = create_server_connection(self.instance_id)
cmd = "ps acux | grep mysqld " \
"| grep -v mysqld_safe | awk '{print $2}'"
stdout, _ = server.execute(cmd)
try:
return int(stdout)
except ValueError:
return None
开发者ID:Tesora,项目名称:tesora-trove,代码行数:9,代码来源:instances_actions.py
示例9: fix_mysql
def fix_mysql(self):
"""Fix MySQL's ability to restart."""
if not FAKE_MODE:
server = create_server_connection(self.instance_id)
cmd = "sudo rm /var/lib/mysql/ib_logfile%d"
# We want to stop mysql so that upstart does not keep trying to
# respawn it and block the guest agent from accessing the logs.
instance_info.dbaas_admin.management.stop(self.instance_id)
for index in range(2):
server.execute(cmd % index)
开发者ID:ReVolly,项目名称:trove,代码行数:10,代码来源:instances_actions.py
示例10: prepare_test
def prepare_test(self):
"""Connect to swift, clean up containers."""
self.server = create_server_connection(instance_info.id)
user = test_config.users.find_user(
Requirements(is_admin=False, services=["swift"]))
self.swift_client = swiftclient.client.Connection(
authurl=test_config.nova_client['auth_url'],
user=user.auth_user,
key=user.auth_key,
tenant_name=user.tenant,
auth_version='2')
self.cleanup_swift()
开发者ID:Tesora-Release,项目名称:tesora-trove,代码行数:13,代码来源:guest_log.py
示例11: _get_user_count
def _get_user_count(server_info):
cmd = ('mysql -BNq -e \\\'select count\\(*\\) from mysql.user'
' where user like \\\"slave_%\\\"\\\'')
server = create_server_connection(server_info.id)
stdout, stderr = server.execute(cmd)
return int(stdout.rstrip())
开发者ID:rmyers,项目名称:trove,代码行数:6,代码来源:replication.py
示例12: test_slave_is_read_only
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")
开发者ID:rmyers,项目名称:trove,代码行数:5,代码来源:replication.py
示例13: slave_is_running
def slave_is_running():
server = create_server_connection(slave_instance.id)
cmd = ("mysqladmin extended-status "
"| awk '/Slave_running/{print $4}'")
stdout, stderr = server.execute(cmd)
return stdout == "ON\n"
开发者ID:mahak,项目名称:trove,代码行数:6,代码来源:replication.py
注:本文中的trove.tests.util.server_connection.create_server_connection函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论