diff options
author | spisarski <s.pisarski@cablelabs.com> | 2018-04-17 08:24:18 -0600 |
---|---|---|
committer | Steven Pisarski <s.pisarski@cablelabs.com> | 2018-04-19 22:08:39 +0000 |
commit | 4edc3d87392cf78c3f046217543fb76380413306 (patch) | |
tree | b138f146044ca1ff457ff25ac065bbdaeda6d320 /snaps/openstack/create_instance.py | |
parent | 844c049771c5b66eb7bd77e6f18f321674689d54 (diff) |
Fixed bug with regards to subnet lookups.opnfv-6.1.0opnfv-6.0.0
Neutron returns all subnets regardless of visibility which cause problems
within routers if there is another subnet with the same name attached to
a different network.
JIRA: SNAPS-304
In addition, this patch contains two other minor fixes.
launch_utils.py - raise an exception when the creator is not properly instantiated
network.py - allow fixed IPs to be none.
Change-Id: Ib343074d925be4592a713727a03d5b531890eada
Signed-off-by: spisarski <s.pisarski@cablelabs.com>
Diffstat (limited to 'snaps/openstack/create_instance.py')
-rw-r--r-- | snaps/openstack/create_instance.py | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/snaps/openstack/create_instance.py b/snaps/openstack/create_instance.py index 45666d5..16bd0ce 100644 --- a/snaps/openstack/create_instance.py +++ b/snaps/openstack/create_instance.py @@ -96,7 +96,7 @@ class OpenStackVmInstance(OpenStackComputeObject): """ self.initialize() - if len(self.__ports) == 0: + if len(self.__ports) != len(self.instance_settings.port_settings): self.__ports = self.__create_ports( self.instance_settings.port_settings) if not self.__vm: @@ -346,12 +346,13 @@ class OpenStackVmInstance(OpenStackComputeObject): for port_setting in port_settings: port = neutron_utils.get_port( - self.__neutron, self.__keystone, port_settings=port_setting) + self.__neutron, self.__keystone, port_settings=port_setting, + project_name=self._os_creds.project_name) if not port: port = neutron_utils.create_port( self.__neutron, self._os_creds, port_setting) - if port: - ports.append((port_setting.name, port)) + if port: + ports.append((port_setting.name, port)) return ports @@ -390,8 +391,10 @@ class OpenStackVmInstance(OpenStackComputeObject): port = self.get_port_by_name(port_name) if port: if subnet_name: + network = neutron_utils.get_network_by_id( + self.__neutron, port.network_id) subnet = neutron_utils.get_subnet( - self.__neutron, subnet_name=subnet_name) + self.__neutron, network, subnet_name=subnet_name) if not subnet: logger.warning('Cannot retrieve port IP as subnet could ' 'not be located with name - %s', |