diff options
author | spisarski <s.pisarski@cablelabs.com> | 2018-05-24 13:36:56 -0600 |
---|---|---|
committer | Steven Pisarski <s.pisarski@cablelabs.com> | 2018-05-24 19:38:24 +0000 |
commit | b351d8cf4d882c7ec3acbd0111b4d0bf1747c9d3 (patch) | |
tree | 9a53f4415ce8c4c3dba5390ae14ad849b8575706 | |
parent | 1eb65fc680dad92540327dca27da49308dc0a99f (diff) |
Miscellaneous minor stability fixes
Change-Id: Iad8a7b6358f881d1c2935cc619cfa96f1196a675
Signed-off-by: spisarski <s.pisarski@cablelabs.com>
-rw-r--r-- | snaps/config/network.py | 4 | ||||
-rw-r--r-- | snaps/openstack/create_router.py | 3 | ||||
-rw-r--r-- | snaps/openstack/tests/create_network_tests.py | 9 | ||||
-rw-r--r-- | snaps/openstack/utils/nova_utils.py | 5 |
4 files changed, 13 insertions, 8 deletions
diff --git a/snaps/config/network.py b/snaps/config/network.py index 85a9fae..49d1a7a 100644 --- a/snaps/config/network.py +++ b/snaps/config/network.py @@ -458,6 +458,10 @@ class PortConfig(object): try: network = neutron_utils.get_network( neutron, keystone, network_name=self.network_name) + if network and not network.shared: + network = neutron_utils.get_network( + neutron, keystone, network_name=self.network_name, + project_name=project_name) finally: if session: keystone_utils.close_session(session) diff --git a/snaps/openstack/create_router.py b/snaps/openstack/create_router.py index 0b93359..7a056e7 100644 --- a/snaps/openstack/create_router.py +++ b/snaps/openstack/create_router.py @@ -162,7 +162,8 @@ class OpenStackRouter(OpenStackNetworkObject): else: return neutron_utils.get_subnet_by_name( self._neutron, self._keystone, - subnet_name=sub_config) + subnet_name=sub_config, + project_name=self._os_creds.project_name) def clean(self): """ diff --git a/snaps/openstack/tests/create_network_tests.py b/snaps/openstack/tests/create_network_tests.py index 5ba5cef..41eb45a 100644 --- a/snaps/openstack/tests/create_network_tests.py +++ b/snaps/openstack/tests/create_network_tests.py @@ -638,11 +638,10 @@ class CreateNetworkGatewayTests(OSIntegrationTestCase): self.os_creds, net_config) out_net = self.net_creator.create() - # Validate network was created - self.assertTrue(neutron_utils_tests.validate_network( - self.neutron, self.keystone, - self.net_creator.network_settings.name, True, - self.os_creds.project_name)) + self.assertIsNotNone(out_net) + + get_net = neutron_utils.get_network_by_id(self.neutron, out_net.id) + self.assertIsNotNone(get_net) # Validate subnets self.assertTrue(neutron_utils_tests.validate_subnet( diff --git a/snaps/openstack/utils/nova_utils.py b/snaps/openstack/utils/nova_utils.py index 38460c5..8be9b2a 100644 --- a/snaps/openstack/utils/nova_utils.py +++ b/snaps/openstack/utils/nova_utils.py @@ -309,8 +309,9 @@ def get_server_security_group_names(nova, server): """ out = list() os_vm_inst = __get_latest_server_os_object(nova, server) - for sec_grp_dict in os_vm_inst.security_groups: - out.append(sec_grp_dict['name']) + if hasattr(os_vm_inst, 'security_groups'): + for sec_grp_dict in os_vm_inst.security_groups: + out.append(sec_grp_dict['name']) return out |