diff --git a/api/src/com/cloud/api/commands/UploadVolumeCmd.java b/api/src/com/cloud/api/commands/UploadVolumeCmd.java index 6bebac726aa..7a2aeb33e09 100755 --- a/api/src/com/cloud/api/commands/UploadVolumeCmd.java +++ b/api/src/com/cloud/api/commands/UploadVolumeCmd.java @@ -1,16 +1,14 @@ package com.cloud.api.commands; -import java.util.List; import org.apache.log4j.Logger; import com.cloud.api.ApiConstants; -import com.cloud.api.BaseAsyncCreateCmd; +import com.cloud.api.BaseAsyncCmd; import com.cloud.api.BaseCmd; import com.cloud.api.IdentityMapper; import com.cloud.api.Implementation; import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; -import com.cloud.api.response.ListResponse; import com.cloud.api.response.VolumeResponse; import com.cloud.event.EventTypes; import com.cloud.exception.ConcurrentOperationException; @@ -22,7 +20,7 @@ import com.cloud.storage.Volume; import com.cloud.user.UserContext; @Implementation(description="Uploads a data disk.", responseObject=VolumeResponse.class) -public class UploadVolumeCmd extends BaseCmd { +public class UploadVolumeCmd extends BaseAsyncCmd { public static final Logger s_logger = Logger.getLogger(UploadVolumeCmd.class.getName()); private static final String s_name = "uploadvolumeresponse"; @@ -120,4 +118,14 @@ public class UploadVolumeCmd extends BaseCmd { return accountId; } + @Override + public String getEventDescription() { + return "uploading volume: " + getVolumeName() + " in the zone " + getZoneId(); + } + + @Override + public String getEventType() { + return EventTypes.EVENT_VOLUME_UPLOAD; + } + } diff --git a/server/src/com/cloud/storage/StorageManagerImpl.java b/server/src/com/cloud/storage/StorageManagerImpl.java index 74ccd6f01af..f8ad65cc9b4 100755 --- a/server/src/com/cloud/storage/StorageManagerImpl.java +++ b/server/src/com/cloud/storage/StorageManagerImpl.java @@ -1686,13 +1686,12 @@ public class StorageManagerImpl implements StorageManager, Manager, ClusterManag /* - * Just allocate a volume in the database, don't send the createvolume cmd to hypervisor. The volume will be finally - * created + * Upload the volume to secondary storage. * */ @Override @DB - @ActionEvent(eventType = EventTypes.EVENT_VOLUME_UPLOAD, eventDescription = "creating volume", create = true) + @ActionEvent(eventType = EventTypes.EVENT_VOLUME_UPLOAD, eventDescription = "uploading volume", async = true) public VolumeVO uploadVolume(UploadVolumeCmd cmd) throws ResourceAllocationException{ Account caller = UserContext.current().getCaller(); long ownerId = cmd.getEntityOwnerId(); @@ -1704,8 +1703,7 @@ public class StorageManagerImpl implements StorageManager, Manager, ClusterManag validateVolume(caller, ownerId, zoneId, volumeName, url, format); VolumeVO volume = persistVolume(caller, ownerId, zoneId, volumeName, url, cmd.getFormat()); _downloadMonitor.downloadVolumeToStorage(volume, zoneId, url, cmd.getChecksum(), ImageFormat.valueOf(format.toUpperCase())); - return volume; - + return volume; } private boolean validateVolume(Account caller, long ownerId, Long zoneId, String volumeName, String url, String format) throws ResourceAllocationException{