本文整理汇总了Python中nailgun.objects.Node.make_slave_name方法的典型用法代码示例。如果您正苦于以下问题:Python Node.make_slave_name方法的具体用法?Python Node.make_slave_name怎么用?Python Node.make_slave_name使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类nailgun.objects.Node
的用法示例。
在下文中一共展示了Node.make_slave_name方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: generate_network_metadata
# 需要导入模块: from nailgun.objects import Node [as 别名]
# 或者: from nailgun.objects.Node import make_slave_name [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)
)