Skip to content
Merged
Show file tree
Hide file tree
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 @@ -17,6 +17,7 @@

package org.apache.cloudstack.api.command.user.vmsnapshot;

import com.cloud.utils.exception.CloudRuntimeException;
import org.apache.cloudstack.acl.SecurityChecker.AccessType;
import org.apache.cloudstack.api.ACL;
import org.apache.cloudstack.api.APICommand;
Expand Down Expand Up @@ -90,7 +91,13 @@ public Long getVmId() {

@Override
public void create() throws ResourceAllocationException {
VMSnapshot vmsnapshot = _vmSnapshotService.allocVMSnapshot(getVmId(), getDisplayName(), getDescription(), snapshotMemory());
VMSnapshot vmsnapshot;
try {
vmsnapshot = _vmSnapshotService.allocVMSnapshot(getVmId(), getDisplayName(), getDescription(), snapshotMemory());
} catch (CloudRuntimeException e) {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create vm snapshot: " + e.getMessage(), e);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create vm snapshot: " + e.getMessage(), e);
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create VM snapshot: " + e.getMessage(), e);

}

if (vmsnapshot != null) {
setEntityId(vmsnapshot.getId());
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,9 @@ public VMSnapshot allocVMSnapshot(Long vmId, String vsDisplayName, String vsDesc
VMSnapshotStrategy snapshotStrategy = storageStrategyFactory.getVmSnapshotStrategy(userVmVo.getId(), rootVolumePool.getId(), snapshotMemory);

if (snapshotStrategy == null) {
throw new CloudRuntimeException("Could not find snapshot strategy for VM snapshot");
String message = "KVM does not support the type of snapshot requested";
s_logger.debug(message);
throw new CloudRuntimeException(message);
}
}

Expand Down