Skip to content

Conversation

@olivierlemasle
Copy link
Contributor

@olivierlemasle olivierlemasle commented Sep 14, 2020

Description

With this commit, listUsageRecords filters out usages made on IP addresses on networks with "Hide IP Address Usage". This was previously introduced in #3235.

This requires a DB schema change, to introduce a flag is_hidden in table cloud_usage.cloud_usage.

Cf. #4193

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)

How Has This Been Tested?

Multiple IP addresses have been created.

  • Those on shared networks without "Hide IP Address Usage" generate usages normally;
  • Those on shared networks with "Hide IP Address Usage" generate usages with flag is_hidden, and are not returned by the API.

@olivierlemasle olivierlemasle mentioned this pull request Sep 14, 2020
5 tasks
@Pearl1594
Copy link
Contributor

@blueorangutan package

@blueorangutan
Copy link

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

@blueorangutan
Copy link

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

@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

@olivierlemasle
Copy link
Contributor Author

Kindly ping @rhtyd

@DaanHoogland
Copy link
Contributor

@blueorangutan package

@blueorangutan
Copy link

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

@blueorangutan
Copy link

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

@DaanHoogland
Copy link
Contributor

@olivierlemasle Do you have a smoke or integration test for this? it would help guard the feature in the future.
@blueorangutan test

@blueorangutan
Copy link

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

@olivierlemasle
Copy link
Contributor Author

@DaanHoogland I must say I do not know CloudStack smoke tests well; are there any smoke tests on usages data in CloudStack currently, that I could use as a basis?

@DaanHoogland
Copy link
Contributor

look in the test/integration/ subdirectory. I imagine there are marvin tests for related functionality, if you want to go that way. there is https://github.com/apache/cloudstack/blob/master/test/integration/smoke/test_usage.py and I hav e to admit I don't know how relevant it is for your case.

@svenvogel
Copy link
Contributor

@olivierlemasle which milestone version should it merged? we can set it to 4.16?

@DaanHoogland
Copy link
Contributor

@svenvogel as it is marked a bug I wouldimagine 4.15 or before to be appropriate. unless we decide it is too risky and not major..?

@olivierlemasle
Copy link
Contributor Author

👍 for 4.15! Without it, IP addresses will generate usages on networks flagged "Hide IP address usages"...

@DaanHoogland
Copy link
Contributor

@blueorangutan package

@blueorangutan
Copy link

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

@blueorangutan
Copy link

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

@DaanHoogland DaanHoogland added this to the 4.15.0.0 milestone Oct 22, 2020
@DaanHoogland
Copy link
Contributor

@blueorangutan test

@olivierlemasle
Copy link
Contributor Author

@DaanHoogland @svenvogel I just rebased on master to fix the conflict in schema-41400to41500.sql.

@DaanHoogland
Copy link
Contributor

@blueorangutan package

@blueorangutan
Copy link

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

@blueorangutan
Copy link

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

@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

Copy link
Contributor

@Pearl1594 Pearl1594 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

@DaanHoogland
Copy link
Contributor

@andrijapanicsb what do you think about this?

@andrijapanicsb
Copy link
Contributor

what is being different with this vs the original PR?

@olivierlemasle
Copy link
Contributor Author

@andrijapanicsb
In #3235, usages were filtered out on the fly by the ApiResponseHelper, each time a listUsageRecords result was returned. It means that that filter ran only for the requested page of usages.

However, like all listXxx requests, listUsageRecords's response has a count field which is equal to the total number of usages (all pages included). It then caused the regession #4191, which was fixed in #4193 by reverting the filtering.

To filter the "hidden" IP address usages with a correct count, it is necessary to know how many usages were filtered out in the other pages. This PR moves the filter from the API layer to the usage server, to get the filter right without damaging performances.

NB: Since today's rebase, a timeout in smoke tests cause Travis build to fail.

@blueorangutan
Copy link

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

Test Result Time (s) Test File

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.

one little question, i don't like null returns. otherwise good.

With this commit, listUsageRecords filters out usages made on
IP addresses on networks with "Hide IP Address Usage". This was
previously introduced in apache#3235.

This requires a DB schema change, to introduce a flag is_hidden
in table cloud_usage.cloud_usage.
@olivierlemasle
Copy link
Contributor Author

@DaanHoogland I've just updated the PR after your comment.

@DaanHoogland
Copy link
Contributor

@blueorangutan package

@blueorangutan
Copy link

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

@Pearl1594
Copy link
Contributor

Verified fix:

Created a VM in a shared n/w with hiding IP Usage enabled, and one in a shared network without hiding IP usage - 3 records were created for both networks, While in all there are 33 records, listusagerecords filters out listing ip usage for the n/w with hide ip usage enabled.

select count(*) from cloud_usage\G
*************************** 1. row ***************************
count(*): 33
1 row in set (0.00 sec)
list usagerecords startdate="2020-10-26 00:00:00" enddate="2020-11-02 00:00:00" 
{
  "count": 30,
  "usagerecord": [
    {....
    }
  ]
}

@blueorangutan
Copy link

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

@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-3133)
Environment: kvm-centos7 (x2), Advanced Networking with Mgmt server 7
Total time taken: 33882 seconds
Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr4327-t3133-kvm-centos7.zip
Intermittent failure detected: /marvin/tests/smoke/test_diagnostics.py
Intermittent failure detected: /marvin/tests/smoke/test_kubernetes_supported_versions.py
Intermittent failure detected: /marvin/tests/smoke/test_privategw_acl.py
Smoke tests completed. 86 look OK, 0 have error(s)
Only failed tests results shown below:

Test Result Time (s) Test File

@DaanHoogland DaanHoogland merged commit 5f8289f into apache:master Nov 7, 2020
@olivierlemasle olivierlemasle deleted the hide_ip_address_usages branch November 7, 2020 10:21
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.

6 participants