本文整理汇总了Python中nailgun.objects.ReleaseCollection类的典型用法代码示例。如果您正苦于以下问题:Python ReleaseCollection类的具体用法?Python ReleaseCollection怎么用?Python ReleaseCollection使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ReleaseCollection类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_clusters_info
def test_clusters_info(self):
self.env.upload_fixtures(['openstack'])
info = InstallationInfo()
release = ReleaseCollection.filter_by(
None, operating_system=consts.RELEASE_OS.ubuntu)
nodes_params = [
{'roles': ['compute']},
{'roles': ['compute']},
{'roles': ['controller']}
]
cluster = self.env.create(
cluster_kwargs={
'release_id': release[0].id,
'mode': consts.CLUSTER_MODES.ha_compact,
'net_provider': consts.CLUSTER_NET_PROVIDERS.neutron},
nodes_kwargs=nodes_params
)
self.env.create_node(
{'status': consts.NODE_STATUSES.discover})
clusters_info = info.get_clusters_info()
self.assertEquals(1, len(clusters_info))
cluster_info = clusters_info[0]
self.assertEquals(len(nodes_params), len(cluster_info['nodes']))
self.assertEquals(len(nodes_params), cluster_info['nodes_num'])
self.assertEquals(consts.CLUSTER_MODES.ha_compact,
cluster_info['mode'])
self.assertEquals(consts.CLUSTER_NET_PROVIDERS.neutron,
cluster_info['net_provider'])
self.assertEquals(consts.CLUSTER_STATUSES.new,
cluster_info['status'])
self.assertEquals(False,
cluster_info['is_customized'])
self.assertEquals(cluster['id'],
cluster_info['id'])
self.assertEquals(cluster.fuel_version,
cluster_info['fuel_version'])
self.assertTrue('attributes' in cluster_info)
self.assertTrue('release' in cluster_info)
self.assertEquals(cluster.release.operating_system,
cluster_info['release']['os'])
self.assertEquals(cluster.release.name,
cluster_info['release']['name'])
self.assertEquals(cluster.release.version,
cluster_info['release']['version'])
self.assertEquals(1, len(cluster_info['node_groups']))
group_info = cluster_info['node_groups'][0]
group = [ng for ng in cluster.node_groups][0]
self.assertEquals(group.id,
group_info['id'])
self.assertEquals(len(nodes_params),
len(group_info['nodes']))
self.assertEquals(set([n.id for n in group.nodes]),
set(group_info['nodes']))
示例2: test_get_attributes_centos
def test_get_attributes_centos(self):
self.skipTest("CentOS is unavailable in current release.")
self.env.upload_fixtures(["openstack"])
info = InstallationInfo()
release = ReleaseCollection.filter_by(None, operating_system="CentOS")
cluster_data = self.env.create_cluster(release_id=release[0].id)
cluster = Cluster.get_by_uid(cluster_data["id"])
editable = cluster.attributes.editable
attr_key_list = [a[1] for a in info.attributes_white_list]
attrs_dict = info.get_attributes(editable, info.attributes_white_list)
self.assertEqual(set(attr_key_list), set(attrs_dict.keys()))
示例3: test_get_attributes_centos
def test_get_attributes_centos(self):
self.skipTest('CentOS is unavailable in current release.')
self.env.upload_fixtures(['openstack'])
releases = ReleaseCollection.filter_by(
None, operating_system=consts.RELEASE_OS.centos)
release = releases[0]
info = InstallationInfo()
attr_key_list = [a[1] for a in info.attributes_white_list]
# No UCA configs for CentOS.
expected_attributes = set(attr_key_list) - set(
('pin_haproxy', 'repo_type', 'pin_ceph', 'pin_rabbitmq'))
self._do_test_attributes_in_white_list(
release, expected_attributes)
示例4: test_get_attributes_ubuntu
def test_get_attributes_ubuntu(self):
self.env.upload_fixtures(["openstack"])
info = InstallationInfo()
release = ReleaseCollection.filter_by(None, operating_system="Ubuntu")
cluster_data = self.env.create_cluster(release_id=release[0].id)
cluster = Cluster.get_by_uid(cluster_data["id"])
editable = cluster.attributes.editable
attr_key_list = [a[1] for a in info.attributes_white_list]
attrs_dict = info.get_attributes(editable, info.attributes_white_list)
self.assertEqual(
# no vlan splinters for ubuntu
set(attr_key_list) - set(("vlan_splinters", "vlan_splinters_ovs")),
set(attrs_dict.keys()),
)
示例5: test_get_attributes_ubuntu_uca
def test_get_attributes_ubuntu_uca(self):
self.env.upload_fixtures(['openstack'])
releases = ReleaseCollection.filter_by(
None, operating_system=consts.RELEASE_OS.ubuntu).order_by(
ReleaseCollection.single.model.id)
release = releases[1]
info = InstallationInfo()
attr_key_list = [a[1] for a in info.attributes_white_list]
# No vlan splinters for Ubuntu, no mellanox related entries
# since 8.0.
expected_attributes = set(attr_key_list) - set(
('vlan_splinters', 'vlan_splinters_ovs',
'mellanox', 'mellanox_vf_num', 'iser'))
self._do_test_attributes_in_white_list(
release, expected_attributes)
示例6: test_get_attributes_centos
def test_get_attributes_centos(self):
self.env.upload_fixtures(['openstack'])
info = InstallationInfo()
release = ReleaseCollection.filter_by(None, operating_system='CentOS')
cluster_data = self.env.create_cluster(
release_id=release[0].id
)
cluster = Cluster.get_by_uid(cluster_data['id'])
editable = cluster.attributes.editable
attr_key_list = [a[1] for a in info.attributes_white_list]
attrs_dict = info.get_attributes(editable)
self.assertEqual(
set(attr_key_list),
set(attrs_dict.keys())
)
示例7: test_clusters_info_no_vmware_attributes_exception
def test_clusters_info_no_vmware_attributes_exception(self):
self.env.upload_fixtures(["openstack"])
info = InstallationInfo()
release = ReleaseCollection.filter_by(None, operating_system=consts.RELEASE_OS.ubuntu)
nodes_params = [{"roles": ["compute"]}, {"roles": ["compute"]}, {"roles": ["controller"]}]
self.env.create(
cluster_kwargs={
"release_id": release[0].id,
"mode": consts.CLUSTER_MODES.ha_compact,
"net_provider": consts.CLUSTER_NET_PROVIDERS.nova_network,
},
nodes_kwargs=nodes_params,
)
self.env.create_node({"status": consts.NODE_STATUSES.discover})
cluster = self.env.clusters[0]
VmwareAttributes.delete(cluster.vmware_attributes)
self.env.db.flush()
self.assertNotRaises(AttributeError, info.get_clusters_info)
示例8: test_get_attributes_ubuntu
def test_get_attributes_ubuntu(self):
self.env.upload_fixtures(['openstack'])
info = InstallationInfo()
release = ReleaseCollection.filter_by(None, operating_system='Ubuntu')
cluster_data = self.env.create_cluster(
release_id=release[0].id
)
cluster = Cluster.get_by_uid(cluster_data['id'])
editable = cluster.attributes.editable
attr_key_list = [a[1] for a in info.attributes_white_list]
attrs_dict = info.get_attributes(editable, info.attributes_white_list)
self.assertEqual(
# No vlan splinters for ubuntu.
# And no mellanox related entries since 8.0.
set(attr_key_list) - set(
('vlan_splinters', 'vlan_splinters_ovs',
'mellanox', 'mellanox_vf_num', 'iser')),
set(attrs_dict.keys())
)
示例9: test_clusters_info
def test_clusters_info(self):
self.env.upload_fixtures(["openstack"])
info = InstallationInfo()
release = ReleaseCollection.filter_by(None, operating_system=consts.RELEASE_OS.ubuntu)
nodes_params = [{"roles": ["compute"]}, {"roles": ["compute"]}, {"roles": ["controller"]}]
self.env.create(
cluster_kwargs={
"release_id": release[0].id,
"mode": consts.CLUSTER_MODES.ha_compact,
"net_provider": consts.CLUSTER_NET_PROVIDERS.nova_network,
},
nodes_kwargs=nodes_params,
)
self.env.create_node({"status": consts.NODE_STATUSES.discover})
clusters_info = info.get_clusters_info()
cluster = self.env.clusters[0]
self.assertEquals(1, len(clusters_info))
cluster_info = clusters_info[0]
self.assertEquals(len(nodes_params), len(cluster_info["nodes"]))
self.assertEquals(len(nodes_params), cluster_info["nodes_num"])
self.assertEquals(consts.CLUSTER_MODES.ha_compact, cluster_info["mode"])
self.assertEquals(consts.CLUSTER_NET_PROVIDERS.nova_network, cluster_info["net_provider"])
self.assertEquals(consts.CLUSTER_STATUSES.new, cluster_info["status"])
self.assertEquals(False, cluster_info["is_customized"])
self.assertEquals(cluster.id, cluster_info["id"])
self.assertEquals(cluster.fuel_version, cluster_info["fuel_version"])
self.assertTrue("attributes" in cluster_info)
self.assertTrue("release" in cluster_info)
self.assertEquals(cluster.release.operating_system, cluster_info["release"]["os"])
self.assertEquals(cluster.release.name, cluster_info["release"]["name"])
self.assertEquals(cluster.release.version, cluster_info["release"]["version"])
self.assertEquals(1, len(cluster_info["node_groups"]))
group_info = cluster_info["node_groups"][0]
group = [ng for ng in cluster.node_groups][0]
self.assertEquals(group.id, group_info["id"])
self.assertEquals(len(nodes_params), len(group_info["nodes"]))
self.assertEquals(set([n.id for n in group.nodes]), set(group_info["nodes"]))
示例10: test_clusters_info_no_vmware_attributes_exception
def test_clusters_info_no_vmware_attributes_exception(self):
self.env.upload_fixtures(['openstack'])
info = InstallationInfo()
release = ReleaseCollection.filter_by(None, operating_system='CentOS')
nodes_params = [
{'roles': ['compute']},
{'roles': ['compute']},
{'roles': ['controller']}
]
self.env.create(
cluster_kwargs={
'release_id': release[0].id,
'mode': consts.CLUSTER_MODES.ha_compact,
'net_provider': consts.CLUSTER_NET_PROVIDERS.nova_network},
nodes_kwargs=nodes_params
)
self.env.create_node({'status': consts.NODE_STATUSES.discover})
cluster = self.env.clusters[0]
VmwareAttributes.delete(cluster.vmware_attributes)
self.env.db.flush()
self.assertNotRaises(AttributeError, info.get_clusters_info)