cloudstack icon indicating copy to clipboard operation
cloudstack copied to clipboard

Unable to live migrate VMware VMs with snapshot

Open cdfgallo opened this issue 9 months ago • 13 comments

ISSUE TYPE
  • Bug Report
COMPONENT NAME
Core
CLOUDSTACK VERSION
4.19.0.1
CONFIGURATION
OS / ENVIRONMENT

vSphere 7.0

SUMMARY

If I try to live migrate a VM with storage and the VM has a snapshot, the live migration does not start with the following error:

DEBUG [o.a.c.f.j.i.AsyncJobManagerImpl] (API-Job-Executor-47:ctx-e8daf7c5 job-50058) (logid:28b2b6fb) Complete async job-5 0058, jobStatus: FAILED, resultCode: 431, result: org.apache.cloudstack.api.response.ExceptionResponse/null/{"uuidList":[],"errorcode":"431","erro rtext":"VM with VM Snapshots cannot be migrated with storage, please remove all VM snapshots"}

STEPS TO REPRODUCE
In a VMware cluster, try to live migrate with storage a VM with at lease an active snapshot
EXPECTED RESULTS
The VM is correctly migrated

Live storage migration with VM with snapshot is supported in vSphere from version 5.0 so I guess it should be possible to perform the operation --> https://knowledge.broadcom.com/external/article?legacyId=1035550

ACTUAL RESULTS
You receive an error before the migration start.

cdfgallo avatar May 08 '24 14:05 cdfgallo

This is not a bug @cdfgallo, but a design limitation. The same way, you can not attach/detach volumes/NICs etc (please read the docs about different limitations on the allowed operations on VMs that have VM snapshots)

andrijapanicsb avatar May 10 '24 11:05 andrijapanicsb

@andrijapanicsb ok, got it. But why this implementation if I may ask? In case what work-around do you use to migrate VMs without touching the snapshot?

cdfgallo avatar May 14 '24 14:05 cdfgallo

@cdfgallo I can't advise from the top of my head, probably a technical limitation, due to consistency issues etc. However, the way around is to remove all VM snapshots, do your actions, and then create VM snapshots again. (is this KVM or VMware?)

andrijapanicsb avatar May 15 '24 13:05 andrijapanicsb

I tried this out, seems like merely removing the check at https://github.com/apache/cloudstack/blob/19f96355ac0b8bb1051c4e8fa2672b6e2f090703/server/src/main/java/com/cloud/vm/UserVmManagerImpl.java#L7211-L7213 most likely solves the issue. From Vmware end, it is possible to live migrate a VM with storage even if it has a VM snapshot.

Pearl1594 avatar Jun 04 '24 21:06 Pearl1594

sounds good @Pearl1594 , any idea about the other hypervisors?

DaanHoogland avatar Jun 05 '24 07:06 DaanHoogland

I haven't tested on other hypervisors - I'll do that and keep you'll posted.

Pearl1594 avatar Jun 05 '24 14:06 Pearl1594

I haven't tested on other hypervisors - I'll do that and keep you'll posted.

great, thanks @Pearl1594

so sh-/could we move this into milestone 4.20?

DaanHoogland avatar Jun 06 '24 07:06 DaanHoogland

@Pearl1594 would it be worth checking if snapshot actions from CloudStack work if the VM is migrated (after removing the check you shared)?

shwstppr avatar Jun 14 '24 08:06 shwstppr

@Pearl1594 thanks for checking this. @shwstppr I think it should work fine. I've deployed an env, took a snapshot of a VM, then migrated it with storage directly in vCenter, and ACS could still manage fine the snapshots.

alexandremattioli avatar Jun 14 '24 14:06 alexandremattioli

@DaanHoogland I'd say yes, 4.20.

alexandremattioli avatar Jun 14 '24 14:06 alexandremattioli

@shwstppr I had tested that - yes reverting to another snapshot worked I believe

Pearl1594 avatar Jun 14 '24 14:06 Pearl1594

@shwstppr I had tested that - yes reverting to another snapshot worked I believe

so we can remove the restriction for vmware ?

weizhouapache avatar Jun 14 '24 14:06 weizhouapache

@shwstppr I'd say yes, according to mine and @Pearl1594 's tests.

cc @cdfgallo

alexandremattioli avatar Jun 25 '24 21:06 alexandremattioli