From c806a6ccbd56393e86ed1e38201d6faa2e313ef8 Mon Sep 17 00:00:00 2001 From: miaohb Date: Fri, 8 Dec 2017 23:29:27 -0800 Subject: [PATCH] Set port device_id as uuid of the container This patch sets the device_id as the UUID of the container when creating or updating the port. Change-Id: I33a1c7a8becb37a249d8cb276b19c22f170fa186 Closes-Bug: #1737267 --- zun/network/kuryr_network.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/zun/network/kuryr_network.py b/zun/network/kuryr_network.py index a17e99949..993642531 100644 --- a/zun/network/kuryr_network.py +++ b/zun/network/kuryr_network.py @@ -191,11 +191,14 @@ class KuryrNetwork(network.Network): # either throw an exception or overwrite the port's security # groups. + # update device_id in port + port_req_body = {'port': {'device_id': container.uuid}} + self.neutron_api.update_port(neutron_port_id, port_req_body) + # If there is pci_request_id, it should be a sriov port. # populate pci related info. pci_request_id = requested_network.get('pci_request_id') if pci_request_id: - port_req_body = {'port': {'device_id': container.uuid}} self._populate_neutron_extension_values(container, pci_request_id, port_req_body) @@ -214,6 +217,7 @@ class KuryrNetwork(network.Network): port_dict = { 'network_id': neutron_net_id, 'tenant_id': self.context.project_id, + 'device_id': container.uuid, } ip_addr = requested_network.get("v4-fixed-ip") or requested_network.\ get("v6-fixed-ip")