GutoVeronezi commented on a change in pull request #4875:
URL: https://github.com/apache/cloudstack/pull/4875#discussion_r601768716
##########
File path:
plugins/storage/image/swift/src/main/java/org/apache/cloudstack/storage/datastore/driver/SwiftImageStoreDriverImpl.java
##########
@@ -100,12 +102,28 @@ public String createEntityExtractUrl(DataStore store,
String installPath, ImageF
@Override
public void createAsync(DataStore dataStore, DataObject data,
AsyncCompletionCallback<CreateCmdResult> callback) {
- Long maxTemplateSizeInBytes = getMaxTemplateSizeInBytes();
- VirtualMachineTemplate tmpl = _templateDao.findById(data.getId());
+
+ DownloadCommand downloadCommand = null;
+ if (data.getType() == DataObjectType.TEMPLATE) {
+ Long maxTemplateSizeInBytes = getMaxTemplateSizeInBytes();
+ downloadCommand = new DownloadCommand((TemplateObjectTO)
(data.getTO()), maxTemplateSizeInBytes);
+ }else if (data.getType() == DataObjectType.VOLUME){
+ Long maxDownloadSizeInBytes = getMaxVolumeSizeInBytes();
+ VolumeInfo volumeInfo = (VolumeInfo) data;
+ RegisterVolumePayload payload = (RegisterVolumePayload)
volumeInfo.getpayload();
+ ImageFormat format = ImageFormat.valueOf(payload.getFormat());
+ downloadCommand = new DownloadCommand((VolumeObjectTO)
(data.getTO()), maxDownloadSizeInBytes, payload.getChecksum(),
payload.getUrl(), format);
+ }
+
+ if (downloadCommand == null){
+ String errMsg = "Unable to build download command, DataObject is
of neither VOLUME or TEMPLATE type";
Review comment:
Suggestion:
Improve logging by adding DataObject data in the message.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]