Skip to content

Commit c183fc9

Browse files
authored
Prevent data corruption for StorPool volumes (#10799)
1 parent 13ab8a0 commit c183fc9

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

engine/orchestration/src/main/java/com/cloud/vm/VirtualMachineManagerImpl.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,11 @@
6161
import org.apache.cloudstack.context.CallContext;
6262
import org.apache.cloudstack.engine.orchestration.service.NetworkOrchestrationService;
6363
import org.apache.cloudstack.engine.orchestration.service.VolumeOrchestrationService;
64+
import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreDriver;
6465
import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreManager;
66+
import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreProvider;
67+
import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreProviderManager;
68+
import org.apache.cloudstack.engine.subsystem.api.storage.PrimaryDataStoreDriver;
6569
import org.apache.cloudstack.engine.subsystem.api.storage.StoragePoolAllocator;
6670
import org.apache.cloudstack.framework.ca.Certificate;
6771
import org.apache.cloudstack.framework.config.ConfigKey;
@@ -385,6 +389,8 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac
385389
private DomainRouterJoinDao domainRouterJoinDao;
386390
@Inject
387391
private AnnotationDao annotationDao;
392+
@Inject
393+
DataStoreProviderManager dataStoreProviderManager;
388394

389395
VmWorkJobHandlerProxy _jobHandlerProxy = new VmWorkJobHandlerProxy(this);
390396

@@ -1204,6 +1210,11 @@ public void orchestrateStart(final String vmUuid, final Map<VirtualMachineProfil
12041210
planChangedByVolume = true;
12051211
}
12061212
}
1213+
DataStoreProvider storeProvider = dataStoreProviderManager.getDataStoreProvider(pool.getStorageProviderName());
1214+
DataStoreDriver storeDriver = storeProvider.getDataStoreDriver();
1215+
if (storeDriver instanceof PrimaryDataStoreDriver) {
1216+
((PrimaryDataStoreDriver)storeDriver).detachVolumeFromAllStorageNodes(vol);
1217+
}
12071218
}
12081219
}
12091220

0 commit comments

Comments
 (0)