本文整理匯總了Python中fuelweb_test.models.nailgun_client.NailgunClient.list_clusters方法的典型用法代碼示例。如果您正苦於以下問題:Python NailgunClient.list_clusters方法的具體用法?Python NailgunClient.list_clusters怎麽用?Python NailgunClient.list_clusters使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類fuelweb_test.models.nailgun_client.NailgunClient
的用法示例。
在下文中一共展示了NailgunClient.list_clusters方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: FuelWebClient
# 需要導入模塊: from fuelweb_test.models.nailgun_client import NailgunClient [as 別名]
# 或者: from fuelweb_test.models.nailgun_client.NailgunClient import list_clusters [as 別名]
#.........這裏部分代碼省略.........
self.assert_task_success(task, timeout=timeout, interval=interval)
@logwrap
def deploy_cluster(self, cluster_id):
"""Return hash with task description."""
return self.client.deploy_cluster_changes(cluster_id)
@logwrap
def get_cluster_floating_list(self, node_name):
remote = self.get_ssh_for_node(node_name)
ret = remote.check_call("/usr/bin/nova-manage floating list")
ret_str = "".join(ret["stdout"])
return re.findall("(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})", ret_str)
@logwrap
def get_cluster_block_devices(self, node_name):
remote = self.get_ssh_for_node(node_name)
ret = remote.check_call("/bin/lsblk")
return "".join(ret["stdout"])
@logwrap
def get_pacemaker_status(self, controller_node_name):
remote = self.get_ssh_for_node(controller_node_name)
return "".join(remote.check_call("crm_mon -1")["stdout"])
@logwrap
def get_pacemaker_config(self, controller_node_name):
remote = self.get_ssh_for_node(controller_node_name)
return "".join(remote.check_call("crm configure show")["stdout"])
@logwrap
def get_last_created_cluster(self):
# return id of last created cluster
clusters = self.client.list_clusters()
if len(clusters) > 0:
return clusters.pop()["id"]
return None
@logwrap
def get_nailgun_node_roles(self, nodes_dict):
nailgun_node_roles = []
for node_name in nodes_dict:
slave = self.environment.get_virtual_environment().node_by_name(node_name)
node = self.get_nailgun_node_by_devops_node(slave)
nailgun_node_roles.append((node, nodes_dict[node_name]))
return nailgun_node_roles
@logwrap
def get_nailgun_node_by_name(self, node_name):
return self.get_nailgun_node_by_devops_node(self.environment.get_virtual_environment().node_by_name(node_name))
@logwrap
def get_nailgun_node_by_devops_node(self, devops_node):
"""Return slave node description.
Returns dict with nailgun slave node description if node is
registered. Otherwise return None.
"""
mac_addresses = map(lambda interface: interface.mac_address.capitalize(), devops_node.interfaces)
for nailgun_node in self.client.list_nodes():
if nailgun_node["mac"].capitalize() in mac_addresses:
nailgun_node["devops_name"] = devops_node.name
return nailgun_node
return None
@logwrap
示例2: FuelWebClient
# 需要導入模塊: from fuelweb_test.models.nailgun_client import NailgunClient [as 別名]
# 或者: from fuelweb_test.models.nailgun_client.NailgunClient import list_clusters [as 別名]
#.........這裏部分代碼省略.........
if not cluster_id:
raise Exception("Could not get cluster '%s'" % name)
self.client.add_syslog_server(
cluster_id, self.environment.get_host_node_ip(), port)
return cluster_id
def deploy_cluster_wait(self, cluster_id):
task = self.deploy_cluster(cluster_id)
self.assert_task_success(task, interval=30)
@logwrap
def deploy_cluster(self, cluster_id):
"""Return hash with task description."""
return self.client.deploy_cluster_changes(cluster_id)
@logwrap
def get_cluster_floating_list(self, node_name):
remote = self.get_ssh_for_node(node_name)
ret = remote.check_call('/usr/bin/nova-manage floating list')
ret_str = ''.join(ret['stdout'])
return re.findall('(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})', ret_str)
@logwrap
def get_cluster_block_devices(self, node_name):
remote = self.get_ssh_for_node(node_name)
ret = remote.check_call('/bin/lsblk')
return ''.join(ret['stdout'])
@logwrap
def get_last_created_cluster(self):
# return id of last created cluster
clusters = self.client.list_clusters()
if len(clusters) > 0:
return clusters.pop()['id']
return None
@logwrap
def get_nailgun_node_roles(self, nodes_dict):
nailgun_node_roles = []
for node_name in nodes_dict:
slave = self.environment.get_virtual_environment().\
node_by_name(node_name)
node = self.get_nailgun_node_by_devops_node(slave)
nailgun_node_roles.append((node, nodes_dict[node_name]))
return nailgun_node_roles
@logwrap
def get_nailgun_node_by_name(self, node_name):
return self.get_nailgun_node_by_devops_node(
self.environment.get_virtual_environment().node_by_name(node_name))
@logwrap
def get_nailgun_node_by_devops_node(self, devops_node):
"""
Returns dict with nailgun slave node description if node is
registered. Otherwise return None.
"""
mac_addresses = map(
lambda interface: interface.mac_address.capitalize(),
devops_node.interfaces
)
for nailgun_node in self.client.list_nodes():
if nailgun_node['mac'].capitalize() in mac_addresses:
nailgun_node['devops_name'] = devops_node.name
示例3: FuelWebClient
# 需要導入模塊: from fuelweb_test.models.nailgun_client import NailgunClient [as 別名]
# 或者: from fuelweb_test.models.nailgun_client.NailgunClient import list_clusters [as 別名]
#.........這裏部分代碼省略.........
return self.client.deploy_cluster_changes(cluster_id)
@logwrap
def get_cluster_floating_list(self, node_name):
logger.info('Get floating IPs list at %s devops node', node_name)
remote = self.get_ssh_for_node(node_name)
ret = remote.check_call('/usr/bin/nova-manage floating list')
ret_str = ''.join(ret['stdout'])
return re.findall('(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})', ret_str)
@logwrap
def get_cluster_block_devices(self, node_name):
logger.info('Get %s node block devices (lsblk)', node_name)
remote = self.get_ssh_for_node(node_name)
ret = remote.check_call('/bin/lsblk')
return ''.join(ret['stdout'])
@logwrap
def get_pacemaker_status(self, controller_node_name):
logger.info('Get pacemaker status at %s node', controller_node_name)
remote = self.get_ssh_for_node(controller_node_name)
return ''.join(remote.check_call('crm_mon -1')['stdout'])
@logwrap
def get_pacemaker_config(self, controller_node_name):
logger.info('Get pacemaker config at %s node', controller_node_name)
remote = self.get_ssh_for_node(controller_node_name)
return ''.join(remote.check_call('crm configure show')['stdout'])
@logwrap
def get_last_created_cluster(self):
# return id of last created cluster
logger.info('Get ID of a last created cluster')
clusters = self.client.list_clusters()
if len(clusters) > 0:
return clusters.pop()['id']
return None
@logwrap
def get_nailgun_node_roles(self, nodes_dict):
nailgun_node_roles = []
for node_name in nodes_dict:
slave = self.environment.get_virtual_environment().\
node_by_name(node_name)
node = self.get_nailgun_node_by_devops_node(slave)
nailgun_node_roles.append((node, nodes_dict[node_name]))
return nailgun_node_roles
@logwrap
def get_nailgun_node_by_name(self, node_name):
logger.info('Get nailgun node by %s devops node', node_name)
return self.get_nailgun_node_by_devops_node(
self.environment.get_virtual_environment().node_by_name(node_name))
@logwrap
def get_nailgun_node_by_devops_node(self, devops_node):
"""Return slave node description.
Returns dict with nailgun slave node description if node is
registered. Otherwise return None.
"""
d_macs = {i.mac_address.upper() for i in devops_node.interfaces}
logger.debug('Verify that nailgun api is running')
attempts = ATTEMPTS
while attempts > 0:
logger.debug(
'current timeouts is {0} count of '
示例4: FuelWebClient
# 需要導入模塊: from fuelweb_test.models.nailgun_client import NailgunClient [as 別名]
# 或者: from fuelweb_test.models.nailgun_client.NailgunClient import list_clusters [as 別名]
#.........這裏部分代碼省略.........
return self.client.deploy_cluster_changes(cluster_id)
@logwrap
def get_cluster_floating_list(self, node_name):
logger.info('Get floating IPs list at %s devops node', node_name)
remote = self.get_ssh_for_node(node_name)
ret = remote.check_call('/usr/bin/nova-manage floating list')
ret_str = ''.join(ret['stdout'])
return re.findall('(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})', ret_str)
@logwrap
def get_cluster_block_devices(self, node_name):
logger.info('Get %s node block devices (lsblk)', node_name)
remote = self.get_ssh_for_node(node_name)
ret = remote.check_call('/bin/lsblk')
return ''.join(ret['stdout'])
@logwrap
def get_pacemaker_status(self, controller_node_name):
logger.info('Get pacemaker status at %s node', controller_node_name)
remote = self.get_ssh_for_node(controller_node_name)
return ''.join(remote.check_call('crm_mon -1')['stdout'])
@logwrap
def get_pacemaker_config(self, controller_node_name):
logger.info('Get pacemaker config at %s node', controller_node_name)
remote = self.get_ssh_for_node(controller_node_name)
return ''.join(remote.check_call('crm configure show')['stdout'])
@logwrap
def get_last_created_cluster(self):
# return id of last created cluster
logger.info('Get ID of a last created cluster')
clusters = self.client.list_clusters()
if len(clusters) > 0:
return clusters.pop()['id']
return None
@logwrap
def get_nailgun_node_roles(self, nodes_dict):
nailgun_node_roles = []
for node_name in nodes_dict:
slave = self.environment.get_virtual_environment().\
node_by_name(node_name)
node = self.get_nailgun_node_by_devops_node(slave)
nailgun_node_roles.append((node, nodes_dict[node_name]))
return nailgun_node_roles
@logwrap
def get_nailgun_node_by_name(self, node_name):
logger.info('Get nailgun node by %s devops node', node_name)
return self.get_nailgun_node_by_devops_node(
self.environment.get_virtual_environment().node_by_name(node_name))
@logwrap
def get_nailgun_node_by_devops_node(self, devops_node):
"""Return slave node description.
Returns dict with nailgun slave node description if node is
registered. Otherwise return None.
"""
devops_macs = {i.mac_address.upper() for i in devops_node.interfaces}
logger.debug('Look for nailgun node by macs %s', devops_macs)
for nailgun_node in self.client.list_nodes():
macs = {i['mac'] for i in nailgun_node['meta']['interfaces']}
if devops_macs == macs:
nailgun_node['devops_name'] = devops_node.name
示例5: FuelWebClient
# 需要導入模塊: from fuelweb_test.models.nailgun_client import NailgunClient [as 別名]
# 或者: from fuelweb_test.models.nailgun_client.NailgunClient import list_clusters [as 別名]
#.........這裏部分代碼省略.........
if not cluster_id:
raise Exception("Could not get cluster '%s'" % name)
self.client.add_syslog_server(cluster_id, self.environment.get_host_node_ip(), port)
return cluster_id
def deploy_cluster_wait(self, cluster_id):
task = self.deploy_cluster(cluster_id)
self.assert_task_success(task, interval=30)
@logwrap
def deploy_cluster(self, cluster_id):
"""Return hash with task description."""
return self.client.deploy_cluster_changes(cluster_id)
@logwrap
def get_cluster_floating_list(self, node_name):
remote = self.get_ssh_for_node(node_name)
ret = remote.check_call("/usr/bin/nova-manage floating list")
ret_str = "".join(ret["stdout"])
return re.findall("(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})", ret_str)
@logwrap
def get_cluster_block_devices(self, node_name):
remote = self.get_ssh_for_node(node_name)
ret = remote.check_call("/bin/lsblk")
return "".join(ret["stdout"])
@logwrap
def get_last_created_cluster(self):
# return id of last created cluster
clusters = self.client.list_clusters()
if len(clusters) > 0:
return clusters.pop()["id"]
return None
@logwrap
def get_nailgun_node_roles(self, nodes_dict):
nailgun_node_roles = []
for node_name in nodes_dict:
slave = self.environment.get_virtual_environment().node_by_name(node_name)
node = self.get_nailgun_node_by_devops_node(slave)
nailgun_node_roles.append((node, nodes_dict[node_name]))
return nailgun_node_roles
@logwrap
def get_nailgun_node_by_name(self, node_name):
return self.get_nailgun_node_by_devops_node(self.environment.get_virtual_environment().node_by_name(node_name))
@logwrap
def get_nailgun_node_by_devops_node(self, devops_node):
"""
Returns dict with nailgun slave node description if node is
registered. Otherwise return None.
"""
mac_addresses = map(lambda interface: interface.mac_address.capitalize(), devops_node.interfaces)
for nailgun_node in self.client.list_nodes():
if nailgun_node["mac"].capitalize() in mac_addresses:
nailgun_node["devops_name"] = devops_node.name
return nailgun_node
return None
@logwrap