Skip to content

Commit

Permalink
device_id exception raised when creating Neutron network port (v10.3,…
Browse files Browse the repository at this point in the history
… HPB)

Issues:
Fixes F5Networks#930

Problem: create_port_on_network() fails to set a device_id in
port data unless one is passed into the function. Because the
agent calls this method without a device_id it will always
fail.

Analysis: Code was recently changed so that the passed in device_id
is always used, but failed to account for situations when device_id
is not given. Added additional code to set device_id to a uuid ID
when no device_id is given.

Tests:
  • Loading branch information
jlongstaf committed Jun 5, 2018
1 parent 09a1c3b commit c2e6164
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions f5lbaasdriver/v2/bigip/plugin_rpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
# limitations under the License.
#

import uuid

from oslo_log import helpers as log_helpers
from oslo_log import log as logging

Expand Down Expand Up @@ -536,6 +538,8 @@ def create_port_on_subnet(self, context, subnet_id=None,

if device_id:
port_data['device_id'] = device_id
else:
port_data['device_id'] = str(uuid.uuid5(uuid.NAMESPACE_DNS, str(host)))
port_data[portbindings.HOST_ID] = host
port_data[portbindings.VNIC_TYPE] = vnic_type
port_data[portbindings.PROFILE] = binding_profile
Expand Down Expand Up @@ -700,6 +704,8 @@ def create_port_on_network(self, context, network_id=None,
}
if device_id:
port_data['device_id'] = device_id
else:
port_data['device_id'] = str(uuid.uuid5(uuid.NAMESPACE_DNS, str(host)))
port_data[portbindings.HOST_ID] = host
port_data[portbindings.VNIC_TYPE] = vnic_type
port_data[portbindings.PROFILE] = binding_profile
Expand Down

0 comments on commit c2e6164

Please sign in to comment.