shwstppr commented on a change in pull request #4644:
URL: https://github.com/apache/cloudstack/pull/4644#discussion_r631835831



##########
File path: 
plugins/storage/volume/default/src/main/java/org/apache/cloudstack/storage/datastore/driver/CloudStackPrimaryDataStoreDriverImpl.java
##########
@@ -211,10 +213,22 @@ public void createAsync(DataStore dataStore, DataObject 
data, AsyncCompletionCal
         }
     }
 
+    private boolean commandCanBypassHostMaintenance(DataObject data) {
+        if (DataObjectType.VOLUME.equals(data.getType())) {
+            Volume volume = (Volume)data;
+            if (volume.getInstanceId() != null) {
+                VMInstanceVO vm = vmDao.findById(volume.getInstanceId());
+                return vm != null && 
(VirtualMachine.Type.SecondaryStorageVm.equals(vm.getType()) ||
+                        VirtualMachine.Type.ConsoleProxy.equals(vm.getType()));
+            }
+        }
+        return false;
+    }
+

Review comment:
       @sureshanaparti other drivers don't seem to be using `DeleteCommand`.
   ```
   ~/lab/shapeblue/cloudstack|fix-uncleared-sys-vms-3719⚡ 
   ⇒  grep "new DeleteCommand" -R .
   
./engine/storage/image/src/main/java/org/apache/cloudstack/storage/image/TemplateServiceImpl.java:
                            DeleteCommand dtCommand = new DeleteCommand(tmplTO);
   
./engine/storage/volume/src/main/java/org/apache/cloudstack/storage/volume/VolumeServiceImpl.java:
                        DeleteCommand dtCommand = new DeleteCommand(tmplTO);
   
./engine/storage/src/main/java/org/apache/cloudstack/storage/image/BaseImageStoreDriverImpl.java:
            DeleteCommand cmd = new DeleteCommand(data.getTO());
   ./server/src/main/java/com/cloud/vm/UserVmManagerImpl.java:                  
  cmd = new DeleteCommand(volumeInfo.getTO());
   
./plugins/storage/volume/default/src/main/java/org/apache/cloudstack/storage/datastore/driver/CloudStackPrimaryDataStoreDriverImpl.java:
        DeleteCommand cmd = new DeleteCommand(data.getTO());
   
./plugins/storage/volume/sample/src/main/java/org/apache/cloudstack/storage/datastore/driver/SamplePrimaryDataStoreDriverImpl.java:
         * DeleteCommand cmd = new DeleteCommand(vo.getUri());
   
./plugins/hypervisors/vmware/src/main/java/com/cloud/storage/resource/VmwareStorageSubsystemCommandHandler.java:
                        DeleteCommand deleteCommand = new 
DeleteCommand(template);
   
./plugins/hypervisors/vmware/src/main/java/com/cloud/storage/resource/VmwareStorageSubsystemCommandHandler.java:
                    DeleteCommand deleteCommand = new 
DeleteCommand(newSnapshot);
   
./plugins/hypervisors/vmware/src/main/java/com/cloud/hypervisor/guru/VMwareGuru.java:
                    DeleteCommand cmd = new DeleteCommand(volumeInfo.getTO());
   
./plugins/hypervisors/ovm3/src/test/java/com/cloud/hypervisor/ovm3/resources/Ovm3StorageProcessorTest.java:
        DeleteCommand delete = new DeleteCommand(vol);
   
./plugins/hypervisors/ovm3/src/test/java/com/cloud/hypervisor/ovm3/resources/Ovm3StorageProcessorTest.java:
        delete = new DeleteCommand(template);
   
./plugins/hypervisors/ovm3/src/test/java/com/cloud/hypervisor/ovm3/resources/Ovm3StorageProcessorTest.java:
        delete = new DeleteCommand(snap);
   
./services/secondary-storage/server/src/main/java/org/apache/cloudstack/storage/resource/NfsSecondaryStorageResource.java:
            DeleteCommand deleteCommand = new DeleteCommand(newTemplate)
   ```
   PS: SamplePrimaryDataStoreDriverImpl code is commented




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to