本文整理汇总了Python中fuelclient.objects.environment.Environment.get_all_nodes方法的典型用法代码示例。如果您正苦于以下问题:Python Environment.get_all_nodes方法的具体用法?Python Environment.get_all_nodes怎么用?Python Environment.get_all_nodes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类fuelclient.objects.environment.Environment
的用法示例。
在下文中一共展示了Environment.get_all_nodes方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_fuel_node_ip
# 需要导入模块: from fuelclient.objects.environment import Environment [as 别名]
# 或者: from fuelclient.objects.environment.Environment import get_all_nodes [as 别名]
def get_fuel_node_ip(env):
fuel_node_ip = None
from fuelclient.objects.environment import Environment
e = Environment(env)
nodes_id = [x.data['id'] for x in e.get_all_nodes()]
for fact in e.get_default_facts('deployment', [nodes_id[0]]):
fuel_node_ip = fact['master_ip']
if fuel_node_ip:
break
return fuel_node_ip
示例2: get_nodes_info
# 需要导入模块: from fuelclient.objects.environment import Environment [as 别名]
# 或者: from fuelclient.objects.environment.Environment import get_all_nodes [as 别名]
def get_nodes_info(env):
from fuelclient.objects.environment import Environment
e = Environment(env)
nodes_info = []
for node in e.get_all_nodes():
node_info = {}
node_info['id'] = node.data['id']
node_info['fqdn'] = node.data['fqdn']
node_info['roles'] = node.data['roles']
for nic in node.data['network_data']:
if nic['name'] == 'fuelweb_admin':
node_info['fuelweb_admin'] = nic['ip']
if nic['name'] == 'management':
node_info['management'] = nic['ip']
nodes_info.append(node_info)
return nodes_info
示例3: env
# 需要导入模块: from fuelclient.objects.environment import Environment [as 别名]
# 或者: from fuelclient.objects.environment.Environment import get_all_nodes [as 别名]
def env(env_id, uids, full):
"""Prepares solar environment based on fuel environment.
It should perform all required changes for solar to work
"""
env = Environment(env_id)
uids = list(uids) if uids else [
str(n.data['id']) for n in env.get_all_nodes()]
for nobj in source.nodes(uids):
try:
# FIXME
resource.load('node%s' % nobj.data['id'])
except:
node(nobj)
fuel_data(nobj)
_prefetch(env, uids)
create_master()
allocate(
source.graph(env_id),
['null', 'master'] + uids if full else uids)
示例4: DeployTask
# 需要导入模块: from fuelclient.objects.environment import Environment [as 别名]
# 或者: from fuelclient.objects.environment.Environment import get_all_nodes [as 别名]
class DeployTask(Task):
def __init__(self, obj_id, env_id):
from fuelclient.objects.environment import Environment
super(DeployTask, self).__init__(obj_id)
self.env = Environment(env_id)
self.nodes = self.env.get_all_nodes()
@classmethod
def init_with_data(cls, data):
return cls(data["id"], data["cluster"])
@property
def not_finished_nodes(self):
return filter(
lambda n: not n.is_finished(latest=False),
self.nodes
)
@property
def is_finished(self):
return super(DeployTask, self).is_finished and all(
map(
methodcaller("is_finished"),
self.not_finished_nodes
)
)
def __iter__(self):
return self
def next(self):
if not self.is_finished:
sleep(1)
deploy_task_data = self.get_fresh_data()
if deploy_task_data["status"] == "error":
raise DeployProgressError(deploy_task_data["message"])
for node in self.not_finished_nodes:
node.update()
return self.progress, self.nodes
else:
raise StopIteration