code refactoring and some changes

This commit is contained in:
Harikrishna Patnala 2023-03-28 08:07:15 +05:30
parent b7a7fd2692
commit 89dd4fd1d7
3 changed files with 6 additions and 6 deletions

View File

@ -32,13 +32,13 @@ import com.cloud.hypervisor.kvm.storage.KVMStoragePool;
import com.cloud.hypervisor.kvm.storage.KVMStoragePoolManager;
import com.cloud.resource.CommandWrapper;
import com.cloud.resource.ResourceWrapper;
import com.cloud.storage.Storage;
import java.io.File;
import java.util.List;
import java.util.Map;
import java.util.UUID;
import com.cloud.storage.Storage;
import org.apache.cloudstack.storage.datastore.client.ScaleIOGatewayClient;
import org.apache.cloudstack.storage.datastore.util.ScaleIOUtil;
import org.apache.cloudstack.storage.to.PrimaryDataStoreTO;
@ -66,7 +66,7 @@ public final class LibvirtMigrateVolumeCommandWrapper extends CommandWrapper<Mig
MigrateVolumeAnswer answer;
if (srcPrimaryDataStore.getPoolType().equals(Storage.StoragePoolType.PowerFlex)) {
answer = migrateVolumeInternal(command, libvirtComputingResource);
answer = migratePowerFlexVolume(command, libvirtComputingResource);
} else {
answer = migrateRegularVolume(command, libvirtComputingResource);
}
@ -74,7 +74,7 @@ public final class LibvirtMigrateVolumeCommandWrapper extends CommandWrapper<Mig
return answer;
}
private MigrateVolumeAnswer migrateVolumeInternal (final MigrateVolumeCommand command, final LibvirtComputingResource libvirtComputingResource) {
private MigrateVolumeAnswer migratePowerFlexVolume(final MigrateVolumeCommand command, final LibvirtComputingResource libvirtComputingResource) {
// Source Details
VolumeObjectTO srcVolumeObjectTO = (VolumeObjectTO)command.getSrcData();

View File

@ -762,7 +762,7 @@ public class ScaleIOPrimaryDataStoreDriver implements PrimaryDataStoreDriver {
}
private Answer copyVolume(DataObject srcData, DataObject destData, Host destHost) {
// Volume migration within same PowerFlex/ScaleIO cluster (with same System ID)
// Volume migration across different PowerFlex/ScaleIO clusters
final long srcVolumeId = srcData.getId();
DataStore srcStore = srcData.getDataStore();
Map<String, String> srcDetails = getVolumeDetails((VolumeInfo) srcData, srcStore);

View File

@ -3027,7 +3027,7 @@ public class VolumeApiServiceImpl extends ManagerBase implements VolumeApiServic
if (vm == null || !State.Running.equals(vm.getState())) {
StoragePoolVO sourceStoragePoolVO = _storagePoolDao.findById(vol.getPoolId());
if (sourceStoragePoolVO.getPoolType().equals(Storage.StoragePoolType.PowerFlex) && isScaleIOVolumeOnDifferentScaleIOStorageInstances(vol.getPoolId(), storagePoolId)) {
throw new InvalidParameterValueException("Volume needs to be attached to a VM to move across ScaleIO storages in different ScaleIO clusters");
throw new InvalidParameterValueException("Volume needs to be attached to a running VM to move across ScaleIO storages in different ScaleIO clusters");
}
}
@ -3182,7 +3182,7 @@ public class VolumeApiServiceImpl extends ManagerBase implements VolumeApiServic
throw new CloudRuntimeException("Failed to validate PowerFlex pools compatibility for migration as storage instance details are not available");
}
if (srcPoolSystemId.equals(destPoolSystemId)) {
if (!srcPoolSystemId.equals(destPoolSystemId)) {
return true;
}