本文整理汇总了Python中ovs.extensions.generic.sshclient.SSHClient.rawconfig_read方法的典型用法代码示例。如果您正苦于以下问题:Python SSHClient.rawconfig_read方法的具体用法?Python SSHClient.rawconfig_read怎么用?Python SSHClient.rawconfig_read使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ovs.extensions.generic.sshclient.SSHClient
的用法示例。
在下文中一共展示了SSHClient.rawconfig_read方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: collapse_arakoon
# 需要导入模块: from ovs.extensions.generic.sshclient import SSHClient [as 别名]
# 或者: from ovs.extensions.generic.sshclient.SSHClient import rawconfig_read [as 别名]
def collapse_arakoon():
"""
Collapse Arakoon's Tlogs
:return: None
"""
logger.info('Starting arakoon collapse')
arakoon_clusters = {}
for service in ServiceList.get_services():
if service.type.name in ('Arakoon', 'NamespaceManager', 'AlbaManager'):
arakoon_clusters[service.name.replace('arakoon-', '')] = service.storagerouter
for cluster, storagerouter in arakoon_clusters.iteritems():
logger.info(' Collapsing cluster {0}'.format(cluster))
client = SSHClient(storagerouter)
parser = client.rawconfig_read(PyrakoonStore.ARAKOON_CONFIG_FILE.format(cluster))
nodes = {}
for node in parser.get('global', 'cluster').split(','):
node = node.strip()
nodes[node] = ([parser.get(node, 'ip')], parser.get(node, 'client_port'))
config = ArakoonClientConfig(str(cluster), nodes)
for node in nodes.keys():
logger.info(' Collapsing node: {0}'.format(node))
client = ArakoonAdminClient(node, config)
try:
client.collapse_tlogs(2)
except:
logger.exception('Error during collapsing cluster {0} node {1}'.format(cluster, node))
logger.info('Arakoon collapse finished')