本文整理汇总了Python中nailgun.objects.Cluster.get_nodes_not_for_deletion方法的典型用法代码示例。如果您正苦于以下问题:Python Cluster.get_nodes_not_for_deletion方法的具体用法?Python Cluster.get_nodes_not_for_deletion怎么用?Python Cluster.get_nodes_not_for_deletion使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类nailgun.objects.Cluster
的用法示例。
在下文中一共展示了Cluster.get_nodes_not_for_deletion方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: generate_network_metadata
# 需要导入模块: from nailgun.objects import Cluster [as 别名]
# 或者: from nailgun.objects.Cluster import get_nodes_not_for_deletion [as 别名]
def generate_network_metadata(cls, cluster):
nodes = dict()
nm = Cluster.get_network_manager(cluster)
for n in Cluster.get_nodes_not_for_deletion(cluster):
name = Node.get_slave_name(n)
node_roles = Node.all_roles(n)
ip_by_net = {"fuelweb_admin": None, "storage": None, "management": None, "public": None}
for net in ip_by_net:
netgroup = nm.get_node_network_by_netname(n, net)
if netgroup.get("ip"):
ip_by_net[net] = netgroup["ip"].split("/")[0]
netw_roles = {
"admin/pxe": ip_by_net["fuelweb_admin"],
"fw-admin": ip_by_net["fuelweb_admin"],
"keystone/api": ip_by_net["management"],
"swift/api": ip_by_net["management"],
"sahara/api": ip_by_net["management"],
"ceilometer/api": ip_by_net["management"],
"cinder/api": ip_by_net["management"],
"glance/api": ip_by_net["management"],
"heat/api": ip_by_net["management"],
"nova/api": ip_by_net["management"],
"murano/api": ip_by_net["management"],
"horizon": ip_by_net["management"],
"management": ip_by_net["management"],
"mgmt/api": ip_by_net["management"],
"mgmt/database": ip_by_net["management"],
"mgmt/messaging": ip_by_net["management"],
"mgmt/corosync": ip_by_net["management"],
"mgmt/memcache": ip_by_net["management"],
"mgmt/vip": ip_by_net["management"],
"mongo/db": ip_by_net["management"],
"ceph/public": ip_by_net["management"],
"storage": ip_by_net["storage"],
"ceph/replication": ip_by_net["storage"],
"swift/replication": ip_by_net["storage"],
"cinder/iscsi": ip_by_net["storage"],
"ex": ip_by_net["public"],
"public/vip": ip_by_net["public"],
"ceph/radosgw": ip_by_net["public"],
}
nodes[name] = {
"uid": n.uid,
"fqdn": n.fqdn,
"name": name,
"user_node_name": n.name,
"swift_zone": n.uid,
"node_roles": node_roles,
"network_roles": netw_roles,
}
return dict(nodes=nodes, vips=nm.assign_vips_for_net_groups(cluster))
示例2: update_nodes_net_info
# 需要导入模块: from nailgun.objects import Cluster [as 别名]
# 或者: from nailgun.objects.Cluster import get_nodes_not_for_deletion [as 别名]
def update_nodes_net_info(cls, cluster, nodes):
"""Adds information about networks to each node."""
for node in Cluster.get_nodes_not_for_deletion(cluster):
netw_data = node.network_data
addresses = {}
for net in node.cluster.network_groups:
if net.name == "public" and not Node.should_have_public(node):
continue
if net.meta.get("render_addr_mask"):
addresses.update(cls.get_addr_mask(netw_data, net.name, net.meta.get("render_addr_mask")))
[n.update(addresses) for n in nodes if n["uid"] == str(node.uid)]
return nodes
示例3: update_nodes_net_info
# 需要导入模块: from nailgun.objects import Cluster [as 别名]
# 或者: from nailgun.objects.Cluster import get_nodes_not_for_deletion [as 别名]
def update_nodes_net_info(cls, cluster, nodes):
"""Adds information about networks to each node.
This info is deprecated in 7.0 and should be removed in later version.
"""
nm = Cluster.get_network_manager(cluster)
for node in Cluster.get_nodes_not_for_deletion(cluster):
netw_data = []
for name, data in six.iteritems(nm.get_node_networks_with_ips(node)):
data["name"] = name
netw_data.append(data)
addresses = {}
for net in netw_data:
render_addr_mask = net["meta"].get("render_addr_mask")
if render_addr_mask:
addresses.update(cls.get_addr_mask(netw_data, net["name"], render_addr_mask))
[n.update(addresses) for n in nodes if n["uid"] == str(node.uid)]
return nodes
示例4: generate_network_metadata
# 需要导入模块: from nailgun.objects import Cluster [as 别名]
# 或者: from nailgun.objects.Cluster import get_nodes_not_for_deletion [as 别名]
def generate_network_metadata(cls, cluster):
nodes = dict()
nm = Cluster.get_network_manager(cluster)
for node in Cluster.get_nodes_not_for_deletion(cluster):
name = Node.get_slave_name(node)
node_roles = Node.all_roles(node)
network_roles = cls.get_network_role_mapping_to_ip(node)
nodes[name] = {
"uid": node.uid,
"fqdn": Node.get_node_fqdn(node),
"name": name,
"user_node_name": node.name,
"swift_zone": node.uid,
"node_roles": node_roles,
"network_roles": network_roles,
}
return dict(nodes=nodes, vips=nm.assign_vips_for_net_groups(cluster))
示例5: update_nodes_net_info
# 需要导入模块: from nailgun.objects import Cluster [as 别名]
# 或者: from nailgun.objects.Cluster import get_nodes_not_for_deletion [as 别名]
def update_nodes_net_info(cls, cluster, nodes):
"""Adds information about networks to each node.
This info is deprecated in 7.0 and should be removed in later version.
"""
nm = Cluster.get_network_manager(cluster)
for node in Cluster.get_nodes_not_for_deletion(cluster):
netw_data = []
for name, data in six.iteritems(nm.get_node_ips(node)):
data['name'] = name
netw_data.append(data)
addresses = {}
for net in node.cluster.network_groups:
if net.name == 'public' and \
not Node.should_have_public_with_ip(node):
continue
if net.meta.get('render_addr_mask'):
addresses.update(cls.get_addr_mask(
netw_data,
net.name,
net.meta.get('render_addr_mask')))
[n.update(addresses) for n in nodes
if n['uid'] == str(node.uid)]
return nodes
示例6: generate_network_metadata
# 需要导入模块: from nailgun.objects import Cluster [as 别名]
# 或者: from nailgun.objects.Cluster import get_nodes_not_for_deletion [as 别名]
def generate_network_metadata(cls, cluster):
nodes = dict()
nm = Cluster.get_network_manager(cluster)
for n in Cluster.get_nodes_not_for_deletion(cluster):
name = Node.get_slave_name(n)
node_roles = Node.all_roles(n)
# Use permanent identifier as a node key
key = Node.permanent_id(n)
ip_by_net = {
'fuelweb_admin': None,
'storage': None,
'management': None,
'public': None
}
networks = nm.get_node_networks(n)
for net in ip_by_net:
netgroup = nm.get_network_by_netname(net, networks)
if netgroup.get('ip'):
ip_by_net[net] = netgroup['ip'].split('/')[0]
netw_roles = {
'admin/pxe': ip_by_net['fuelweb_admin'],
'fw-admin': ip_by_net['fuelweb_admin'],
'keystone/api': ip_by_net['management'],
'swift/api': ip_by_net['management'],
'sahara/api': ip_by_net['management'],
'ceilometer/api': ip_by_net['management'],
'cinder/api': ip_by_net['management'],
'glance/api': ip_by_net['management'],
'heat/api': ip_by_net['management'],
'nova/api': ip_by_net['management'],
'murano/api': ip_by_net['management'],
'horizon': ip_by_net['management'],
'management': ip_by_net['management'],
'mgmt/database': ip_by_net['management'],
'mgmt/messaging': ip_by_net['management'],
'mgmt/corosync': ip_by_net['management'],
'mgmt/memcache': ip_by_net['management'],
'mgmt/vip': ip_by_net['management'],
'mongo/db': ip_by_net['management'],
'ceph/public': ip_by_net['management'],
'storage': ip_by_net['storage'],
'ceph/replication': ip_by_net['storage'],
'swift/replication': ip_by_net['storage'],
'cinder/iscsi': ip_by_net['storage'],
'ex': ip_by_net['public'],
'public/vip': ip_by_net['public'],
'ceph/radosgw': ip_by_net['public'],
}
nodes[key] = {
"uid": n.uid,
"fqdn": Node.get_node_fqdn(n),
"name": name,
"user_node_name": n.name,
"swift_zone": n.uid,
"node_roles": node_roles,
"network_roles": netw_roles
}
return dict(
nodes=nodes,
vips=nm.assign_vips_for_net_groups(cluster)
)
示例7: generate_network_metadata
# 需要导入模块: from nailgun.objects import Cluster [as 别名]
# 或者: from nailgun.objects.Cluster import get_nodes_not_for_deletion [as 别名]
def generate_network_metadata(cls, cluster):
nodes = dict()
nm = Cluster.get_network_manager(cluster)
for n in Cluster.get_nodes_not_for_deletion(cluster):
name = Node.make_slave_name(n)
node_roles = Node.all_roles(n)
ip_by_net = {
'fuelweb_admin': None,
'storage': None,
'management': None,
'public': None
}
for net in ip_by_net:
netgroup = nm.get_node_network_by_netname(n, net)
if netgroup.get('ip'):
ip_by_net[net] = netgroup['ip'].split('/')[0]
netw_roles = {
'admin/pxe': ip_by_net['fuelweb_admin'],
'fw-admin': ip_by_net['fuelweb_admin'],
'keystone/api': ip_by_net['management'],
'neutron/api': ip_by_net['management'],
'swift/api': ip_by_net['management'],
'sahara/api': ip_by_net['management'],
'ceilometer/api': ip_by_net['management'],
'cinder/api': ip_by_net['management'],
'glance/api': ip_by_net['management'],
'heat/api': ip_by_net['management'],
'nova/api': ip_by_net['management'],
'murano/api': ip_by_net['management'],
'horizon': ip_by_net['management'],
'management': ip_by_net['management'],
'mgmt/api': ip_by_net['management'],
'mgmt/database': ip_by_net['management'],
'mgmt/messaging': ip_by_net['management'],
'mgmt/corosync': ip_by_net['management'],
'mgmt/memcache': ip_by_net['management'],
'mgmt/vip': ip_by_net['management'],
'mongo/db': ip_by_net['management'],
'neutron/mesh': ip_by_net['management'],
'ceph/public': ip_by_net['management'],
'neutron/private': None,
'neutron/floating': None,
'storage': ip_by_net['storage'],
'ceph/replication': ip_by_net['storage'],
'swift/replication': ip_by_net['storage'],
'cinder/iscsi': ip_by_net['storage'],
}
if Node.should_have_public(n):
netw_roles.update({
'ex': ip_by_net['public'],
'public/vip': ip_by_net['public'],
'ceph/radosgw': ip_by_net['public'],
})
nodes[name] = {
"uid": n.uid,
"fqdn": n.fqdn,
"name": name,
"user_node_name": n.name,
"swift_zone": n.uid,
"node_roles": node_roles,
"network_roles": netw_roles
}
return dict(
nodes=nodes,
vips=nm.assign_vips_for_net_groups(cluster)
)