Skip to content

vmware: fix migrate vm with volume - #5170

Merged
yadvr merged 3 commits into
apache:mainfrom
shapeblue:fix-vmw-relocateexception
Jul 15, 2021
Merged

vmware: fix migrate vm with volume#5170
yadvr merged 3 commits into
apache:mainfrom
shapeblue:fix-vmw-relocateexception

Conversation

@shwstppr

@shwstpprshwstppr commented Jun 30, 2021

Copy link
Copy Markdown
Contributor

Description

Recent forward merge of 4.15 branch accidentally brought a bug in VM relocation method for VMware while trying to find datastore for the migrated volume.
This PR fixes it by using either of available target or source host.

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?

[root@pr5030-t1171-vmware-65u2-marvin marvin]# nosetests --with-xunit --xunit-file=results.xml --with-marvin --marvin-config=./pr5030-t1171-vmware-65u2-advanced-cfg -s -a tags=advanced --hypervisor=VMware tests/smoke/test_vm_life_cycle.py
==== Marvin Init Started ====
=== Marvin Parse Config Successful ===
=== Marvin Setting TestData Successful===
==== Log Folder Path: /marvin/MarvinLogs/Jun_30_2021_10_47_36_DT690J. All logs will be available here ====
=== Marvin Init Logging Successful===
==== Marvin Init Successful ====
=== TestName: test_advZoneVirtualRouter | Status : SUCCESS ===
=== TestName: test_deploy_vm | Status : SUCCESS ===
=== TestName: test_deploy_vm_multiple | Status : SUCCESS ===
=== TestName: test_01_migrate_VM_and_root_volume | Status : SUCCESS ===
=== TestName: test_02_migrate_VM_with_two_data_disks | Status : SUCCESS ===
=== TestName: test_03_migrate_detached_volume | Status : SUCCESS ===
=== TestName: test_01_unmanage_vm_cycle | Status : SUCCESS ===
...

Recent forward merge of 4.15 branch accidentally brought a bug in VM relocation method for VMware while trying to find datastore for the migrated volume.
This PR fixes it by using either of available target or source host.
Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com>
newVol.setDataStoreUuid(entry.second().getUuid());
String newPath = vmMo.getVmdkFileBaseName(disk);
ManagedObjectReference morDs = HypervisorHostHelper.findDatastoreWithBackwardsCompatibility(targetHyperHost, entry.second().getUuid());
ManagedObjectReference morDs = HypervisorHostHelper.findDatastoreWithBackwardsCompatibility(targetHyperHost != null ? targetHyperHost : sourceHyperHost, entry.second().getUuid());

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.

@shwstppr might sourceHyperHost be null as well ?

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

@weizhouapache Method gets sourceHyperHost either from caller or the host which is processing the command,
https://github.com/apache/cloudstack/pull/5170/files#diff-77635c5f7eb9cef514aaf69e2fdc9217619afc9005bf8db9585c176e7401a88bR7329-R7331
Cannot be null if the command is being processed

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.

@shwstppr great, thanks.

no idea if it breaks some features. at least the NPE is fixed by this pr.

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

Above ^^ is my understanding. Let me know if there should be additional checks @weizhouapache

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

Change was originally introduced here, d2ab350

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 if the origin is a merge commit than this should be fixed on the older branch and merged forward.

@shwstppr

Copy link
Copy Markdown
ContributorAuthor

@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. SL-JID 432

@weizhouapache

Copy link
Copy Markdown
Member

@blueorangutan test centos7 vmware-65u2

@blueorangutan

Copy link
Copy Markdown

@weizhouapache a Trillian-Jenkins test job (centos7 mgmt + vmware-65u2) has been kicked to run smoke tests

DaanHoogland
DaanHoogland previously requested changes Jun 30, 2021

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

clgtm but please change base branch to 4.15

newVol.setDataStoreUuid(entry.second().getUuid());
String newPath = vmMo.getVmdkFileBaseName(disk);
ManagedObjectReference morDs = HypervisorHostHelper.findDatastoreWithBackwardsCompatibility(targetHyperHost, entry.second().getUuid());
ManagedObjectReference morDs = HypervisorHostHelper.findDatastoreWithBackwardsCompatibility(targetHyperHost != null ? targetHyperHost : sourceHyperHost, entry.second().getUuid());

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 if the origin is a merge commit than this should be fixed on the older branch and merged forward.

@shwstppr

Copy link
Copy Markdown
ContributorAuthor

@DaanHoogland 4.15 has a different code. Change that resulted in error was added in d2ab350 to probably address merge conflicts cc @nvazquez

@nvazquez

nvazquez commented Jun 30, 2021

Copy link
Copy Markdown
Contributor

Thanks @shwstppr I have resolved conflicts to merge 4.15 into main, did I miss those changes? Most of the conflicts were from this PR: #5097 as the logic differs from 4.15 and main in those files

@shwstppr

shwstppr commented Jun 30, 2021

Copy link
Copy Markdown
ContributorAuthor

@nvazquez no, I don't think anything was missed. Just that line of code that finds datastore for the migrated volume needed small change as targetHyperHost can be null in relocateVirtualMachine method. https://github.com/apache/cloudstack/pull/5097/files#diff-77635c5f7eb9cef514aaf69e2fdc9217619afc9005bf8db9585c176e7401a88bR4808

And since the relocateVirtualMachine method is not there in 4.15 code, changes from this PR are not needed there.

@shwstppr

Copy link
Copy Markdown
ContributorAuthor

@blueorangutan test centos7 vmware-65u2

@blueorangutan

Copy link
Copy Markdown

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

@blueorangutan

Copy link
Copy Markdown

Trillian test result (tid-1185)
Environment: vmware-65u2 (x2), Advanced Networking with Mgmt server 7
Total time taken: 33856 seconds
Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr5170-t1185-vmware-65u2.zip
Intermittent failure detected: /marvin/tests/smoke/test_vpc_router_nics.py
Intermittent failure detected: /marvin/tests/smoke/test_vpc_vpn.py
Intermittent failure detected: /marvin/tests/smoke/test_host_maintenance.py
Smoke tests completed. 85 look OK, 3 have error(s)
Only failed tests results shown below:

TestResultTime (s)Test File
test_01_VPC_nics_after_destroyError5.65test_vpc_router_nics.py
test_02_VPC_default_routesError5.62test_vpc_router_nics.py
test_01_redundant_vpc_site2site_vpnFailure8.39test_vpc_vpn.py
test_01_vpc_site2site_vpn_multiple_optionsFailure6.33test_vpc_vpn.py
test_01_vpc_remote_access_vpnFailure3.16test_vpc_vpn.py
test_01_vpc_site2site_vpnFailure5.31test_vpc_vpn.py
test_01_cancel_host_maintenace_with_no_migration_jobsError0.04test_host_maintenance.py
test_02_cancel_host_maintenace_with_migration_jobsError0.03test_host_maintenance.py
test_03_cancel_host_maintenace_with_migration_jobs_failureError0.03test_host_maintenance.py

@blueorangutan

Copy link
Copy Markdown

Packaging result: ✔️ centos7 ✔️ centos8 ✔️ debian. SL-JID 455

@shwstppr

Copy link
Copy Markdown
ContributorAuthor

Though migration tests from test_vm_lifecycle.py seem to be running fine, re-running tests to verify intermittent failures

@blueorangutan test centos7 vmware-65u2

@blueorangutan

Copy link
Copy Markdown

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

@shwstpprshwstppr closed this Jul 2, 2021
@shwstpprshwstppr reopened this Jul 2, 2021
@DaanHoogland
DaanHoogland dismissed their stale reviewJuly 2, 2021 11:52

concerns answerred

@shwstppr

Copy link
Copy Markdown
ContributorAuthor

@blueorangutan test centos7 vmware-65u2

@blueorangutan

Copy link
Copy Markdown

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

@shwstpprshwstppr closed this Jul 5, 2021
@shwstpprshwstppr reopened this Jul 5, 2021
@blueorangutan

Copy link
Copy Markdown

Trillian test result (tid-1198)
Environment: vmware-65u2 (x2), Advanced Networking with Mgmt server 7
Total time taken: 50235 seconds
Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr5170-t1198-vmware-65u2.zip
Intermittent failure detected: /marvin/tests/smoke/test_diagnostics.py
Intermittent failure detected: /marvin/tests/smoke/test_network.py
Intermittent failure detected: /marvin/tests/smoke/test_routers_network_ops.py
Intermittent failure detected: /marvin/tests/smoke/test_vm_life_cycle.py
Intermittent failure detected: /marvin/tests/smoke/test_vpc_redundant.py
Intermittent failure detected: /marvin/tests/smoke/test_vpc_router_nics.py
Intermittent failure detected: /marvin/tests/smoke/test_host_maintenance.py
Smoke tests completed. 85 look OK, 3 have error(s)
Only failed tests results shown below:

TestResultTime (s)Test File
test_01_ping_in_vr_successFailure15.34test_diagnostics.py
test_05_ping_in_cpvm_successFailure5.14test_diagnostics.py
test_07_arping_in_vrFailure5.14test_diagnostics.py
test_02_RVR_Network_FW_PF_SSH_default_routes_egress_falseFailure405.89test_routers_network_ops.py
test_01_create_redundant_VPC_2tiers_4VMs_4IPs_4PF_ACLFailure617.55test_vpc_redundant.py
test_03_create_redundant_VPC_1tier_2VMs_2IPs_2PF_ACL_reboot_routersFailure563.75test_vpc_redundant.py
test_05_rvpc_multi_tiersFailure597.71test_vpc_redundant.py

shwstpprand others added 2 commits July 5, 2021 18:14
…vmware/resource/VmwareResource.java
Co-authored-by: Daniel Augusto Veronezi Salvador <38945620+GutoVeronezi@users.noreply.github.com>
Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com>
@shwstppr

Copy link
Copy Markdown
ContributorAuthor

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

@shwstpprshwstppr closed this Jul 5, 2021
@shwstpprshwstppr reopened this Jul 5, 2021
@blueorangutan

Copy link
Copy Markdown

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

@shwstppr

Copy link
Copy Markdown
ContributorAuthor

@blueorangutan test centos7 vmware-65u2

@blueorangutan

Copy link
Copy Markdown

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

@blueorangutan

Copy link
Copy Markdown

Trillian test result (tid-1206)
Environment: vmware-65u2 (x2), Advanced Networking with Mgmt server 7
Total time taken: 35388 seconds
Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr5170-t1206-vmware-65u2.zip
Smoke tests completed. 88 look OK, 0 have error(s)
Only failed tests results shown below:

TestResultTime (s)Test File

@weizhouapacheweizhouapache left a comment

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.

code lgtm

(did not look through the code changes in debug messages).

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

clgtm

Sign up for freeto 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.

7 participants

@shwstppr@blueorangutan@weizhouapache@nvazquez@DaanHoogland@GutoVeronezi@yadvr