summaryrefslogtreecommitdiff
path: root/ironic/drivers/modules/network
diff options
context:
space:
mode:
authorVasyl Saienko <vsaienko@mirantis.com>2017-02-13 13:11:27 +0200
committerVasyl Saienko <vsaienko@mirantis.com>2017-02-13 11:30:13 +0000
commita951e452e14b37d7ea25a90e5ec2bfe6bd64b105 (patch)
tree77b61a531163bf27640a54895d794485be4a9e5b /ironic/drivers/modules/network
parent13b16c2757ad9c913e5d7ed5ffa459f14c1e6dd3 (diff)
downloadironic-a951e452e14b37d7ea25a90e5ec2bfe6bd64b105.tar.gz
Walk over all objects when doing VIF detach
We apply specific rules when doing VIF attach, do not duplicate them in vif_detach just walk over all port and portgroup objects. This also fixes an issue when VIF was attached to port manually (set vif_port_id key in port.extra) and it is impossible to detach such VIF via v1/nodes/<node_ident>/vifs API. Closes-Bug: #1663660 Change-Id: I70fe87bb4ae15a506fec705d10beaed572c0b45e
Diffstat (limited to 'ironic/drivers/modules/network')
-rw-r--r--ironic/drivers/modules/network/common.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/ironic/drivers/modules/network/common.py b/ironic/drivers/modules/network/common.py
index 3cf32ba37..57cb687e7 100644
--- a/ironic/drivers/modules/network/common.py
+++ b/ironic/drivers/modules/network/common.py
@@ -327,9 +327,10 @@ class VIFPortIDMixin(object):
:raises: VifNotAttached
"""
- ports = [p for p in task.ports if p.portgroup_id is None]
- portgroups = task.portgroups
- for port_like_obj in portgroups + ports:
+ # NOTE(vsaienko) We picking object to attach on vif-attach side.
+ # Here we should only detach VIF and shouldn't duplicate/follow
+ # attach rules, just walk over all objects and detach VIF.
+ for port_like_obj in task.portgroups + task.ports:
# FIXME(sambetts) Remove this when we no longer support a nova
# driver that uses port.extra
if (port_like_obj.extra.get("vif_port_id") == vif_id or