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

sureshanaparti 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 d7b7bd53adf Fix infrastructure leak on exception while 
attaching/detaching volumes in VMware (#10860)
d7b7bd53adf is described below

commit d7b7bd53adf3e849ad364547dee41eeef5aa19b6
Author: Erik Böck <89930804+erikbo...@users.noreply.github.com>
AuthorDate: Mon Aug 4 11:05:54 2025 -0300

    Fix infrastructure leak on exception while attaching/detaching volumes in 
VMware (#10860)
    
    * Handled exception separately to prevent infrastructure data leak
---
 server/src/main/java/com/cloud/storage/VolumeApiServiceImpl.java | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/server/src/main/java/com/cloud/storage/VolumeApiServiceImpl.java 
b/server/src/main/java/com/cloud/storage/VolumeApiServiceImpl.java
index bbd95edbfdb..56b0ccd6723 100644
--- a/server/src/main/java/com/cloud/storage/VolumeApiServiceImpl.java
+++ b/server/src/main/java/com/cloud/storage/VolumeApiServiceImpl.java
@@ -149,6 +149,7 @@ import com.cloud.domain.dao.DomainDao;
 import com.cloud.event.ActionEvent;
 import com.cloud.event.EventTypes;
 import com.cloud.event.UsageEventUtils;
+import com.cloud.exception.AgentUnavailableException;
 import com.cloud.exception.ConcurrentOperationException;
 import com.cloud.exception.InvalidParameterValueException;
 import com.cloud.exception.PermissionDeniedException;
@@ -3206,6 +3207,8 @@ public class VolumeApiServiceImpl extends ManagerBase 
implements VolumeApiServic
 
             try {
                 answer = _agentMgr.send(hostId, cmd);
+            } catch (AgentUnavailableException e) {
+                  throw new CloudRuntimeException(String.format("%s. Please 
contact your system administrator.", errorMsg));
             } catch (Exception e) {
                 throw new CloudRuntimeException(errorMsg + " due to: " + 
e.getMessage());
             }
@@ -4769,6 +4772,11 @@ public class VolumeApiServiceImpl extends ManagerBase 
implements VolumeApiServic
 
                 try {
                     answer = (AttachAnswer)_agentMgr.send(hostId, cmd);
+                } catch (AgentUnavailableException e) {
+                    if (host != null) {
+                        
volService.revokeAccess(volFactory.getVolume(volumeToAttach.getId()), host, 
dataStore);
+                    }
+                    throw new CloudRuntimeException(String.format("%s. Please 
contact your system administrator.", errorMsg));
                 } catch (Exception e) {
                     if (host != null) {
                         
volService.revokeAccess(volFactory.getVolume(volumeToAttach.getId()), host, 
dataStore);

Reply via email to