Merge "Fix port creation with generated payload."

This commit is contained in:
Zuul 2020-02-06 16:30:26 +00:00 committed by Gerrit Code Review
commit 911d65fea7
3 changed files with 6 additions and 6 deletions

View File

@ -44,7 +44,7 @@ class NestedMacvlanPodVIFDriver(nested_vif.NestedPodVIFDriver):
vm_port = self._get_parent_port(pod)
if not container_port:
container_port = neutron.create_port(req).get('port')
container_port = neutron.create_port({'port': req}).get('port')
_tag_neutron_port(container_port['id'])
container_mac = container_port['mac_address']

View File

@ -133,7 +133,7 @@ class SriovVIFDriver(neutron_vif.NeutronPodVIFDriver):
amount_value = requests[sriov_resource_name]
total_amount += int(amount_value)
except KeyError:
continue
continue
return total_amount
@ -159,7 +159,7 @@ class SriovVIFDriver(neutron_vif.NeutronPodVIFDriver):
if driver in constants.USERSPACE_DRIVERS:
break
except KeyError:
continue
continue
def _get_port_request(self, pod, project_id, subnets, security_groups):
port_req_body = {
@ -177,4 +177,4 @@ class SriovVIFDriver(neutron_vif.NeutronPodVIFDriver):
if security_groups:
port_req_body['security_groups'] = security_groups
return {'port': port_req_body}
return port_req_body

View File

@ -58,7 +58,7 @@ class TestNestedMacvlanPodVIFDriver(test_base.TestCase):
m_driver._get_port_request.assert_called_once_with(
pod, project_id, subnets, security_groups)
neutron.create_port.assert_called_once_with(port_request)
neutron.create_port.assert_called_once_with({'port': port_request})
m_driver._get_parent_port.assert_called_once_with(pod)
m_driver._try_update_port.assert_called_once()
m_to_vif.assert_called_once_with(container_port['port'], subnets)
@ -83,7 +83,7 @@ class TestNestedMacvlanPodVIFDriver(test_base.TestCase):
m_driver, pod, project_id, subnets, security_groups)
m_driver._get_port_request.assert_called_once_with(
pod, project_id, subnets, security_groups)
neutron.create_port.assert_called_once_with(port_request)
neutron.create_port.assert_called_once_with({'port': port_request})
m_driver._try_update_port.assert_not_called()
m_to_vif.assert_not_called()