Skip to content

Fix infrastructure leak on exception while attaching/detaching volumes in VMware #10860

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@

import javax.inject.Inject;

import com.cloud.exception.AgentUnavailableException;
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.ApiErrorCode;
import org.apache.cloudstack.api.InternalIdentity;
Expand Down Expand Up @@ -3165,6 +3166,8 @@

try {
answer = _agentMgr.send(hostId, cmd);
} catch (AgentUnavailableException e) {
throw new CloudRuntimeException(String.format("%s. Please contact your system administrator.", errorMsg));

Check warning on line 3170 in server/src/main/java/com/cloud/storage/VolumeApiServiceImpl.java

View check run for this annotation

Codecov / codecov/patch

server/src/main/java/com/cloud/storage/VolumeApiServiceImpl.java#L3169-L3170

Added lines #L3169 - L3170 were not covered by tests
} catch (Exception e) {
throw new CloudRuntimeException(errorMsg + " due to: " + e.getMessage());
}
Expand Down Expand Up @@ -4657,6 +4660,11 @@

try {
answer = (AttachAnswer)_agentMgr.send(hostId, cmd);
} catch (AgentUnavailableException e) {
if (host != null) {
volService.revokeAccess(volFactory.getVolume(volumeToAttach.getId()), host, dataStore);
}

Check warning on line 4666 in server/src/main/java/com/cloud/storage/VolumeApiServiceImpl.java

View check run for this annotation

Codecov / codecov/patch

server/src/main/java/com/cloud/storage/VolumeApiServiceImpl.java#L4666

Added line #L4666 was not covered by tests
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);
Expand Down
Loading