本文整理汇总了Python中nailgun.statistics.fuel_statistics.installation_info.InstallationInfo.get_nodes_info方法的典型用法代码示例。如果您正苦于以下问题:Python InstallationInfo.get_nodes_info方法的具体用法?Python InstallationInfo.get_nodes_info怎么用?Python InstallationInfo.get_nodes_info使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类nailgun.statistics.fuel_statistics.installation_info.InstallationInfo
的用法示例。
在下文中一共展示了InstallationInfo.get_nodes_info方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_nodes_info
# 需要导入模块: from nailgun.statistics.fuel_statistics.installation_info import InstallationInfo [as 别名]
# 或者: from nailgun.statistics.fuel_statistics.installation_info.InstallationInfo import get_nodes_info [as 别名]
def test_nodes_info(self):
info = InstallationInfo()
cluster = self.env.create(
release_kwargs={
'operating_system': consts.RELEASE_OS.centos
})
self.env.create_nodes_w_interfaces_count(
nodes_count=2,
if_count=4,
roles=['controller', 'compute'],
pending_addition=True,
cluster_id=cluster['id'])
self.env.make_bond_via_api(
'bond0', consts.BOND_MODES.active_backup,
['eth1', 'eth2'], node_id=self.env.nodes[0].id,
attrs={'type__': {'value': consts.BOND_TYPES.linux}})
nodes_info = info.get_nodes_info(self.env.nodes)
self.assertEquals(len(self.env.nodes), len(nodes_info))
for idx, node in enumerate(self.env.nodes):
node_info = nodes_info[idx]
self.assertEquals(node_info['id'], node.id)
self.assertEquals(node_info['group_id'], node.group_id)
self.assertListEqual(node_info['roles'], node.roles)
self.assertEquals(node_info['os'], node.os_platform)
self.assertEquals(node_info['status'], node.status)
self.assertEquals(node_info['error_type'], node.error_type)
self.assertEquals(node_info['online'], node.online)
self.assertEquals(node_info['manufacturer'], node.manufacturer)
self.assertEquals(node_info['platform_name'], node.platform_name)
self.assertIn('meta', node_info)
for iface in node_info['meta']['interfaces']:
self.assertNotIn('mac', iface)
self.assertNotIn('fqdn', node_info['meta']['system'])
self.assertNotIn('serial', node_info['meta']['system'])
self.assertIn('cpu', node_info['meta'])
self.assertIn('memory', node_info['meta'])
self.assertIn('disks', node_info['meta'])
self.assertIn('pci_devices', node_info['meta'])
self.assertIn('interfaces', node_info['meta'])
self.assertIn('numa_topology', node_info['meta'])
self.assertEquals(node_info['pending_addition'],
node.pending_addition)
self.assertEquals(node_info['pending_deletion'],
node.pending_deletion)
self.assertEquals(node_info['pending_roles'], node.pending_roles)
self.assertEqual(
node_info['nic_interfaces'],
[{'id': i.id} for i in node.nic_interfaces]
)
self.assertEqual(
node_info['bond_interfaces'],
[{'id': i.id, 'slaves': [s.id for s in i.slaves]}
for i in node.bond_interfaces]
)
示例2: test_nodes_info
# 需要导入模块: from nailgun.statistics.fuel_statistics.installation_info import InstallationInfo [as 别名]
# 或者: from nailgun.statistics.fuel_statistics.installation_info.InstallationInfo import get_nodes_info [as 别名]
def test_nodes_info(self):
info = InstallationInfo()
self.env.create(
release_kwargs={
'operating_system': consts.RELEASE_OS.centos
},
nodes_kwargs=[
{'status': consts.NODE_STATUSES.discover,
'roles': ['controller', 'compute'],
'meta': {}},
{'roles': [],
'pending_roles': ['compute'],
'meta': {'cpu': {},
'interfaces': [{'mac': 'x', 'name': 'eth0'}],
'disks': [{'name': 'a', 'disk': 'a'}]}}
]
)
self.env.make_bond_via_api(
'bond0', consts.BOND_MODES.active_backup,
['eth0', 'eth1'], node_id=self.env.nodes[0].id)
nodes_info = info.get_nodes_info(self.env.nodes)
self.assertEquals(len(self.env.nodes), len(nodes_info))
for idx, node in enumerate(self.env.nodes):
node_info = nodes_info[idx]
self.assertEquals(node_info['id'], node.id)
self.assertEquals(node_info['group_id'], node.group_id)
self.assertListEqual(node_info['roles'], node.roles)
self.assertEquals(node_info['os'], node.os_platform)
self.assertEquals(node_info['status'], node.status)
self.assertEquals(node_info['error_type'], node.error_type)
self.assertEquals(node_info['online'], node.online)
self.assertEquals(node_info['manufacturer'], node.manufacturer)
self.assertEquals(node_info['platform_name'], node.platform_name)
self.assertIn('meta', node_info)
for iface in node_info['meta']['interfaces']:
self.assertNotIn('mac', iface)
self.assertNotIn('fqdn', node_info['meta']['system'])
self.assertNotIn('serial', node_info['meta']['system'])
self.assertEquals(node_info['pending_addition'],
node.pending_addition)
self.assertEquals(node_info['pending_deletion'],
node.pending_deletion)
self.assertEquals(node_info['pending_roles'], node.pending_roles)
self.assertEqual(
node_info['nic_interfaces'],
[{'id': i.id} for i in node.nic_interfaces]
)
self.assertEqual(
node_info['bond_interfaces'],
[{'id': i.id, 'slaves': [s.id for s in i.slaves]}
for i in node.bond_interfaces]
)
示例3: test_nodes_info
# 需要导入模块: from nailgun.statistics.fuel_statistics.installation_info import InstallationInfo [as 别名]
# 或者: from nailgun.statistics.fuel_statistics.installation_info.InstallationInfo import get_nodes_info [as 别名]
def test_nodes_info(self):
info = InstallationInfo()
cluster = self.env.create(release_kwargs={"operating_system": consts.RELEASE_OS.centos})
self.env.create_nodes_w_interfaces_count(
nodes_count=2, if_count=4, roles=["controller", "compute"], pending_addition=True, cluster_id=cluster["id"]
)
self.env.make_bond_via_api(
"bond0", consts.BOND_MODES.active_backup, ["eth1", "eth2"], node_id=self.env.nodes[0].id
)
nodes_info = info.get_nodes_info(self.env.nodes)
self.assertEquals(len(self.env.nodes), len(nodes_info))
for idx, node in enumerate(self.env.nodes):
node_info = nodes_info[idx]
self.assertEquals(node_info["id"], node.id)
self.assertEquals(node_info["group_id"], node.group_id)
self.assertListEqual(node_info["roles"], node.roles)
self.assertEquals(node_info["os"], node.os_platform)
self.assertEquals(node_info["status"], node.status)
self.assertEquals(node_info["error_type"], node.error_type)
self.assertEquals(node_info["online"], node.online)
self.assertEquals(node_info["manufacturer"], node.manufacturer)
self.assertEquals(node_info["platform_name"], node.platform_name)
self.assertIn("meta", node_info)
for iface in node_info["meta"]["interfaces"]:
self.assertNotIn("mac", iface)
self.assertNotIn("fqdn", node_info["meta"]["system"])
self.assertNotIn("serial", node_info["meta"]["system"])
self.assertEquals(node_info["pending_addition"], node.pending_addition)
self.assertEquals(node_info["pending_deletion"], node.pending_deletion)
self.assertEquals(node_info["pending_roles"], node.pending_roles)
self.assertEqual(node_info["nic_interfaces"], [{"id": i.id} for i in node.nic_interfaces])
self.assertEqual(
node_info["bond_interfaces"],
[{"id": i.id, "slaves": [s.id for s in i.slaves]} for i in node.bond_interfaces],
)