This is an automated email from the ASF dual-hosted git repository.

rohit pushed a commit to branch 4.18
in repository https://gitbox.apache.org/repos/asf/cloudstack.git


The following commit(s) were added to refs/heads/4.18 by this push:
     new 8350ce5aa40 storage: allow VM snapshots without memory for KVM when 
global setting allows (#8062)
8350ce5aa40 is described below

commit 8350ce5aa40241d683749c1257813fa649e998be
Author: Rohit Yadav <[email protected]>
AuthorDate: Wed Oct 11 20:56:45 2023 +0530

    storage: allow VM snapshots without memory for KVM when global setting 
allows (#8062)
    
    This removes the conditional logic where comment notest to remove it
    after PR #5297 is merged that is applicable for ACS 4.18+. Only when the
    global setting is enabled and memory isn't selected, VM snapshot could
    be allowed for VMs on KVM that have qemu-guest-agent running.
    
    Signed-off-by: Rohit Yadav <[email protected]>
---
 .../storage/vmsnapshot/StorageVMSnapshotStrategy.java  | 18 ------------------
 1 file changed, 18 deletions(-)

diff --git 
a/engine/storage/snapshot/src/main/java/org/apache/cloudstack/storage/vmsnapshot/StorageVMSnapshotStrategy.java
 
b/engine/storage/snapshot/src/main/java/org/apache/cloudstack/storage/vmsnapshot/StorageVMSnapshotStrategy.java
index 958290085fc..b6549740a4a 100644
--- 
a/engine/storage/snapshot/src/main/java/org/apache/cloudstack/storage/vmsnapshot/StorageVMSnapshotStrategy.java
+++ 
b/engine/storage/snapshot/src/main/java/org/apache/cloudstack/storage/vmsnapshot/StorageVMSnapshotStrategy.java
@@ -59,7 +59,6 @@ import com.cloud.storage.DataStoreRole;
 import com.cloud.storage.GuestOSVO;
 import com.cloud.storage.Snapshot;
 import com.cloud.storage.SnapshotVO;
-import com.cloud.storage.Storage;
 import com.cloud.storage.VolumeApiService;
 import com.cloud.storage.VolumeVO;
 import com.cloud.storage.dao.SnapshotDao;
@@ -360,10 +359,6 @@ public class StorageVMSnapshotStrategy extends 
DefaultVMSnapshotStrategy {
 
     @Override
     public StrategyPriority canHandle(Long vmId, Long rootPoolId, boolean 
snapshotMemory) {
-        //This check could be removed when PR #5297 is merged
-        if (vmHasNFSOrLocalVolumes(vmId)) {
-            return StrategyPriority.CANT_HANDLE;
-        }
         if (SnapshotManager.VmStorageSnapshotKvm.value() && !snapshotMemory) {
             UserVmVO vm = userVmDao.findById(vmId);
             if (vm.getState() == VirtualMachine.State.Running) {
@@ -465,17 +460,4 @@ public class StorageVMSnapshotStrategy extends 
DefaultVMSnapshotStrategy {
         payload.setQuiescevm(false);
         return payload;
     }
-
-    private boolean vmHasNFSOrLocalVolumes(long vmId) {
-        List<VolumeObjectTO> volumeTOs = 
vmSnapshotHelper.getVolumeTOList(vmId);
-
-        for (VolumeObjectTO volumeTO : volumeTOs) {
-            Long poolId = volumeTO.getPoolId();
-            Storage.StoragePoolType poolType = 
vmSnapshotHelper.getStoragePoolType(poolId);
-            if (poolType == Storage.StoragePoolType.NetworkFilesystem || 
poolType == Storage.StoragePoolType.Filesystem) {
-                return true;
-            }
-        }
-        return false;
-    }
 }

Reply via email to