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

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


The following commit(s) were added to refs/heads/main by this push:
     new 8785f781b69 Ignore calls to PowerFlex for host revocation when host is 
null (#6742)
8785f781b69 is described below

commit 8785f781b692d6561cef760a5658bb0985446148
Author: Marcus Sorensen <[email protected]>
AuthorDate: Fri Oct 7 19:49:19 2022 -0600

    Ignore calls to PowerFlex for host revocation when host is null (#6742)
    
    This PR Fixes #6739 (for PowerFlex/ScaleIO only, Datera still needs to be 
addressed), which can occur if the last host the VM ran on is deleted from 
CloudStack. At the point the VM is deleted, cloudstack attempts to make a final 
call to revoke access to volumes, passing the last host the VM ran on. If this 
host is gone, we get an error and are unable to delete the VM.
    
    It's possible that there may be a more holistic fix to this by identifying 
all of the places where revokeAccess() is called and checking for null host. 
It's possible other storage plugins don't even need host information to revoke 
access to volumes and may need this call to revoke. Therefore I'm only applying 
this fix to the ScaleIOPrimaryDataStoreDriver to skip revoking access when 
there is no host to revoke access for, and this should protect us as well when 
a new part of the code t [...]
    
    Signed-off-by: Marcus Sorensen <[email protected]>
    Co-authored-by: Marcus Sorensen <[email protected]>
---
 .../storage/datastore/driver/ScaleIOPrimaryDataStoreDriver.java      | 5 +++++
 1 file changed, 5 insertions(+)

diff --git 
a/plugins/storage/volume/scaleio/src/main/java/org/apache/cloudstack/storage/datastore/driver/ScaleIOPrimaryDataStoreDriver.java
 
b/plugins/storage/volume/scaleio/src/main/java/org/apache/cloudstack/storage/datastore/driver/ScaleIOPrimaryDataStoreDriver.java
index e647485d9bc..f15fb1c296e 100644
--- 
a/plugins/storage/volume/scaleio/src/main/java/org/apache/cloudstack/storage/datastore/driver/ScaleIOPrimaryDataStoreDriver.java
+++ 
b/plugins/storage/volume/scaleio/src/main/java/org/apache/cloudstack/storage/datastore/driver/ScaleIOPrimaryDataStoreDriver.java
@@ -208,6 +208,11 @@ public class ScaleIOPrimaryDataStoreDriver implements 
PrimaryDataStoreDriver {
 
     @Override
     public void revokeAccess(DataObject dataObject, Host host, DataStore 
dataStore) {
+        if (host == null) {
+            LOGGER.info("Declining to revoke access to PowerFlex volume when a 
host is not provided");
+            return;
+        }
+
         try {
             if (DataObjectType.VOLUME.equals(dataObject.getType())) {
                 final VolumeVO volume = volumeDao.findById(dataObject.getId());

Reply via email to