Skip to content

Conversation

@ustcweizhou
Copy link
Contributor

Description

In advanced zone with security groups, there can be multiple shared networks with security groups enabled. However, it is only possible to create vm with only one network. When we try to create vm with multiple networks, it gives error "Only support one network per VM if security group enabled".

Operations succeed if we create a vm with one network and add other networks to the vm. However, the new nics do not work as there are no network rules for them applied on hypervisor.

This PR will enable the functionality on KVM hypervisors, including the support on
(1) API to support vm with multiple networks for KVM
(2) UI to create vm with multiple networks for KVM
(3) network rules applied on all nics (when create a vm, and add/remove nics)
(4) network rules for all secondary ips on all nics

This PR includes the other two bug fixes: #3635 and #3636
This PR also included a script file for integration test.

Fixes: #3045 #3568

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?

environment:
ubuntu 18.04 / python2
advanced zone with security groups

check network rules for vm (eg i-10-20-VM)

  • ipset list i-10-20-VM
  • ipset list i-10-20-VM-6
  • iptables-save | grep i-10-20
  • ebtables-save | grep i-10-20

vm actions:

  • create a vm with multiple networks
  • add new nic to vm
  • remove nic from vm
  • add secondary ips to vm
  • remove secondary ips to vm
  • reboot vm
  • migrate vm
  • stop vm
  • start vm

@ustcweizhou
Copy link
Contributor Author

@rakgenius @wido @GabrielBrascher @rhtyd
Please review it !

We have tested with ipv4 addresses.

We have also some other codes in integration test to test if the primary and secondary ips are reachable from virtual router. However, it requires sshpass and a script in vm to configure the ips, so I removed them from integration test.

Copy link
Contributor

@wido wido left a comment

Choose a reason for hiding this comment

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

Looking good! Left a few comments

@ustcweizhou
Copy link
Contributor Author

@wido Thanks for review !
It would be nice if you can test it in PCExtreme

@andrijapanicsb
Copy link
Contributor

Hi guys @wido @weizhouapache , any change to progress on this one for the 4.14 (and solve the conflict) ?

@yadvr
Copy link
Member

yadvr commented Jan 28, 2020

@ustcweizhou can you fix the merge conflict?

@weizhouapache
Copy link
Member

@rhtyd rebased with latest master

@yadvr yadvr closed this Jan 29, 2020
@yadvr yadvr reopened this Jan 29, 2020
@weizhouapache
Copy link
Member

@blueorangutan package

@blueorangutan
Copy link

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

@blueorangutan
Copy link

Packaging result: ✖centos6 ✔centos7 ✔debian. JID-711

@apache apache deleted a comment from yadvr Jan 30, 2020
@apache apache deleted a comment from blueorangutan Jan 30, 2020
@apache apache deleted a comment from blueorangutan Jan 30, 2020
@DaanHoogland
Copy link
Contributor

@blueorangutan test

@blueorangutan
Copy link

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

@blueorangutan
Copy link

Trillian test result (tid-855)
Environment: kvm-centos7 (x2), Advanced Networking with Mgmt server 7
Total time taken: 27897 seconds
Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr3639-t855-kvm-centos7.zip
Smoke tests completed. 78 look OK, 0 have error(s)
Only failed tests results shown below:

Test Result Time (s) Test File

@DaanHoogland
Copy link
Contributor

@wido Are all your concerns met? Will you guys test this?

@andrijapanicsb andrijapanicsb requested a review from wido February 7, 2020 12:08
@andrijapanicsb
Copy link
Contributor

@GabrielBrascher interested to test this one perhaps?

@GabrielBrascher
Copy link
Member

@andrijapanicsb sure, going to test it soon!

@yadvr
Copy link
Member

yadvr commented Feb 12, 2020

@ustcweizhou can you address merge conflict?

@DaanHoogland DaanHoogland reopened this Feb 13, 2020
@apache apache deleted a comment from blueorangutan Feb 13, 2020
@apache apache deleted a comment from blueorangutan Feb 13, 2020
@yadvr yadvr closed this Feb 14, 2020
@yadvr yadvr reopened this Feb 14, 2020
@yadvr
Copy link
Member

yadvr commented Feb 14, 2020

@blueorangutan package

@blueorangutan
Copy link

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

@blueorangutan
Copy link

Packaging result: ✖centos6 ✔centos7 ✔debian. JID-871

@andrijapanicsb
Copy link
Contributor

sure, going to test it soon!

@GabrielBrascher kindly ping if any updates on testing. thx!

@yadvr
Copy link
Member

yadvr commented Feb 17, 2020

@blueorangutan package

@blueorangutan
Copy link

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

@blueorangutan
Copy link

Packaging result: ✖centos6 ✔centos7 ✔debian. JID-886

@DaanHoogland
Copy link
Contributor

@blueorangutan test

@blueorangutan
Copy link

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

@blueorangutan
Copy link

Trillian test result (tid-1014)
Environment: kvm-centos7 (x2), Advanced Networking with Mgmt server 7
Total time taken: 33763 seconds
Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr3639-t1014-kvm-centos7.zip
Intermittent failure detected: /marvin/tests/smoke/test_privategw_acl.py
Smoke tests completed. 78 look OK, 1 have error(s)
Only failed tests results shown below:

Test Result Time (s) Test File
test_02_vpc_privategw_static_routes Failure 223.58 test_privategw_acl.py
test_03_vpc_privategw_restart_vpc_cleanup Failure 221.55 test_privategw_acl.py
test_04_rvpc_privategw_static_routes Failure 334.08 test_privategw_acl.py

@GabrielBrascher
Copy link
Member

@andrijapanicsb got delayed with other tasks, just finishing to build it for a staging environment. I will be able to test it today.

Copy link
Member

@GabrielBrascher GabrielBrascher left a comment

Choose a reason for hiding this comment

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

Tested and it works 👍
Overall code looks good, just added a few minor observations.

Test env: KVM on Ubuntu 18.04, advanced network with security groups.

private static final String CIDR_LENGTH_SEPARATOR = "/";
private static final char RULE_TARGET_SEPARATOR = ',';
private static final char RULE_COMMAND_SEPARATOR = ';';
public static final char RULE_TARGET_SEPARATOR = ',';
Copy link
Member

@GabrielBrascher GabrielBrascher Feb 19, 2020

Choose a reason for hiding this comment

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

I see that RULE_TARGET_SEPARATOR is not being used outside this class. Is that correct? If it is indeed the case, this should be set back to private.

* @param conn
* @param vm
* @param checkBeforeApply
* @return
Copy link
Member

Choose a reason for hiding this comment

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

Thanks for adding documentation.

Just a note: I don't think that @param adds much info when it holds only the parameter name, normally I would vote to remove them, or add some description on each param.

@Inject
private NetworkDetailsDao networkDetailsDao;
@Inject
private SecurityGroupManager _securityGroupManager;
Copy link
Member

Choose a reason for hiding this comment

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

Java Naming Conventions does not recommend using _ (underscore) before variable name. Can you please remove it?

Copy link
Contributor

@DaanHoogland DaanHoogland left a comment

Choose a reason for hiding this comment

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

code lgtm, not tested

Copy link
Member

@GabrielBrascher GabrielBrascher left a comment

Choose a reason for hiding this comment

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

Based on code review and tests, it LGTM.
Regression tests failed on :
test_02_vpc_privategw_static_routes Failure 223.58 test_privategw_acl.py
test_03_vpc_privategw_restart_vpc_cleanup Failure 221.55 test_privategw_acl.py
test_04_rvpc_privategw_static_routes Failure 334.08 test_privategw_acl.py

But not necessarily related with this PR (afaik). Issue #3859 was created to tackle it.

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.

Support multiple networks on vm in advanced zone with security groups

9 participants