rg9975 commented on code in PR #7889:
URL: https://github.com/apache/cloudstack/pull/7889#discussion_r1374801199
##########
engine/storage/datamotion/src/main/java/org/apache/cloudstack/storage/motion/StorageSystemDataMotionStrategy.java:
##########
@@ -512,20 +515,30 @@ else if (volumePath == null) {
}
}
+ private void
handleVolumeMigrationFromManagedStorageToManagedStorage(VolumeInfo
srcVolumeInfo, VolumeInfo destVolumeInfo,
+
AsyncCompletionCallback<CopyCommandResult> callback) {
+ if (!HypervisorType.KVM.equals(srcVolumeInfo.getHypervisorType())) {
+ String errMsg = "Currently migrating volumes between managed
storage providers is only supported on KVM hypervisor";
+ handleError(errMsg, callback);
+ } else {
+ handleVolumeMigrationForKVM(srcVolumeInfo, destVolumeInfo,
callback);
+ }
+ }
+
private void
handleVolumeMigrationFromManagedStorageToNonManagedStorage(VolumeInfo
srcVolumeInfo, VolumeInfo destVolumeInfo,
AsyncCompletionCallback<CopyCommandResult> callback) {
String errMsg = null;
try {
- if (!ImageFormat.QCOW2.equals(srcVolumeInfo.getFormat())) {
+ if (!HypervisorType.KVM.equals(srcVolumeInfo.getHypervisorType()))
{
throw new CloudRuntimeException("Currently, only the KVM
hypervisor type is supported for the migration of a volume " +
"from managed storage to non-managed storage.");
}
HypervisorType hypervisorType = HypervisorType.KVM;
VirtualMachine vm = srcVolumeInfo.getAttachedVM();
- if (vm != null && vm.getState() != VirtualMachine.State.Stopped) {
+ if (vm != null && (vm.getState() != VirtualMachine.State.Stopped
&& vm.getState() != VirtualMachine.State.Migrating)) {
Review Comment:
Unsure if it should be checked higher level, but this was an existing check
(to see if the VM is stopped before allowing migration). The additional check
to validate Migrating status is because we found some failure/rainy-day cases
where a VM could be "stranded" in Migrating status due to an unexpected
mid-migration failure and there was no effective way to repeat and complete the
migration. Making this change allows an administrator to re-attempt the
migration and successfully complete it without falling back to manual changes
in the database.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]