Skip to content

server: fix volume migration on user vm scale#6704

Merged
yadvr merged 9 commits into
apache:4.17from
shapeblue:fix-user-scalevm-vol-migration
Nov 30, 2022
Merged

server: fix volume migration on user vm scale#6704
yadvr merged 9 commits into
apache:4.17from
shapeblue:fix-user-scalevm-vol-migration

Conversation

@shwstppr

@shwstppr shwstppr commented Sep 5, 2022

Copy link
Copy Markdown
Contributor

Description

Fixes #6701

When volume migration is initiated by system, account check is not needed.

Introduces a new global setting - allow.diskOffering.change.during.scale.vm
Determines whether to allow or disallow disk offering change for root volume during scaling of a stopped or running VM. Default value is true

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?

Fixes apache#6701

When volume migration is initiated by system account check is not needed.

Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com>
@shwstppr

shwstppr commented Sep 5, 2022

Copy link
Copy Markdown
Contributor Author

@blueorangutan package

@blueorangutan

Copy link
Copy Markdown

@shwstppr 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 4129

@sonarqubecloud

sonarqubecloud Bot commented Sep 5, 2022

Copy link
Copy Markdown

SonarCloud Quality Gate failed.    Quality Gate failed

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

0.0% 0.0% Coverage
0.0% 0.0% Duplication

@shwstppr

shwstppr commented Sep 5, 2022

Copy link
Copy Markdown
Contributor Author

@blueorangutan test

@blueorangutan

Copy link
Copy Markdown

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

@codecov

codecov Bot commented Sep 5, 2022

Copy link
Copy Markdown

Codecov Report

Merging #6704 (94db086) into 4.17 (296035d) will decrease coverage by 0.00%.
The diff coverage is 4.16%.

❗ Current head 94db086 differs from pull request most recent head 2c7f27f. Consider uploading reports for the commit 2c7f27f to get more accurate results

@@             Coverage Diff              @@
##               4.17    #6704      +/-   ##
============================================
- Coverage     10.34%   10.34%   -0.01%     
- Complexity     6610     6611       +1     
============================================
  Files          2451     2451              
  Lines        242340   242352      +12     
  Branches      37924    37926       +2     
============================================
- Hits          25070    25066       -4     
- Misses       214182   214198      +16     
  Partials       3088     3088              
Impacted Files Coverage Δ
...in/java/com/cloud/server/ManagementServerImpl.java 2.50% <0.00%> (-0.01%) ⬇️
...n/java/com/cloud/storage/VolumeApiServiceImpl.java 10.79% <0.00%> (-0.03%) ⬇️
.../src/main/java/com/cloud/vm/UserVmManagerImpl.java 5.63% <0.00%> (-0.01%) ⬇️
.../apache/cloudstack/vm/UnmanagedVMsManagerImpl.java 31.62% <0.00%> (ø)
...rver/src/main/java/com/cloud/vm/UserVmManager.java 100.00% <100.00%> (ø)
...rg/apache/cloudstack/quota/QuotaStatementImpl.java 36.28% <0.00%> (-3.99%) ⬇️
...dstack/network/contrail/model/ModelObjectBase.java 28.84% <0.00%> (+7.69%) ⬆️

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

@blueorangutan

Copy link
Copy Markdown

Trillian test result (tid-4820)
Environment: kvm-centos7 (x2), Advanced Networking with Mgmt server 7
Total time taken: 40069 seconds
Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr6704-t4820-kvm-centos7.zip
Smoke tests completed. 100 look OK, 1 have errors
Only failed tests results shown below:

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

@shwstppr
shwstppr marked this pull request as ready for review September 6, 2022 09:17
@shwstppr

shwstppr commented Sep 6, 2022

Copy link
Copy Markdown
Contributor Author

Moving this to draft, need to revisit this later. Ideally, the normal user should not be allowed to scale VM or change volume offering with volume migration.

@DaanHoogland

Copy link
Copy Markdown
Contributor

Moving this to draft, need to revisit this later. Ideally, the normal user should not be allowed to scale VM or change volume offering with volume migration.

is ther some technical reason not to allow that @shwstppr ? because from a business point of view I would want them to be able to scale VMs and volumes.

@shwstppr

Copy link
Copy Markdown
Contributor Author

@DaanHoogland didn't understand you.
I was saying scale VM operation shouldn't be allowed with migration of volume and without migration it should be fine.
This was based on the fact that by default user role is not allowed to use migrateVolume API.

@DaanHoogland

Copy link
Copy Markdown
Contributor

@DaanHoogland didn't understand you. I was saying scale VM operation shouldn't be allowed with migration of volume and without migration it should be fine. This was based on the fact that by default user role is not allowed to use migrateVolume API.

ok, makes sense, migration not being allowed. sorry I misunderstood.

@DaanHoogland DaanHoogland left a comment

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.

clgtm

@blueorangutan

Copy link
Copy Markdown

Trillian Build Failed (tid-5131)

@blueorangutan

Copy link
Copy Markdown

Trillian Build Failed (tid-5137)

…o allow or skip disk offering change upon scale VM operation.

Added marvin tests to verify scale VM operation with user account and also to verify the new global/zone setting
@shwstppr

Copy link
Copy Markdown
Contributor Author

@blueorangutan test matrix

@blueorangutan

Copy link
Copy Markdown

@shwstppr a Trillian-Jenkins matrix job (centos7 mgmt + xs71, centos7 mgmt + vmware65, centos7 mgmt + kvmcentos7) has been kicked to run smoke tests

@soreana

soreana commented Nov 24, 2022

Copy link
Copy Markdown
Member

I've tested this pr, wiith this patch, I can scale the VM as a domain admin.

@blueorangutan

Copy link
Copy Markdown

Trillian test result (tid-5259)
Environment: xenserver-71 (x2), Advanced Networking with Mgmt server 7
Total time taken: 37792 seconds
Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr6704-t5259-xenserver-71.zip
Smoke tests completed. 100 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 622.38 test_kubernetes_clusters.py

@blueorangutan

Copy link
Copy Markdown

Trillian test result (tid-5261)
Environment: vmware-65u2 (x2), Advanced Networking with Mgmt server 7
Total time taken: 39341 seconds
Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr6704-t5261-vmware-65u2.zip
Smoke tests completed. 101 look OK, 0 have errors, 0 did not run
Only failed and skipped tests results shown below:

Test Result Time (s) Test File

@blueorangutan

Copy link
Copy Markdown

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

Test Result Time (s) Test File

@yadvr

yadvr commented Nov 25, 2022

Copy link
Copy Markdown
Member

Test LGTM
@borisstoyanov @vladimirpetrov can you help test this?

Comment thread server/src/main/java/com/cloud/storage/VolumeApiServiceImpl.java
yadvr and others added 2 commits November 29, 2022 13:33
Co-authored-by: Daniel Augusto Veronezi Salvador <38945620+GutoVeronezi@users.noreply.github.com>
Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
@yadvr

yadvr commented Nov 29, 2022

Copy link
Copy Markdown
Member

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

@yadvr
yadvr requested a review from GutoVeronezi November 29, 2022 11:17
@yadvr

yadvr commented Nov 29, 2022

Copy link
Copy Markdown
Member

env issue - pkg is okay for EL7 and others (will rekick after smoketests)
@blueorangutan test

@blueorangutan

Copy link
Copy Markdown

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

Comment on lines +1835 to +1840
private boolean compareEqualsIncludingNullOrZero(Long a, Long b) {
a = ObjectUtils.defaultIfNull(a, 0L);
b = ObjectUtils.defaultIfNull(b, 0L);

return a.equals(b);
}

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.

@shwstppr, we could move this method to com.cloud.utils.NumbersUtils and add some unit tests.

* @param b
* @return true if a and b are equal excluding 0 and null values.
*/
private boolean compareEqualsIncludingNullOrZero(Long a, Long b) {

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.

@shwstppr, what do you think about renaming the method to compareLongsDefaultingNullToZero?

Comment thread server/src/main/java/com/cloud/vm/UserVmManager.java Outdated
Comment thread server/src/main/java/com/cloud/vm/UserVmManagerImpl.java Outdated

@vladimirpetrov vladimirpetrov left a comment

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.

LGTM based on manual testing.

@blueorangutan

Copy link
Copy Markdown

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

Test Result Time (s) Test File

Comment thread server/src/main/java/com/cloud/vm/UserVmManager.java Outdated
yadvr and others added 2 commits November 30, 2022 12:47
Co-authored-by: Daniel Augusto Veronezi Salvador <38945620+GutoVeronezi@users.noreply.github.com>
@yadvr

yadvr commented Nov 30, 2022

Copy link
Copy Markdown
Member

I've committed suggestions, there's one outstanding on refactoring to a utils which can be done in a separate PR as #shwstppr is on holiday this week. I'll merge this to keep effort on-going for 4.17.2.0 release.
@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.

@yadvr
yadvr merged commit 47946db into apache:4.17 Nov 30, 2022
@blueorangutan

Copy link
Copy Markdown

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

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.

10 participants