Skip to content

Security Group: limit returns in get_bridge_physdev to 1#3648

Merged
yadvr merged 1 commit into
apache:4.13from
CLDIN:security_group_physdev
Oct 22, 2019
Merged

Security Group: limit returns in get_bridge_physdev to 1#3648
yadvr merged 1 commit into
apache:4.13from
CLDIN:security_group_physdev

Conversation

@RPDiep

@RPDiep RPDiep commented Oct 21, 2019

Copy link
Copy Markdown
Contributor

Description

We've encountered a corner case where bridge -o link show returned two lines per bridge instead of one. get_bridge_physdev in security_group.py returned bond0.701\nbond0.701.
Although this may very well be something on the hypervisor, we should limit the lines returned.
I therefore added a mere | head -1 to the function.

See output:
Old:

root@n02:~# bridge -o link show | awk '/master cloudbr0 / && !/^[0-9]+: vnet/ {print $2}'
bond0.701
bond0.701

New:

root@n02:~# bridge -o link show | awk '/master cloudbr0 / && !/^[0-9]+: vnet/ {print $2}' | head -1
bond0.701

Types of changes

  • Breaking change (fix or feature that would cause existing functionality to change)
  • New feature (non-breaking change which adds functionality)
  • Bug fix (non-breaking change which fixes an issue)
  • Enhancement (improves an existing feature and functionality)
  • Cleanup (Code refactoring and cleanup, that may add test cases)

Screenshots (if appropriate):

How Has This Been Tested?

Tested function from idle:

root@n02:/usr/share/cloudstack-common/scripts/vm/network# python
Python 2.7.12 (default, Oct  8 2019, 14:14:10) 
[GCC 5.4.0 20160609] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from security_group import get_bridge_physdev
>>> get_bridge_physdev('cloudbr0')
'bond0.701'

Please let me know if you want me to rebase against 4.13 .

@GabrielBrascher
GabrielBrascher changed the base branch from master to 4.13 October 21, 2019 14:32
@GabrielBrascher
GabrielBrascher changed the base branch from 4.13 to master October 21, 2019 14:32
@RPDiep
RPDiep force-pushed the security_group_physdev branch from da0d06a to 862fb5f Compare October 21, 2019 14:33
@RPDiep
RPDiep changed the base branch from master to 4.13 October 21, 2019 14:34
@GabrielBrascher GabrielBrascher added this to the 4.13.1.0 milestone Oct 21, 2019

@GabrielBrascher GabrielBrascher left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code LGTM, thanks @RPDiep!

@RPDiep

RPDiep commented Oct 21, 2019

Copy link
Copy Markdown
Contributor Author

Rebased against 4.13 as requested by @GabrielBrascher

Comment thread scripts/vm/network/security_group.py
@ustcweizhou

Copy link
Copy Markdown
Contributor

@RPDiep @GabrielBrascher
I did not see this issue on all our platforms. we also use bonding on some platforms.
it seems to be caused by another issue.
could you please paste result of command "bridge -o link show | awk '/master cloudbr0 /'

@RPDiep

RPDiep commented Oct 22, 2019

Copy link
Copy Markdown
Contributor Author

@ustcweizhou

I'm sure this is something now on the hypervisor, but it appears that corner cases exist in which a second line appears. As we only need one result, I added the | head -1 in this commit.

Here's the output you requested (I added the vnet filter)

root@n02:~# bridge -o link show | awk '/master cloudbr0 / && !/^[0-9]+: vnet/'
7: bond0.701 state UP @bond0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 master cloudbr0 state forwarding priority 32 cost 2 
7: bond0.701 state UP @bond0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 master cloudbr0 

@yadvr

yadvr commented Oct 22, 2019

Copy link
Copy Markdown
Member

@blueorangutan package

@blueorangutan

Copy link
Copy Markdown

@rhtyd a Jenkins job has been kicked to build packages. I'll keep you posted as I make progress.

@blueorangutan

Copy link
Copy Markdown

Packaging result: ✔centos6 ✔centos7 ✔debian. JID-325

@ustcweizhou

Copy link
Copy Markdown
Contributor

state forwarding priority 32 cost 2

@RPDiep thanks . this change looks good to me.

@yadvr

yadvr commented Oct 22, 2019

Copy link
Copy Markdown
Member

Thanks for confirming the change and tests. I'll merge this.

@yadvr
yadvr merged commit 3114907 into apache:4.13 Oct 22, 2019
shwstppr pushed a commit to shapeblue/cloudstack that referenced this pull request Nov 12, 2019
We've encountered a corner case where bridge -o link show returned two lines per bridge instead of one. get_bridge_physdev in security_group.py returned bond0.701\nbond0.701.
Although this may very well be something on the hypervisor, we should limit the lines returned.
I therefore added a mere | head -1 to the function.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants