summaryrefslogtreecommitdiff
path: root/ironic/common/neutron.py
diff options
context:
space:
mode:
Diffstat (limited to 'ironic/common/neutron.py')
-rw-r--r--ironic/common/neutron.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/ironic/common/neutron.py b/ironic/common/neutron.py
index c6c84f3df..e81f360aa 100644
--- a/ironic/common/neutron.py
+++ b/ironic/common/neutron.py
@@ -104,7 +104,7 @@ def update_neutron_port(context, port_id, attrs, client=None):
return client.update_port(port_id, **attrs)
-def unbind_neutron_port(port_id, client=None, context=None):
+def unbind_neutron_port(port_id, client=None, context=None, reset_mac=True):
"""Unbind a neutron port
Remove a neutron port's binding profile and host ID so that it returns to
@@ -113,6 +113,7 @@ def unbind_neutron_port(port_id, client=None, context=None):
:param port_id: Neutron port ID.
:param client: Optional a Neutron client object.
:param context: request context
+ :param reset_mac: reset mac address
:type context: ironic.common.context.RequestContext
:raises: NetworkError
"""
@@ -126,7 +127,8 @@ def unbind_neutron_port(port_id, client=None, context=None):
# Exception PortBound will be raised by neutron as it refuses to
# update the mac address of a bound port if we attempt to unbind and
# reset the mac in the same call.
- update_neutron_port(context, port_id, attrs_reset_mac, client)
+ if reset_mac:
+ update_neutron_port(context, port_id, attrs_reset_mac, client)
# NOTE(vsaienko): Ignore if port was deleted before calling vif detach.
except openstack_exc.ResourceNotFound:
LOG.info('Port %s was not found while unbinding.', port_id)