本文整理汇总了Python中nailgun.objects.NodeCollection.filter_by方法的典型用法代码示例。如果您正苦于以下问题:Python NodeCollection.filter_by方法的具体用法?Python NodeCollection.filter_by怎么用?Python NodeCollection.filter_by使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类nailgun.objects.NodeCollection
的用法示例。
在下文中一共展示了NodeCollection.filter_by方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_clusters_info
# 需要导入模块: from nailgun.objects import NodeCollection [as 别名]
# 或者: from nailgun.objects.NodeCollection import filter_by [as 别名]
def get_clusters_info(self):
clusters = ClusterCollection.all()
clusters_info = []
for cluster in clusters:
release = cluster.release
nodes_num = NodeCollection.filter_by(
None, cluster_id=cluster.id).count()
cluster_info = {
'id': cluster.id,
'nodes_num': nodes_num,
'release': {
'os': release.operating_system,
'name': release.name,
'version': release.version
},
'mode': cluster.mode,
'nodes': self.get_nodes_info(cluster.nodes),
'node_groups': self.get_node_groups_info(cluster.node_groups),
'status': cluster.status,
'attributes': self.get_attributes(cluster.attributes.editable,
self.attributes_white_list),
'vmware_attributes': self.get_attributes(
cluster.vmware_attributes.editable,
self.vmware_attributes_white_list
),
'net_provider': cluster.net_provider,
'fuel_version': cluster.fuel_version,
'is_customized': cluster.is_customized,
'network_configuration': self.get_network_configuration_info(
cluster),
'installed_plugins': self.get_cluster_plugins_info(cluster)
}
clusters_info.append(cluster_info)
return clusters_info
示例2: get_installation_info
# 需要导入模块: from nailgun.objects import NodeCollection [as 别名]
# 或者: from nailgun.objects.NodeCollection import filter_by [as 别名]
def get_installation_info(self):
clusters_info = self.get_clusters_info()
allocated_nodes_num = sum([c['nodes_num'] for c in clusters_info])
unallocated_nodes_num = NodeCollection.filter_by(
None, cluster_id=None).count()
info = {
'master_node_uid': self.get_master_node_uid(),
'fuel_release': self.fuel_release_info(),
'clusters': clusters_info,
'clusters_num': len(clusters_info),
'allocated_nodes_num': allocated_nodes_num,
'unallocated_nodes_num': unallocated_nodes_num
}
return info
示例3: get_clusters_info
# 需要导入模块: from nailgun.objects import NodeCollection [as 别名]
# 或者: from nailgun.objects.NodeCollection import filter_by [as 别名]
def get_clusters_info(self):
clusters = ClusterCollection.all()
clusters_info = []
for cluster in clusters:
release = cluster.release
nodes_num = NodeCollection.filter_by(
None, cluster_id=cluster.id).count()
cluster_info = {
'id': cluster.id,
'nodes_num': nodes_num,
'release': {
'os': release.operating_system,
'name': release.name,
'version': release.version
},
'mode': cluster.mode,
'nodes': self.get_nodes_info(cluster.nodes),
'status': cluster.status
}
clusters_info.append(cluster_info)
return clusters_info
示例4: get_clusters_info
# 需要导入模块: from nailgun.objects import NodeCollection [as 别名]
# 或者: from nailgun.objects.NodeCollection import filter_by [as 别名]
def get_clusters_info(self):
clusters = ClusterCollection.all()
clusters_info = []
for cluster in clusters:
release = cluster.release
nodes_num = NodeCollection.filter_by(
None, cluster_id=cluster.id).count()
cluster_info = {
'id': cluster.id,
'nodes_num': nodes_num,
'release': {
'os': release.operating_system,
'name': release.name,
'version': release.version
},
'mode': cluster.mode,
'nodes': self.get_nodes_info(cluster.nodes),
'node_groups': self.get_node_groups_info(cluster.node_groups),
'status': cluster.status,
'extensions': cluster.extensions,
'attributes': self.get_attributes(
Cluster.get_editable_attributes(cluster),
self.attributes_white_list
),
'plugin_links': self.get_plugin_links(
cluster.plugin_links),
'net_provider': cluster.net_provider,
'fuel_version': cluster.fuel_version,
'is_customized': cluster.is_customized,
'network_configuration': self.get_network_configuration_info(
cluster),
'installed_plugins': self.get_cluster_plugins_info(cluster),
'components': cluster.components,
'cluster_plugins': cluster.cluster_plugins,
'roles_metadata': cluster.roles_metadata,
'tags_metadata': cluster.tags_metadata,
'volumes_metadata': cluster.volumes_metadata,
}
clusters_info.append(cluster_info)
return clusters_info