Skip to content

Fix to make recovered volumes be accounted for by Usage#6772

Merged
DaanHoogland merged 3 commits intoapache:mainfrom
scclouds:add-event-to-recoverVolume
Oct 11, 2022
Merged

Fix to make recovered volumes be accounted for by Usage#6772
DaanHoogland merged 3 commits intoapache:mainfrom
scclouds:add-event-to-recoverVolume

Conversation

@JoaoJandre
Copy link
Copy Markdown
Contributor

Description

When a volume is removed, ACS inserts a VOLUME.DELETE record into the cloud.usage_event table. If the volume is removed without the expunge option, it can still be restored.
When the volume is restored, ACS does not insert a new record in the cloud.usage_event stating that it has been recreated. Thus, the volume continues to be used without being accounted for.
This PR adds an event in the volume restore process that indicates the volume was recreated. So it will be accounted for.

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)

Feature/Enhancement Scale or Bug Severity

Feature/Enhancement Scale

  • Major
  • Minor

Bug Severity

  • BLOCKER
  • Critical
  • Major
  • Minor
  • Trivial

Screenshots (if appropriate):

How Has This Been Tested?

This PR was tested in a local lab, by destroying and recreating volumes and checking the DB to see if the event was added.
Some unit tests were also added.

@DaanHoogland
Copy link
Copy Markdown
Contributor

@JoaoJandre did you look at the flow for changeOfferingForVolume, migrateVolume, resizeVolume and updateVolume?
Not sure but the code you extracted may be used there as well.
Please check, CLGTM otherwise.

@JoaoJandre JoaoJandre force-pushed the add-event-to-recoverVolume branch from 2dbe96a to ac3c49e Compare September 28, 2022 15:27
@JoaoJandre
Copy link
Copy Markdown
Contributor Author

@JoaoJandre did you look at the flow for changeOfferingForVolume, migrateVolume, resizeVolume and updateVolume? Not sure but the code you extracted may be used there as well. Please check, CLGTM otherwise.

@DaanHoogland I checked these flows and the event publishes in these places are a bit different, the ones I saw at least already had the diskOfferingVO available, so if we used the new method I extracted we would be making an unnecessary call to the DB.

Copy link
Copy Markdown
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.

clgtm

@DaanHoogland
Copy link
Copy Markdown
Contributor

@blueorangutan package

@blueorangutan
Copy link
Copy Markdown

@DaanHoogland a Jenkins job has been kicked to build packages. It will be bundled with KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress.

@blueorangutan
Copy link
Copy Markdown

Packaging result: ✖️ el7 ✖️ el8 ✔️ debian ✖️ suse15. SL-JID 4305

@blueorangutan
Copy link
Copy Markdown

Packaging result: ✔️ el7 ✔️ el8 ✔️ debian ✔️ suse15. SL-JID 4314

@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

@DaanHoogland
Copy link
Copy Markdown
Contributor

@harikrishna-patnala @GutoVeronezi can you guys have a look?

@blueorangutan
Copy link
Copy Markdown

Trillian test result (tid-5046)
Environment: kvm-centos7 (x2), Advanced Networking with Mgmt server 7
Total time taken: 42392 seconds
Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr6772-t5046-kvm-centos7.zip
Smoke tests completed. 103 look OK, 0 have errors, 0 did not run
Only failed and skipped tests results shown below:

Test Result Time (s) Test File

@codecov
Copy link
Copy Markdown

codecov bot commented Sep 30, 2022

Codecov Report

Merging #6772 (947768e) into main (d9dd4c1) will decrease coverage by 0.00%.
The diff coverage is 84.61%.

@@             Coverage Diff              @@
##               main    #6772      +/-   ##
============================================
- Coverage     10.52%   10.52%   -0.01%     
- Complexity     6784     6789       +5     
============================================
  Files          2464     2464              
  Lines        243988   244171     +183     
  Branches      38185    38205      +20     
============================================
+ Hits          25690    25709      +19     
- Misses       215065   215228     +163     
- Partials       3233     3234       +1     
Impacted Files Coverage Δ
.../src/main/java/com/cloud/vm/UserVmManagerImpl.java 5.61% <0.00%> (+0.01%) ⬆️
...n/java/com/cloud/storage/VolumeApiServiceImpl.java 12.87% <91.66%> (+0.42%) ⬆️
...dstack/network/contrail/model/ModelObjectBase.java 21.15% <0.00%> (-7.70%) ⬇️
.../main/java/com/cloud/vm/dao/VMInstanceDaoImpl.java 27.34% <0.00%> (-0.74%) ⬇️
...n/java/com/cloud/capacity/dao/CapacityDaoImpl.java 3.24% <0.00%> (-0.13%) ⬇️
.../src/main/java/com/cloud/vm/dao/UserVmDaoImpl.java 0.77% <0.00%> (-0.07%) ⬇️
...n/java/com/cloud/template/TemplateManagerImpl.java 10.97% <0.00%> (-0.02%) ⬇️
...che/cloudstack/metrics/PrometheusExporterImpl.java 0.00% <0.00%> (ø)
...e/cloudstack/metrics/PrometheusExporterServer.java 0.00% <0.00%> (ø)
...apache/cloudstack/alert/snmp/SnmpTrapAppender.java 61.05% <0.00%> (+2.10%) ⬆️
... and 2 more

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@acs-robot
Copy link
Copy Markdown

Found UI changes, kicking a new UI QA build
@blueorangutan ui

@blueorangutan
Copy link
Copy Markdown

@acs-robot a Jenkins job has been kicked to build UI QA env. I'll keep you posted as I make progress.

@JoaoJandre JoaoJandre force-pushed the add-event-to-recoverVolume branch from 166e846 to 710cf97 Compare September 30, 2022 18:34
@acs-robot
Copy link
Copy Markdown

Found UI changes, kicking a new UI QA build
@blueorangutan ui

@blueorangutan
Copy link
Copy Markdown

@acs-robot a Jenkins job has been kicked to build UI QA env. I'll keep you posted as I make progress.

@acs-robot
Copy link
Copy Markdown

Found UI changes, kicking a new UI QA build
@blueorangutan ui

@blueorangutan
Copy link
Copy Markdown

UI build: ✔️
Live QA URL: http://qa.cloudstack.cloud:8080/client/pr/6772 (SL-JID-2448)

@blueorangutan
Copy link
Copy Markdown

@acs-robot a Jenkins job has been kicked to build UI QA env. I'll keep you posted as I make progress.

@blueorangutan
Copy link
Copy Markdown

UI build: ✔️
Live QA URL: http://qa.cloudstack.cloud:8080/client/pr/6772 (SL-JID-2449)

@blueorangutan
Copy link
Copy Markdown

UI build: ✔️
Live QA URL: http://qa.cloudstack.cloud:8080/client/pr/6772 (SL-JID-2450)

Copy link
Copy Markdown
Contributor

@GutoVeronezi GutoVeronezi left a comment

Choose a reason for hiding this comment

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

LGTM

@sonarqubecloud
Copy link
Copy Markdown

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

72.2% 72.2% Coverage
0.0% 0.0% Duplication

@DaanHoogland
Copy link
Copy Markdown
Contributor

@JoaoJandre almost ready to merge. I might be overcautious but I´d like someone to test the merged code.
@vladimirpetrov can you do that?

@yadvr yadvr added this to the 4.18.0.0 milestone Oct 8, 2022
@yadvr
Copy link
Copy Markdown
Member

yadvr commented Oct 8, 2022

@blueorangutan package

@blueorangutan
Copy link
Copy Markdown

@rohityadavcloud a Jenkins job has been kicked to build packages. It will be bundled with KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress.

@blueorangutan
Copy link
Copy Markdown

Packaging result: ✖️ el7 ✔️ el8 ✔️ debian ✖️ suse15. SL-JID 4379

@yadvr
Copy link
Copy Markdown
Member

yadvr commented Oct 9, 2022

@blueorangutan package

@blueorangutan
Copy link
Copy Markdown

@rohityadavcloud a Jenkins job has been kicked to build packages. It will be bundled with KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress.

@blueorangutan
Copy link
Copy Markdown

Packaging result: ✖️ el7 ✔️ el8 ✔️ debian ✔️ suse15. SL-JID 4399

@yadvr
Copy link
Copy Markdown
Member

yadvr commented Oct 9, 2022

@blueorangutan package

@blueorangutan
Copy link
Copy Markdown

@rohityadavcloud a Jenkins job has been kicked to build packages. It will be bundled with SystemVM template(s). I'll keep you posted as I make progress.

@blueorangutan
Copy link
Copy Markdown

Packaging result: ✔️ el7 ✔️ el8 ✖️ debian ✔️ suse15. SL-JID 4402

@yadvr
Copy link
Copy Markdown
Member

yadvr commented Oct 9, 2022

@blueorangutan test

@blueorangutan
Copy link
Copy Markdown

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

@blueorangutan
Copy link
Copy Markdown

Trillian Build Failed (tid-5091)

@yadvr
Copy link
Copy Markdown
Member

yadvr commented Oct 9, 2022

@blueorangutan test

@blueorangutan
Copy link
Copy Markdown

@rohityadavcloud 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-5092)
Environment: kvm-centos7 (x2), Advanced Networking with Mgmt server 7
Total time taken: 40932 seconds
Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr6772-t5092-kvm-centos7.zip
Smoke tests completed. 103 look OK, 1 have errors, 0 did not run
Only failed and skipped tests results shown below:

Test Result Time (s) Test File
test_08_upgrade_kubernetes_ha_cluster Failure 586.47 test_kubernetes_clusters.py

@DaanHoogland DaanHoogland merged commit d6044fb into apache:main Oct 11, 2022
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