Merge "Fix port creation with generated payload."
This commit is contained in:
commit
911d65fea7
kuryr_kubernetes
controller/drivers
tests/unit/controller/drivers
@ -44,7 +44,7 @@ class NestedMacvlanPodVIFDriver(nested_vif.NestedPodVIFDriver):
|
|||||||
vm_port = self._get_parent_port(pod)
|
vm_port = self._get_parent_port(pod)
|
||||||
|
|
||||||
if not container_port:
|
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'])
|
_tag_neutron_port(container_port['id'])
|
||||||
|
|
||||||
container_mac = container_port['mac_address']
|
container_mac = container_port['mac_address']
|
||||||
|
@ -133,7 +133,7 @@ class SriovVIFDriver(neutron_vif.NeutronPodVIFDriver):
|
|||||||
amount_value = requests[sriov_resource_name]
|
amount_value = requests[sriov_resource_name]
|
||||||
total_amount += int(amount_value)
|
total_amount += int(amount_value)
|
||||||
except KeyError:
|
except KeyError:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
return total_amount
|
return total_amount
|
||||||
|
|
||||||
@ -159,7 +159,7 @@ class SriovVIFDriver(neutron_vif.NeutronPodVIFDriver):
|
|||||||
if driver in constants.USERSPACE_DRIVERS:
|
if driver in constants.USERSPACE_DRIVERS:
|
||||||
break
|
break
|
||||||
except KeyError:
|
except KeyError:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
def _get_port_request(self, pod, project_id, subnets, security_groups):
|
def _get_port_request(self, pod, project_id, subnets, security_groups):
|
||||||
port_req_body = {
|
port_req_body = {
|
||||||
@ -177,4 +177,4 @@ class SriovVIFDriver(neutron_vif.NeutronPodVIFDriver):
|
|||||||
if security_groups:
|
if security_groups:
|
||||||
port_req_body['security_groups'] = security_groups
|
port_req_body['security_groups'] = security_groups
|
||||||
|
|
||||||
return {'port': port_req_body}
|
return port_req_body
|
||||||
|
@ -58,7 +58,7 @@ class TestNestedMacvlanPodVIFDriver(test_base.TestCase):
|
|||||||
|
|
||||||
m_driver._get_port_request.assert_called_once_with(
|
m_driver._get_port_request.assert_called_once_with(
|
||||||
pod, project_id, subnets, security_groups)
|
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._get_parent_port.assert_called_once_with(pod)
|
||||||
m_driver._try_update_port.assert_called_once()
|
m_driver._try_update_port.assert_called_once()
|
||||||
m_to_vif.assert_called_once_with(container_port['port'], subnets)
|
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, pod, project_id, subnets, security_groups)
|
||||||
m_driver._get_port_request.assert_called_once_with(
|
m_driver._get_port_request.assert_called_once_with(
|
||||||
pod, project_id, subnets, security_groups)
|
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_driver._try_update_port.assert_not_called()
|
||||||
m_to_vif.assert_not_called()
|
m_to_vif.assert_not_called()
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user