Skip to content

Fix migration from local storage to NFS in KVM - #8909

Merged
yadvr merged 3 commits into
apache:4.19from
scclouds:fix-nfs-special-case
Jun 24, 2024
Merged

Fix migration from local storage to NFS in KVM#8909
yadvr merged 3 commits into
apache:4.19from
scclouds:fix-nfs-special-case

Conversation

@JoaoJandre

@JoaoJandreJoaoJandre commented Apr 12, 2024

Copy link
Copy Markdown
Contributor

Description

Using KVM as a hypervisor, when performing a live migration of a VM with a volume, if the volume is on local storage and the migration destination is an NFS storage, an error occurs during the migration. This happens because there is a validation to check whether the destination host has direct access to the source storage of the volume being migrated. However, this validation is not necessary, since the host that will perform the migration is the source host itself. Therefore, the destination host only needs access to the destination storage.

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)
  • build/CI

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?

Before this PR, the following live volume migration cases failed in KVM:

VolumeOriginDestination
ROOTLocalNFS1
DATA1LocalNFS1
VolumeOriginDestination
ROOTLocalNFS1

With this PR, the above cases now work. Furthermore, the following cases where validated, to make sure that no regressions were introduced:

VolumeOriginDestination
ROOTNFS1NFS2
DATA1NFS1NFS2
VolumeOriginDestination
ROOTNFS1Local
DATA1NFS1Local
VolumeOriginDestination
ROOTNFS1ISCSI1
DATA1NFS1ISCSI1
VolumeOriginDestination
ROOTISCSI1NFS1
DATA1ISCSI1NFS1

@codecov-commenter

codecov-commenter commented Apr 12, 2024

Copy link
Copy Markdown

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 4.31%. Comparing base (c25264b) to head (0bec7da).
Report is 164 commits behind head on 4.19.

Current head 0bec7da differs from pull request most recent head b8a77d2

Please upload reports for the commit b8a77d2 to get more accurate results.

Additional details and impacted files
@@ Coverage Diff @@## 4.19 #8909 +/- ##
============================================
- Coverage 30.98% 4.31% -26.67% 
============================================
Files 5359 362 -4997 Lines 377017 29176 -347841 Branches 54856 5120 -49736 ============================================
- Hits 116804 1260 -115544 + Misses 244852 27774 -217078 + Partials 15361 142 -15219 
FlagCoverage Δ
simulator-marvin-tests?
uitests4.31% <ø> (-0.06%)⬇️
unit-tests?

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@yadvr

Copy link
Copy Markdown
Member

@JoaoJandre is this also applicable fix for 4.19?

@JoaoJandre

Copy link
Copy Markdown
ContributorAuthor

@JoaoJandre is this also applicable fix for 4.19?

@rohityadavcloud yes, I'll rebase with 4.19 and target it

@JoaoJandre
JoaoJandreforce-pushed the fix-nfs-special-case branch from 0bec7da to 2f2d741CompareApril 12, 2024 19:46
@JoaoJandre
JoaoJandre changed the base branch from main to 4.19April 12, 2024 19:46
@JoaoJandreJoaoJandre modified the milestones: 4.20.0.0, 4.19.1.0Apr 12, 2024
@sureshanaparti

Copy link
Copy Markdown
Contributor

@blueorangutan package

@blueorangutan

Copy link
Copy Markdown

@sureshanaparti a [SL] 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 [SF]: ✖️ el7 ✖️ el8 ✖️ el9 ✖️ debian ✖️ suse15. SL-JID 9251

@DaanHoogland

Copy link
Copy Markdown
Contributor

@JoaoJandre :

09:11:09 [ERROR] /jenkins/workspace/acs-centos7-pkg-builder/dist/rpmbuild/BUILD/cloudstack-4.19.1.0-SNAPSHOT/engine/storage/datamotion/src/test/java/org/apache/cloudstack/storage/motion/StorageSystemDataMotionStrategyTest.java:26:15: Unused import - org.mockito.Mockito.never. [UnusedImports]
09:11:09 [ERROR] /jenkins/workspace/acs-centos7-pkg-builder/dist/rpmbuild/BUILD/cloudstack-4.19.1.0-SNAPSHOT/engine/storage/datamotion/src/test/java/org/apache/cloudstack/storage/motion/StorageSystemDataMotionStrategyTest.java:51:8: Unused import - org.mockito.verification.VerificationMode. [UnusedImports]
09:11:09 [ERROR] /jenkins/workspace/acs-centos7-pkg-builder/dist/rpmbuild/BUILD/cloudstack-4.19.1.0-SNAPSHOT/engine/storage/datamotion/src/test/java/org/apache/cloudstack/storage/motion/StorageSystemDataMotionStrategyTest.java:65:8: Unused import - java.util.LinkedList. [UnusedImports]

@JoaoJandre

Copy link
Copy Markdown
ContributorAuthor

@blueorangutan package

@blueorangutan

Copy link
Copy Markdown

@JoaoJandre a [SL] 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 [SF]: ✔️ el7 ✔️ el8 ✔️ el9 ✔️ debian ✔️ suse15. SL-JID 9261

@JoaoJandre

Copy link
Copy Markdown
ContributorAuthor

@sureshanaparti could we run the CI here?

@DaanHoogland

Copy link
Copy Markdown
Contributor

@blueorangutan test

@blueorangutan

Copy link
Copy Markdown

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

@blueorangutan

Copy link
Copy Markdown

[SF] Trillian Build Failed (tid-9871)

@blueorangutan

Copy link
Copy Markdown

[SF] Trillian test result (tid-9875)
Environment: kvm-centos7 (x2), Advanced Networking with Mgmt server 7
Total time taken: 46521 seconds
Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr8909-t9875-kvm-centos7.zip
Smoke tests completed. 127 look OK, 2 have errors, 0 did not run
Only failed and skipped tests results shown below:

TestResultTime (s)Test File
test_01_events_resourceError296.90test_events_resource.py
test_01_events_resourceError296.91test_events_resource.py
test_04_deploy_vm_for_other_user_and_test_vm_operationsFailure84.97test_network_permissions.py
ContextSuite context=TestNetworkPermissions>:teardownError1.43test_network_permissions.py

@JoaoJandre

Copy link
Copy Markdown
ContributorAuthor

@blueorangutan package

@blueorangutan

Copy link
Copy Markdown

@JoaoJandre a [SL] 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.

@JoaoJandre

Copy link
Copy Markdown
ContributorAuthor

@JoaoJandre thanks for this fix, I'm trying to reproduce the issue and bug fix, what APIs are you using the replicate this situation. I'm questioning how do you migrate a volume with shared storage offering to local storage?

I did all tests using live VM + volume migration on the UI. I was able to migrate volumes from NFS to local and from local to NFS this way. Looking at the API call that the UI made, it was using migrateVirtualMachineWithVolume. Something like:

http://<mgmtserver>/client/api/?hostid=e8050fa0-c834-47c5-9a1e-089595aa2edc&virtualmachineid=27640463-d916-4e9b-b223-4f3c84fc828a&migrateto[0].volume=31df1fe1-53f2-4ff5-9b86-d75f6f2afe85&migrateto[0].pool=49a3f50d-e70c-4963-8e6a-f70e3a9d295d&command=migrateVirtualMachineWithVolume&response=json

@borisstoyanovborisstoyanov 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.

Thanks @JoaoJandre, we have the option when changing disk offering to migrate to another storage if required, why not fix it there instead?
Screenshot 2024-06-12 at 11 44 52

I think it's more lean approach to execute this operation since in the case you've described you might end up with volume on shared storage while having assigned offering of local storage and vice versa.
Currently migrating cross different types of storage seems not working when changing the offering ( returns 'Index 0 out of bounds for length 0' ), would you consider moving the fix there?

@JoaoJandre

Copy link
Copy Markdown
ContributorAuthor

Thanks @JoaoJandre, we have the option when changing disk offering to migrate to another storage if required, why not fix it there instead? Screenshot 2024-06-12 at 11 44 52

I think it's more lean approach to execute this operation since in the case you've described you might end up with volume on shared storage while having assigned offering of local storage and vice versa. Currently migrating cross different types of storage seems not working ( returns 'Index 0 out of bounds for length 0' ), would you consider moving the fix there?

Hey @borisstoyanov,

I think you misunderstood the PR. The issue is not with the disk offering, but with a validation that makes no sense: the destination host does not need to have access to the original storage, regardless of the disk offering. This PR fixes the current validation to reflect that.

About ending up with a disk offering in a storage with different type, this is current behavior, as introduced in #2425. It is assumed that when the ROOT admin migrates the volume somewhere, they know what they are doing. Same applies to migrating VMs to hosts that do not have a certain tag, the root admin has this power.

I didn't understand your last point, are you saying that this PR broke migration across different types of storage, or that this is a current issue? if so, could you give me the link to the issue?

@borisstoyanovborisstoyanov 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.

I apologise @JoaoJandre, I thought this was much deeper change, what you suggest is making sense now, and the issues I'm pointing out are not related to your PR.
LGTM

@JoaoJandre

Copy link
Copy Markdown
ContributorAuthor

I apologise @JoaoJandre, I thought this was much deeper change, what you suggest is making sense now, and the issues I'm pointing out are not related to your PR. LGTM

No problem @borisstoyanov :)

@yadvr

Copy link
Copy Markdown
Member

Re-kicking GH actions

@yadvryadvr closed this Jun 21, 2024
@yadvryadvr reopened this Jun 21, 2024
@yadvr

Copy link
Copy Markdown
Member

Is this otherwise good to merge @JoaoJandre@sureshanaparti@DaanHoogland ?
@blueorangutan package

@blueorangutan

Copy link
Copy Markdown

@rohityadavcloud a [SL] 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 [SF]: ✔️ el7 ✔️ el8 ✔️ el9 ✔️ debian ✔️ suse15. SL-JID 10053

@JoaoJandre

Copy link
Copy Markdown
ContributorAuthor

Is this otherwise good to merge @JoaoJandre@sureshanaparti@DaanHoogland ? @blueorangutan package

@rohityadavcloud Only need one more +1

@blueorangutan

Copy link
Copy Markdown

@JoaoJandre a [SL] Jenkins job has been kicked to build packages. It will be bundled with@rohityadavcloud Only need one more +1 SystemVM template(s). I'll keep you posted as I make progress.

@blueorangutan

Copy link
Copy Markdown

Packaging result [SF]: ✔️ el7 ✔️ el8 ✔️ el9 ✔️ debian ✔️ suse15. SL-JID 10055

@DaanHooglandDaanHoogland 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.

code looks good and trusting the testing done

@sureshanapartisureshanaparti 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, didn't test

@sureshanaparti

Copy link
Copy Markdown
Contributor

@blueorangutan package

@blueorangutan

Copy link
Copy Markdown

@sureshanaparti a [SL] 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.

@DaanHoogland

Copy link
Copy Markdown
Contributor

@sureshanaparti always good to have one more round of smoke testing, but I think we can merge.

@blueorangutan

Copy link
Copy Markdown

Packaging result [SF]: ✔️ el7 ✔️ el8 ✔️ el9 ✔️ debian ✔️ suse15. SL-JID 10058

@DaanHoogland

Copy link
Copy Markdown
Contributor

@blueorangutan test alma9 kvm-alma9

@blueorangutan

Copy link
Copy Markdown

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

@blueorangutan

Copy link
Copy Markdown

[SF] Trillian test result (tid-10559)
Environment: kvm-alma9 (x2), Advanced Networking with Mgmt server a9
Total time taken: 46931 seconds
Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr8909-t10559-kvm-alma9.zip
Smoke tests completed. 131 look OK, 0 have errors, 0 did not run
Only failed and skipped tests results shown below:

TestResultTime (s)Test File

@yadvr
yadvr merged commit 3e30283 into apache:4.19Jun 24, 2024
dhslove pushed a commit to ablecloud-team/ablestack-cloud that referenced this pull request Jul 2, 2024
* fix migration from local to nfs
* remove unused imports
* remove dead code
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Projects

No open projects
Status: Done

Development

Successfully merging this pull request may close these issues.

7 participants

@JoaoJandre@codecov-commenter@yadvr@sureshanaparti@blueorangutan@DaanHoogland@borisstoyanov