This is an automated email from the ASF dual-hosted git repository.
rohit pushed a commit to branch 4.14
in repository https://gitbox.apache.org/repos/asf/cloudstack.git
The following commit(s) were added to refs/heads/4.14 by this push:
new 3b5f99a kvm: Prevent KVM from performing volume migrations of running
instances (#4562)
3b5f99a is described below
commit 3b5f99a7ca530d1a506b6a4237c03978cabdabab
Author: Daniel Augusto Veronezi Salvador
<[email protected]>
AuthorDate: Fri Feb 19 06:04:28 2021 -0300
kvm: Prevent KVM from performing volume migrations of running instances
(#4562)
* Prevent KVM from performing volume migrations of running instances
KVM has a limitation to modify instances definitions while they are on
running state. Therefore, it is not possible to change volumes backend location
easily.
There is a problem in the `migrateVolume` API. This API command ignores
that limitation and causes an inconsistence on the database. ACS processes the
migrate command, copies the volume to the destination storage, modifies the
database and finishes the process with success. However, the running backend is
still using the "old volume file".
This PR intends to prevent KVM to perform volumes migrations while KVM
instances are in the running state and inform the user of an alternative API
command that enables such operation on running instances.
* Update VolumeApiServiceImpl.java
Co-authored-by: Daniel Augusto Veronezi Salvador <[email protected]>
Co-authored-by: Rohit Yadav <[email protected]>
---
server/src/main/java/com/cloud/storage/VolumeApiServiceImpl.java | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/server/src/main/java/com/cloud/storage/VolumeApiServiceImpl.java
b/server/src/main/java/com/cloud/storage/VolumeApiServiceImpl.java
index 1d44230..35314e8 100644
--- a/server/src/main/java/com/cloud/storage/VolumeApiServiceImpl.java
+++ b/server/src/main/java/com/cloud/storage/VolumeApiServiceImpl.java
@@ -2173,6 +2173,12 @@ public class VolumeApiServiceImpl extends ManagerBase
implements VolumeApiServic
if (capabilities != null) {
liveMigrateVolume =
capabilities.isStorageMotionSupported();
}
+
+ if (liveMigrateVolume &&
HypervisorType.KVM.equals(host.getHypervisorType())) {
+ throw new InvalidParameterValueException("KVM does not
support volume live migration due to the limited possibility to refresh VM XML
domain. " +
+ "Therefore, to live migrate a volume between
storage pools, one must migrate the VM to a different host as well to force the
VM XML domain update. " +
+ "Use 'migrateVirtualMachineWithVolumes' instead.");
+ }
}
// If vm is running, and hypervisor doesn't support live
migration, then return error