-
Notifications
You must be signed in to change notification settings - Fork 1k
[vm_topology.py]: Vlan interface addition delay handling #645
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -99,6 +99,7 @@ | |
| PTF_FP_IFACE_TEMPLATE = 'eth%d' | ||
| BACK_ROOT_END_IF_TEMPLATE = 'veth-bb-%s' | ||
| BACK_VM_END_IF_TEMPLATE = 'veth-bv-%s' | ||
| RETRIES = 3 | ||
|
|
||
|
|
||
| class VMTopology(object): | ||
|
|
@@ -405,8 +406,20 @@ def bind_phys_vlan(self, br_name, vlan_iface, injected_iface, vm_iface, disconne | |
| if vlan_iface not in ports: | ||
| VMTopology.cmd('ovs-vsctl add-port %s %s' % (br_name, vlan_iface)) | ||
|
|
||
| bindings = VMTopology.get_ovs_port_bindings(br_name) | ||
| vlan_iface_id = bindings[vlan_iface] | ||
| # Vlan interface addition may take few secs to reflect in OVS Command, | ||
| # Let`s retry few times. | ||
| retries = 0 | ||
| vlan_iface_id = None | ||
| while retries < RETRIES: | ||
| bindings = VMTopology.get_ovs_port_bindings(br_name) | ||
| vlan_iface_id = bindings[vlan_iface] | ||
| if vlan_iface_id is not None: | ||
| break | ||
| time.sleep(1) | ||
| retries += 1 | ||
| if vlan_iface_id is None: | ||
| raise Exception("Can't find vlan_iface_id") | ||
|
|
||
| injected_iface_id = bindings[injected_iface] | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you please hide retry logic inside of get_ovs_port_bindings()?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 1.) I can do that, but I will need to add an extra argument [=vlan_iface] to function get_ovs_port_bindings(). 2.) Or I can write an wrapper on top on get_ovs_port_bindings(br_name) to check vlan_iface. Kindly let me know which sounds better. Thanks a lot for review.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Gentle Reminder for review. |
||
| vm_iface_id = bindings[vm_iface] | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you please raise an Exception inside of the get_ovs_port_bindings method? I don't see any reason you want to have it here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure I will change that part.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure will raise in function get_ovs_port_bindings.