Skip to content

server: add global configuration for default router service offering#3946

Merged
DaanHoogland merged 5 commits into
apache:masterfrom
ustcweizhou:4.14-add-default-router-offering
Oct 20, 2020
Merged

server: add global configuration for default router service offering#3946
DaanHoogland merged 5 commits into
apache:masterfrom
ustcweizhou:4.14-add-default-router-offering

Conversation

@ustcweizhou
Copy link
Copy Markdown
Contributor

Description

This adds a global setting router.service.offering, which can be uuid of a system offering.
the service offering will be used by virtual routers;
if it is not set, default system offering will be used.

This is a account-scope setting, so it can be set in Account setting as well.

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?

  1. create a system offering

  2. change global setting
    image

  3. restart network with cleanup

  4. new VRs will be created with new offering
    image

@svenvogel
Copy link
Copy Markdown
Contributor

@ustcweizhou nice feature.

@harikrishna-patnala
Copy link
Copy Markdown
Member

We already have a provision to mention the service offering id while creating network offering which serves the same purpose right!

@weizhouapache
Copy link
Copy Markdown
Member

We already have a provision to mention the service offering id while creating network offering which serves the same purpose right!

@harikrishna-patnala it is an option, but it is complicated to change the offering of a VR :
(1)create network offering with router offering id
(2) update network to new network offering
Suppose there are many networks with different network offerings, we need to create some new offerings. There is some downtime in step (2).

It is very simple with this PR. (1) change setting, (2) restart network with cleanup.

@harikrishna-patnala
Copy link
Copy Markdown
Member

I'm not against the new option, but wanted to know the main intention of adding this.
Code changes LGTM.

@DaanHoogland
Copy link
Copy Markdown
Contributor

@blueorangutan package

@blueorangutan
Copy link
Copy Markdown

@DaanHoogland 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-1023

@DaanHoogland
Copy link
Copy Markdown
Contributor

I need a test volunteer, other than
@blueorangutan test

@blueorangutan
Copy link
Copy Markdown

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

@blueorangutan
Copy link
Copy Markdown

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

Test Result Time (s) Test File

@harikrishna-patnala
Copy link
Copy Markdown
Member

I need a test volunteer, other than
@blueorangutan test

I'll test this and post the results

@blueorangutan
Copy link
Copy Markdown

@harikrishna-patnala unsupported parameters provided. Supported mgmt server os are: centos6, centos7, ubuntu. Supported hypervisors are: kvm-centos6, kvm-centos7, kvm-ubuntu, xenserver-71, xenserver-65sp1, xenserver-62sp1, vmware-67u3, vmware-65u2, vmware-60u2, vmware-55u3, vmware-51u1, vmware-50u1

@blueorangutan
Copy link
Copy Markdown

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

@weizhouapache
Copy link
Copy Markdown
Member

I need a test volunteer, other than
@blueorangutan test

I'll test this and post the results

@harikrishna-patnala gooood. if you need my assistance, let me know.

@harikrishna-patnala
Copy link
Copy Markdown
Member

Following are the test cases covered for both isolated and VPC networks.

  1. Created a network with 'router.service.offering' set to empty - VR deployed with 'System Offering For Software Router' - PASSED
  2. Created a network with global configuration parameter 'router.service.offering' set to UUID of 'VRcustomCO1' compute offering - VR deployed with 'VRcustomCO1' - PASSED
  3. Created a network with account level configuration parameter 'router.service.offering' set to UUID of 'VRcustomCO2' compute offering - VR deployed with 'VRcustomCO2' - PASSED
  4. Created a network with account level configuration parameter 'router.service.offering' set to an invalid UUID - VR deployed with 'System Offering For Software Router'. Here in this case global configuration parameter is set to 'VRcustomCO1'.

In test case 4, irrespective of global config parameter VR deployed with default SO. If this behavior is expected a log message would help debugging.

@weizhouapache
Copy link
Copy Markdown
Member

Following are the test cases covered for both isolated and VPC networks.

  1. Created a network with 'router.service.offering' set to empty - VR deployed with 'System Offering For Software Router' - PASSED
  2. Created a network with global configuration parameter 'router.service.offering' set to UUID of 'VRcustomCO1' compute offering - VR deployed with 'VRcustomCO1' - PASSED
  3. Created a network with account level configuration parameter 'router.service.offering' set to UUID of 'VRcustomCO2' compute offering - VR deployed with 'VRcustomCO2' - PASSED
  4. Created a network with account level configuration parameter 'router.service.offering' set to an invalid UUID - VR deployed with 'System Offering For Software Router'. Here in this case global configuration parameter is set to 'VRcustomCO1'.

In test case 4, irrespective of global config parameter VR deployed with default SO. If this behavior is expected a log message would help debugging.

@harikrishna-patnala thanks for testing. I think it make more sense to use 'VRcustomCO1' instead of 'System Offering For Software Router' in case 4. I will update the PR.

@ustcweizhou ustcweizhou force-pushed the 4.14-add-default-router-offering branch from 981c314 to 454f5aa Compare March 12, 2020 22:15
if (serviceOffering != null && serviceOffering.isSystemUse()) {
boolean isLocalStorage = ConfigurationManagerImpl.SystemVMUseLocalStorage.valueIn(dest.getDataCenter().getId());
if (isLocalStorage == serviceOffering.isUseLocalStorage()) {
logger.debug("service offering " + serviceOffering.getId() + " will be used on virtual router");
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.

offeringUuid would be better than id in the log message. with that LGTM

@weizhouapache
Copy link
Copy Markdown
Member

updated based on @harikrishna-patnala 's comment

if (accountRouterOffering != null) {
verifyServiceOfferingByUuid(accountRouterOffering);
}
if (serviceOfferingId == null && globalRouterOffering != accountRouterOffering) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Wouldn't we want globalRouterOffering to take precedence over serviceOfferingId, @weizhouapache?

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.

@DaanHoogland serviceOfferingId is the final offering which will be used on virtual router.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

yes, but if we configured a global router offering wouldn't we prefer that even if serviceOfferingId is not null?

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.

@DaanHoogland correct. it checks following offerings

  1. Router service Offering of network/vpc offering
  2. Account route service offering
  3. Global route service offering
  4. Default route offering

If 1 or 2 is set and validated, global setting will not be used.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@weizhouapache if (serviceOffering != null), which should be always, globalRouterOffering will not be checked, whether or not globalRouterOffering == accountRouterOffering.
so I don't think your 3 and 4 are correct but this condition will never be met and verifyServiceOfferingByUuid(globalRouterOffering) will never be executed.
So, why check for serviceOfferingId before globalRouterOffering when it is the last resort and is only relevant after globalRouterOffering?

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.

@weizhouapache if (serviceOffering != null), which should be always, globalRouterOffering will not be checked, whether or not globalRouterOffering == accountRouterOffering.
so I don't think your 3 and 4 are correct but this condition will never be met and verifyServiceOfferingByUuid(globalRouterOffering) will never be executed.
So, why check for serviceOfferingId before globalRouterOffering when it is the last resort and is only relevant after globalRouterOffering?

@DaanHoogland it is serviceOfferingId , not serviceOffering.

the check procedure

protected void findServiceOfferingId() {
serviceOfferingId = networkOfferingDao.findById(guestNetwork.getNetworkOfferingId()).getServiceOfferingId();
if (serviceOfferingId == null) {
findAccountServiceOfferingId(guestNetwork.getAccountId());
}
if (serviceOfferingId == null) {
findDefaultServiceOfferingId();
}
}

in the account part, considering the uuid might be invalid, so check account setting at first, then global setting if account setting is invalid. (if account setting is not set, accountRouterOffering is actually the global setting, so skip the check if accountRouterOffering equals to globalRouterOffering )

protected void findAccountServiceOfferingId(long accountId) {
String accountRouterOffering = VirtualNetworkApplianceManager.VirtualRouterServiceOffering.valueIn(accountId);
String globalRouterOffering = VirtualNetworkApplianceManager.VirtualRouterServiceOffering.value();
if (accountRouterOffering != null) {
verifyServiceOfferingByUuid(accountRouterOffering);
}
if (serviceOfferingId == null && globalRouterOffering != accountRouterOffering) {
verifyServiceOfferingByUuid(globalRouterOffering);
}
}
private void verifyServiceOfferingByUuid(String offeringUuid) {
logger.debug("Verifying router service offering with uuid : " + offeringUuid);
ServiceOfferingVO serviceOffering = serviceOfferingDao.findByUuid(offeringUuid);
if (serviceOffering != null && serviceOffering.isSystemUse()) {
boolean isLocalStorage = ConfigurationManagerImpl.SystemVMUseLocalStorage.valueIn(dest.getDataCenter().getId());
if (isLocalStorage == serviceOffering.isUseLocalStorage()) {
logger.debug(String.format("Service offering %s (uuid: %s) will be used on virtual router", serviceOffering.getName(), serviceOffering.getUuid()));
serviceOfferingId = serviceOffering.getId();
}
}
}

hope it helps you understanding all changes in PR.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

ah, i missed the side effect of verifyServiceOfferingByUuid(), where the id is set, thanks.

Maybe to make this more obvious for stupid people like me we can make verifyServiceOfferingByUuid() return a uuid or null and set it in the findAccountServiceOfferingId()?

@DaanHoogland DaanHoogland added this to the 4.15.0.0 milestone May 14, 2020
@shwstppr
Copy link
Copy Markdown
Contributor

@blueorangutan package

@blueorangutan
Copy link
Copy Markdown

@shwstppr 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: ✖centos7 ✖centos8 ✖debian. JID-1959

@blueorangutan
Copy link
Copy Markdown

Packaging result: ✖centos7 ✖centos8 ✖debian. JID-1961

@weizhouapache
Copy link
Copy Markdown
Member

@blueorangutan package

@blueorangutan
Copy link
Copy Markdown

@weizhouapache 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: ✔centos7 ✔centos8 ✔debian. JID-1965

@DaanHoogland
Copy link
Copy Markdown
Contributor

@blueorangutan test

@blueorangutan
Copy link
Copy Markdown

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

@blueorangutan
Copy link
Copy Markdown

Trillian test result (tid-2787)
Environment: kvm-centos7 (x2), Advanced Networking with Mgmt server 7
Total time taken: 47655 seconds
Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr3946-t2787-kvm-centos7.zip
Intermittent failure detected: /marvin/tests/smoke/test_kubernetes_clusters.py
Intermittent failure detected: /marvin/tests/smoke/test_kubernetes_supported_versions.py
Intermittent failure detected: /marvin/tests/smoke/test_routers_network_ops.py
Intermittent failure detected: /marvin/tests/smoke/test_vpc_redundant.py
Intermittent failure detected: /marvin/tests/smoke/test_hostha_kvm.py
Smoke tests completed. 82 look OK, 3 have error(s)
Only failed tests results shown below:

Test Result Time (s) Test File
test_01_add_delete_kubernetes_supported_version Error 1807.64 test_kubernetes_supported_versions.py
test_01_create_redundant_VPC_2tiers_4VMs_4IPs_4PF_ACL Failure 372.03 test_vpc_redundant.py
test_hostha_kvm_host_fencing Error 101.27 test_hostha_kvm.py

@DaanHoogland
Copy link
Copy Markdown
Contributor

@shwstppr do you 👍 this, based on your tests?

Copy link
Copy Markdown
Contributor

@shwstppr shwstppr left a comment

Choose a reason for hiding this comment

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

LGTM. Tested in a local env.

  • Adding new compute offering and setting it in new global setting results in VR using default offering
  • Adding new system service offering for routers and setting it in new global setting results in VR using new offering
  • Setting global setting empty results in VR using default offering as expected

Test failures don't seem related. Will be great if we can have corresponding doc PR for user documentation if not there already @weizhouapache

@weizhouapache
Copy link
Copy Markdown
Member

LGTM. Tested in a local env.

  • Adding new compute offering and setting it in new global setting results in VR using default offering
  • Adding new system service offering for routers and setting it in new global setting results in VR using new offering
  • Setting global setting empty results in VR using default offering as expected

Test failures don't seem related. Will be great if we can have corresponding doc PR for user documentation if not there already @weizhouapache

@shwstppr thanks for testing. Will add doc if this is merged.

@DaanHoogland
Copy link
Copy Markdown
Contributor

@weizhouapache is this still up to date?

@weizhouapache
Copy link
Copy Markdown
Member

@weizhouapache is this still up to date?

@DaanHoogland yes.

@DaanHoogland DaanHoogland merged commit 2661ce8 into apache:master Oct 20, 2020
@DaanHoogland
Copy link
Copy Markdown
Contributor

@weizhouapache I see consistent smoke test errors for redundant VPCs since this weekend and this is the only related PR I have found so far. can you have a look e.g. at #4200 (comment)
@blueorangutan package

@blueorangutan
Copy link
Copy Markdown

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

davidjumani added a commit to shapeblue/cloudstack that referenced this pull request Oct 21, 2020
@blueorangutan
Copy link
Copy Markdown

Packaging result: ✔centos7 ✔centos8 ✔debian. JID-2244

@weizhouapache
Copy link
Copy Markdown
Member

@weizhouapache I see consistent smoke test errors for redundant VPCs since this weekend and this is the only related PR I have found so far. can you have a look e.g. at #4200 (comment)
@blueorangutan package

@DaanHoogland
if you search "test_01_create_redundant_VPC_2tiers_4VMs_4IPs_4PF_ACL" in your mailbox, you may get many emails :-D
it is not caused by this pr.
as I said in #4386 (comment), it is caused by keepalived issue, which should be fixed by #4413

@blueorangutan
Copy link
Copy Markdown

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

@DaanHoogland
Copy link
Copy Markdown
Contributor

thanks @weizhouapache , i saw it happening a lot suddenly overnight and got a little worried I had merged something overhastely, sorry, never mind.

@blueorangutan
Copy link
Copy Markdown

Packaging result: ✔centos7 ✔centos8 ✔debian. JID-2248

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.

8 participants