Skip to content

Commit fab8879

Browse files
authored
Merge pull request #17 from poddm/mp/FLXCLD-2900
Revert "4.22 FC VOL LIVEMIGRATE (#1)"
2 parents 49e594d + 6c0858f commit fab8879

5 files changed

Lines changed: 4 additions & 292 deletions

File tree

engine/storage/datamotion/src/main/java/org/apache/cloudstack/storage/motion/StorageSystemDataMotionStrategy.java

Lines changed: 2 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -2566,10 +2566,7 @@ protected void verifyLiveMigrationForKVM(Map<VolumeInfo, DataStore> volumeDataSt
25662566
}
25672567

25682568
boolean isSrcAndDestPoolPowerFlexStorage = srcStoragePoolVO.getPoolType().equals(Storage.StoragePoolType.PowerFlex) && destStoragePoolVO.getPoolType().equals(Storage.StoragePoolType.PowerFlex);
2569-
boolean isSrcAndDestPoolFiberChannelStorage = srcStoragePoolVO.getPoolType().equals(Storage.StoragePoolType.FiberChannel) && destStoragePoolVO.getPoolType().equals(Storage.StoragePoolType.FiberChannel);
2570-
boolean fiberChannelVmOnline = isSrcAndDestPoolFiberChannelStorage && volumeInfo.getAttachedVM() != null && volumeInfo.getAttachedVM().getState() == VirtualMachine.State.Running;
2571-
2572-
if (srcStoragePoolVO.isManaged() && !isSrcAndDestPoolPowerFlexStorage && !fiberChannelVmOnline && srcStoragePoolVO.getId() != destStoragePoolVO.getId()) {
2569+
if (srcStoragePoolVO.isManaged() && !isSrcAndDestPoolPowerFlexStorage && srcStoragePoolVO.getId() != destStoragePoolVO.getId()) {
25732570
throw new CloudRuntimeException("Migrating a volume online with KVM from managed storage is not currently supported.");
25742571
}
25752572

@@ -2769,27 +2766,6 @@ private Map<String, String> getVolumeDetails(VolumeInfo volumeInfo) {
27692766
return volumeDetails;
27702767
}
27712768

2772-
private boolean shouldAttemptLiveFiberChannelMigration(VolumeInfo srcVolumeInfo, VolumeInfo destVolumeInfo) {
2773-
if (srcVolumeInfo == null || destVolumeInfo == null) {
2774-
return false;
2775-
}
2776-
2777-
StoragePoolVO srcPool = _storagePoolDao.findById(srcVolumeInfo.getPoolId());
2778-
StoragePoolVO destPool = _storagePoolDao.findById(destVolumeInfo.getPoolId());
2779-
2780-
if (srcPool == null || destPool == null) {
2781-
return false;
2782-
}
2783-
2784-
if (srcPool.getPoolType() != StoragePoolType.FiberChannel || destPool.getPoolType() != StoragePoolType.FiberChannel) {
2785-
return false;
2786-
}
2787-
2788-
VirtualMachine attachedVm = srcVolumeInfo.getAttachedVM();
2789-
2790-
return attachedVm != null && attachedVm.getState() == VirtualMachine.State.Running;
2791-
}
2792-
27932769
private Map<String, String> getSnapshotDetails(SnapshotInfo snapshotInfo) {
27942770
Map<String, String> snapshotDetails = new HashMap<>();
27952771

@@ -3045,11 +3021,8 @@ private String migrateVolumeForKVM(VolumeInfo srcVolumeInfo, VolumeInfo destVolu
30453021

30463022
_volumeService.grantAccess(srcVolumeInfo, hostVO, srcVolumeInfo.getDataStore());
30473023

3048-
boolean fiberChannelOnline = shouldAttemptLiveFiberChannelMigration(srcVolumeInfo, destVolumeInfo);
3049-
int waitTimeout = fiberChannelOnline ? StorageManager.KvmStorageOnlineMigrationWait.value() : StorageManager.KvmStorageOfflineMigrationWait.value();
3050-
30513024
MigrateVolumeCommand migrateVolumeCommand = new MigrateVolumeCommand(srcVolumeInfo.getTO(), destVolumeInfo.getTO(),
3052-
srcDetails, destDetails, waitTimeout);
3025+
srcDetails, destDetails, StorageManager.KvmStorageOfflineMigrationWait.value());
30533026

30543027
_volumeService.grantAccess(srcVolumeInfo, hostVO, srcVolumeInfo.getDataStore());
30553028
handleQualityOfServiceForVolumeMigration(destVolumeInfo, PrimaryDataStoreDriver.QualityOfServiceState.MIGRATION);

engine/storage/datamotion/src/test/java/org/apache/cloudstack/storage/motion/KvmNonManagedStorageSystemDataMotionTest.java

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -124,8 +124,6 @@ public class KvmNonManagedStorageSystemDataMotionTest {
124124
Host host1;
125125
@Mock
126126
Host host2;
127-
@Mock
128-
com.cloud.vm.VirtualMachine attachedVm;
129127

130128
Map<VolumeInfo, DataStore> migrationMap;
131129

@@ -480,23 +478,6 @@ public void testVerifyLiveMigrationMapForKVM() {
480478
kvmNonManagedStorageDataMotionStrategy.verifyLiveMigrationForKVM(migrationMap);
481479
}
482480

483-
@Test
484-
public void testVerifyLiveMigrationMapForKVMManagedFiberChannelAllowed() {
485-
lenient().when(pool1.isManaged()).thenReturn(true);
486-
lenient().when(pool2.isManaged()).thenReturn(true);
487-
lenient().when(pool1.getPoolType()).thenReturn(Storage.StoragePoolType.FiberChannel);
488-
lenient().when(pool2.getPoolType()).thenReturn(Storage.StoragePoolType.FiberChannel);
489-
lenient().when(pool1.getId()).thenReturn(POOL_1_ID);
490-
lenient().when(pool2.getId()).thenReturn(POOL_2_ID);
491-
lenient().when(volumeInfo1.getAttachedVM()).thenReturn(attachedVm);
492-
when(attachedVm.getState()).thenReturn(com.cloud.vm.VirtualMachine.State.Running);
493-
494-
Map<VolumeInfo, DataStore> fiberChannelMigrationMap = new HashMap<>();
495-
fiberChannelMigrationMap.put(volumeInfo1, dataStore2);
496-
497-
kvmNonManagedStorageDataMotionStrategy.verifyLiveMigrationForKVM(fiberChannelMigrationMap);
498-
}
499-
500481
@Test(expected = CloudRuntimeException.class)
501482
public void testVerifyLiveMigrationMapForKVMNotExistingSource() {
502483
when(primaryDataStoreDao.findById(POOL_1_ID)).thenReturn(null);

engine/storage/snapshot/src/test/java/org/apache/cloudstack/storage/vmsnapshot/VMSnapshotStrategyKVMTest.java

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@
6060
import org.springframework.test.context.ContextConfiguration;
6161
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
6262
import org.springframework.test.context.support.AnnotationConfigContextLoader;
63-
import org.springframework.test.util.ReflectionTestUtils;
6463

6564
import com.cloud.agent.AgentManager;
6665
import com.cloud.agent.api.DeleteVMSnapshotAnswer;
@@ -95,10 +94,6 @@
9594
import com.cloud.vm.snapshot.VMSnapshotVO;
9695
import com.cloud.vm.snapshot.dao.VMSnapshotDao;
9796
import com.cloud.vm.snapshot.dao.VMSnapshotDetailsDao;
98-
import com.cloud.event.dao.UsageEventDao;
99-
import com.cloud.event.UsageEventUtils;
100-
import com.cloud.user.dao.AccountDao;
101-
import com.cloud.dc.dao.DataCenterDao;
10297

10398
import junit.framework.TestCase;
10499

@@ -149,33 +144,10 @@ public class VMSnapshotStrategyKVMTest extends TestCase{
149144
@Inject
150145
VMSnapshotDetailsDao vmSnapshotDetailsDao;
151146

152-
private UsageEventDao usageEventDao;
153-
private AccountDao accountDao;
154-
private DataCenterDao dataCenterDao;
155-
156147
@Override
157148
@Before
158149
public void setUp() throws Exception {
159150
ComponentContext.initComponentsLifeCycle();
160-
initialiseUsageEventUtils();
161-
}
162-
163-
private void initialiseUsageEventUtils() {
164-
usageEventDao = Mockito.mock(UsageEventDao.class);
165-
accountDao = Mockito.mock(AccountDao.class);
166-
dataCenterDao = Mockito.mock(DataCenterDao.class);
167-
ConfigurationDao configDao = Mockito.mock(ConfigurationDao.class);
168-
169-
UsageEventUtils usageEventUtils = new UsageEventUtils();
170-
ReflectionTestUtils.setField(usageEventUtils, "usageEventDao", usageEventDao);
171-
ReflectionTestUtils.setField(usageEventUtils, "accountDao", accountDao);
172-
ReflectionTestUtils.setField(usageEventUtils, "dcDao", dataCenterDao);
173-
ReflectionTestUtils.setField(usageEventUtils, "configDao", configDao);
174-
ReflectionTestUtils.invokeMethod(usageEventUtils, "init");
175-
176-
Mockito.lenient().when(usageEventDao.persist(Mockito.any())).thenAnswer(invocation -> invocation.getArgument(0));
177-
Mockito.lenient().doNothing().when(usageEventDao).saveDetails(Mockito.anyLong(), Mockito.anyMap());
178-
Mockito.lenient().when(configDao.getValue("publish.usage.events")).thenReturn("false");
179151
}
180152

181153
@Test

plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/resource/LibvirtVMDef.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1132,10 +1132,6 @@ public void setSerial(String serial) {
11321132
this._serial = serial;
11331133
}
11341134

1135-
public String getSerial() {
1136-
return _serial;
1137-
}
1138-
11391135
public void setLibvirtDiskEncryptDetails(LibvirtDiskEncryptDetails details)
11401136
{
11411137
this.encryptDetails = details;

0 commit comments

Comments
 (0)