From 4ed4f638a01d636ce72dfa14ce6324755677421e Mon Sep 17 00:00:00 2001 From: Slavka Peleva Date: Wed, 30 Apr 2025 18:31:30 +0300 Subject: [PATCH] Prevent data corruption for StorPool volumes Prevents data corruption in cases where a VM is started on a new host while it is already running on another host Scenario - if the host is down and the admin stops a VM with the option `force=true` the admin will be able to start it on another host. This may lead to a data corruption when the first host goes Up and the volume is attached on both hosts. --- .../java/com/cloud/vm/VirtualMachineManagerImpl.java | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/engine/orchestration/src/main/java/com/cloud/vm/VirtualMachineManagerImpl.java b/engine/orchestration/src/main/java/com/cloud/vm/VirtualMachineManagerImpl.java index f2e90decdea8..41fd631d88fd 100755 --- a/engine/orchestration/src/main/java/com/cloud/vm/VirtualMachineManagerImpl.java +++ b/engine/orchestration/src/main/java/com/cloud/vm/VirtualMachineManagerImpl.java @@ -61,7 +61,11 @@ import org.apache.cloudstack.context.CallContext; import org.apache.cloudstack.engine.orchestration.service.NetworkOrchestrationService; import org.apache.cloudstack.engine.orchestration.service.VolumeOrchestrationService; +import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreDriver; import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreManager; +import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreProvider; +import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreProviderManager; +import org.apache.cloudstack.engine.subsystem.api.storage.PrimaryDataStoreDriver; import org.apache.cloudstack.engine.subsystem.api.storage.StoragePoolAllocator; import org.apache.cloudstack.framework.ca.Certificate; import org.apache.cloudstack.framework.config.ConfigKey; @@ -385,6 +389,8 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac private DomainRouterJoinDao domainRouterJoinDao; @Inject private AnnotationDao annotationDao; + @Inject + DataStoreProviderManager dataStoreProviderManager; VmWorkJobHandlerProxy _jobHandlerProxy = new VmWorkJobHandlerProxy(this); @@ -1204,6 +1210,11 @@ public void orchestrateStart(final String vmUuid, final Map