Skip to content

kvm: Use 'ip route show default 0.0.0.0/0' to find the default gateway - #3080

Merged
yadvr merged 1 commit into
apache:masterfrom
CLDIN:kvm-def-gateway
Dec 6, 2018
Merged

yadvr merged 1 commit into
apache:masterfrom
CLDIN:kvm-def-gateway

Conversation

@wido

@wido wido commented Dec 5, 2018

Copy link
Copy Markdown
Contributor

If a host has many routes this can be a magnitude faster then printing
all the routes and grepping for the default.

In some situations the host might have a large amount of routes due to
dynamic routing being used like OSPF or BGP.

In addition fix a couple of loglines which were throwing messages on
DEBUG while WARN and ERROR should be used there.

Signed-off-by: Wido den Hollander wido@widodh.nl

Description

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?

If a host has many routes this can be a magnitude faster then printing
all the routes and grepping for the default.

In some situations the host might have a large amount of routes due to
dynamic routing being used like OSPF or BGP.

In addition fix a couple of loglines which were throwing messages on
DEBUG while WARN and ERROR should be used there.

Signed-off-by: Wido den Hollander <wido@widodh.nl>
@wido wido added this to the 4.12.0.0 milestone Dec 5, 2018
@wido
wido requested review from GabrielBrascher and yadvr December 5, 2018 16:30
_canBridgeFirewall = canBridgeFirewall(_pifs.get("public"));

_localGateway = Script.runSimpleBashScript("ip route |grep default|awk '{print $3}'");
_localGateway = Script.runSimpleBashScript("ip route show default 0.0.0.0/0|head -1|awk '{print $3}'");

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.

I think ip route show default | ... was sufficient.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

That still prints additional lines, for example:

wido@n01:~$ ip route show default 0.0.0.0/0|wc -l
1
wido@n01:~$ ip route show default|wc -l
22
wido@n01:~$

We only want to know the route for 0.0.0.0/0 and not other more specific routes set in the routing table.

@yadvr yadvr 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.

LGTM, minor comment raised to drop the 0.0.0.0/0 but okay if code is put as it is.

@yadvr

yadvr commented Dec 5, 2018

Copy link
Copy Markdown
Member

@wido feel free to use blueorangutan to package yourself
@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-2483

@yadvr

yadvr commented Dec 5, 2018

Copy link
Copy Markdown
Member

@blueorangutan test

@blueorangutan

Copy link
Copy Markdown

@rhtyd a Trillian-Jenkins test job (centos7 mgmt + kvm-centos7) has been kicked to run smoke tests

@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 @wido.

@blueorangutan

Copy link
Copy Markdown

Trillian test result (tid-3250)
Environment: kvm-centos7 (x2), Advanced Networking with Mgmt server 7
Total time taken: 24446 seconds
Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr3080-t3250-kvm-centos7.zip
Intermittent failure detected: /marvin/tests/smoke/test_internal_lb.py
Intermittent failure detected: /marvin/tests/smoke/test_multipleips_per_nic.py
Intermittent failure detected: /marvin/tests/smoke/test_vpc_redundant.py
Intermittent failure detected: /marvin/tests/smoke/test_hostha_kvm.py
Smoke tests completed. 68 look OK, 2 have error(s)
Only failed tests results shown below:

Test Result Time (s) Test File
test_nic_secondaryip_add_remove Error 32.75 test_multipleips_per_nic.py
test_04_rvpc_network_garbage_collector_nics Failure 495.27 test_vpc_redundant.py

@yadvr
yadvr merged commit d96bc05 into apache:master Dec 6, 2018
winterhazel pushed a commit that referenced this pull request Jan 28, 2026
….0-scclouds'

Escalonamento dinâmico de VMs com ofertas de serviço fixas com o KVM

Closes #301 and #3080

See merge request scclouds/scclouds!1269
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.

4 participants