Skip to content

Commit a6f1767

Browse files
committed
CLOUDSTACK-6175:s3.singleupload.max.size option not applicable for
backup snapshot on KVM.
1 parent f52b98b commit a6f1767

1 file changed

Lines changed: 11 additions & 2 deletions

File tree

plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/storage/KVMStorageProcessor.java

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
*/
1919
package com.cloud.hypervisor.kvm.storage;
2020

21+
import static com.cloud.utils.S3Utils.mputFile;
2122
import static com.cloud.utils.S3Utils.putFile;
2223

2324
import java.io.BufferedOutputStream;
@@ -547,11 +548,16 @@ public Answer createTemplateFromSnapshot(CopyCommand cmd) {
547548
return null; //To change body of implemented methods use File | Settings | File Templates.
548549
}
549550

550-
protected String copyToS3(File srcFile, S3TO destStore, String destPath) {
551+
protected String copyToS3(File srcFile, S3TO destStore, String destPath) throws InterruptedException {
551552
final String bucket = destStore.getBucketName();
552553

554+
long srcSize = srcFile.length();
553555
String key = destPath + S3Utils.SEPARATOR + srcFile.getName();
554-
putFile(destStore, srcFile, bucket, key);
556+
if (!destStore.getSingleUpload(srcSize)) {
557+
mputFile(destStore, srcFile, bucket, key);
558+
} else {
559+
putFile(destStore, srcFile, bucket, key);
560+
}
555561
return key;
556562
}
557563

@@ -584,6 +590,9 @@ protected Answer copyToObjectStore(CopyCommand cmd) {
584590
SnapshotObjectTO newSnapshot = new SnapshotObjectTO();
585591
newSnapshot.setPath(destPath);
586592
return new CopyCmdAnswer(newSnapshot);
593+
} catch (Exception e) {
594+
s_logger.error("failed to upload" + srcPath, e);
595+
return new CopyCmdAnswer("failed to upload" + srcPath + e.toString());
587596
} finally {
588597
try {
589598
if (srcFile != null) {

0 commit comments

Comments
 (0)