rg9975 commented on code in PR #7889:
URL: https://github.com/apache/cloudstack/pull/7889#discussion_r1352851161
##########
engine/storage/datamotion/src/main/java/org/apache/cloudstack/storage/motion/StorageSystemDataMotionStrategy.java:
##########
@@ -826,44 +843,73 @@ private void handleFailedVolumeMigration(VolumeInfo
srcVolumeInfo, VolumeInfo de
_volumeDao.update(srcVolumeInfo.getId(), volumeVO);
}
- private void handleVolumeMigrationForKVM(VolumeInfo srcVolumeInfo,
VolumeInfo destVolumeInfo) {
+ private void handleVolumeMigrationForKVM(VolumeInfo srcVolumeInfo,
VolumeInfo destVolumeInfo, AsyncCompletionCallback<CopyCommandResult> callback)
{
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)) {
throw new CloudRuntimeException("Currently, if a volume to migrate
from non-managed storage to managed storage on KVM is attached to " +
"a VM, the VM must be in the Stopped state.");
}
-
destVolumeInfo.getDataStore().getDriver().createAsync(destVolumeInfo.getDataStore(),
destVolumeInfo, null);
-
- VolumeVO volumeVO = _volumeDao.findById(destVolumeInfo.getId());
-
- volumeVO.setPath(volumeVO.get_iScsiName());
+ String errMsg = null;
- _volumeDao.update(volumeVO.getId(), volumeVO);
+ try {
+
destVolumeInfo.getDataStore().getDriver().createAsync(destVolumeInfo.getDataStore(),
destVolumeInfo, null);
+ VolumeVO volumeVO = _volumeDao.findById(destVolumeInfo.getId());
- destVolumeInfo = _volumeDataFactory.getVolume(destVolumeInfo.getId(),
destVolumeInfo.getDataStore());
+ // only do this if the iscsiname is actually set. otherwise it
can nullify an already set path.
+ if (volumeVO.get_iScsiName() != null) {
+ volumeVO.setPath(volumeVO.get_iScsiName());
+ _volumeDao.update(volumeVO.getId(), volumeVO);
+ }
Review Comment:
handling in upcoming commit.
--
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]