Skip to content

Commit 6ef2eac

Browse files
committed
Merge tag '4.18.2.5' into 4.18
2 parents 896b8bf + 84538da commit 6ef2eac

File tree

2 files changed

+23
-5
lines changed

2 files changed

+23
-5
lines changed

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

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
import java.io.FileOutputStream;
2727
import java.io.IOException;
2828
import java.nio.file.Files;
29+
import java.nio.file.Path;
2930
import java.nio.file.Paths;
3031
import java.text.DateFormat;
3132
import java.text.SimpleDateFormat;
@@ -63,6 +64,7 @@
6364
import org.apache.cloudstack.storage.command.SnapshotAndCopyAnswer;
6465
import org.apache.cloudstack.storage.command.SnapshotAndCopyCommand;
6566
import org.apache.cloudstack.storage.command.SyncVolumePathCommand;
67+
import org.apache.cloudstack.storage.formatinspector.Qcow2Inspector;
6668
import org.apache.cloudstack.storage.to.PrimaryDataStoreTO;
6769
import org.apache.cloudstack.storage.to.SnapshotObjectTO;
6870
import org.apache.cloudstack.storage.to.TemplateObjectTO;
@@ -2394,6 +2396,22 @@ public Answer handleDownloadTemplateToPrimaryStorage(DirectDownloadCommand cmd)
23942396

23952397
template = storagePoolMgr.createPhysicalDiskFromDirectDownloadTemplate(tempFilePath, destTemplatePath, destPool, cmd.getFormat(), cmd.getWaitInMillSeconds());
23962398

2399+
String templatePath = template.getPath();
2400+
if (templatePath != null) {
2401+
try {
2402+
Qcow2Inspector.validateQcow2File(templatePath);
2403+
} catch (RuntimeException e) {
2404+
try {
2405+
Files.deleteIfExists(Path.of(templatePath));
2406+
} catch (IOException ioException) {
2407+
s_logger.warn(String.format("Unable to remove file [%s]; consider removing it manually.", templatePath), ioException);
2408+
}
2409+
2410+
s_logger.error(String.format("The downloaded file [%s] is not a valid QCOW2.", templatePath), e);
2411+
return new DirectDownloadAnswer(false, "The downloaded file is not a valid QCOW2. Ask the administrator to check the logs for more details.", true);
2412+
}
2413+
}
2414+
23972415
if (!storagePoolMgr.disconnectPhysicalDisk(pool.getPoolType(), pool.getUuid(), destTemplatePath)) {
23982416
s_logger.warn("Unable to disconnect physical disk at path: " + destTemplatePath + ", in storage pool id: " + pool.getUuid());
23992417
}

tools/build/build_asf.sh

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,8 @@ echo "Using version: $version"
6464
echo "Using source directory: $sourcedir"
6565
echo "Using output directory: $outputdir"
6666
echo "Using branch: $branch"
67-
if [ "$tag" == "yes" ]; then
68-
if [ "$certid" == "X" ]; then
67+
if [ "$tag" = "yes" ]; then
68+
if [ "$certid" = "X" ]; then
6969
echo "Tagging the branch with the version number, and signing the branch with your default certificate."
7070
else
7171
echo "Tagging the branch with the version number, and signing the branch with certificate ID $certid."
@@ -143,7 +143,7 @@ bzip2 $outputdir/apache-cloudstack-$version-src.tar
143143

144144
cd $outputdir
145145
echo 'armor'
146-
if [ "$certid" == "X" ]; then
146+
if [ "$certid" = "X" ]; then
147147
gpg -v --armor --output apache-cloudstack-$version-src.tar.bz2.asc --detach-sig apache-cloudstack-$version-src.tar.bz2
148148
else
149149
gpg -v --default-key $certid --armor --output apache-cloudstack-$version-src.tar.bz2.asc --detach-sig apache-cloudstack-$version-src.tar.bz2
@@ -155,7 +155,7 @@ sha512sum apache-cloudstack-$version-src.tar.bz2 > apache-cloudstack-$version-sr
155155
echo 'verify'
156156
gpg -v --verify apache-cloudstack-$version-src.tar.bz2.asc apache-cloudstack-$version-src.tar.bz2
157157

158-
if [ "$tag" == "yes" ]; then
158+
if [ "$tag" = "yes" ]; then
159159
echo 'tag'
160160
cd $sourcedir
161161
if [ "$certid" == "X" ]; then
@@ -165,7 +165,7 @@ if [ "$tag" == "yes" ]; then
165165
fi
166166
fi
167167

168-
if [ "$committosvn" == "yes" ]; then
168+
if [ "$committosvn" = "yes" ]; then
169169
echo 'committing artifacts to svn'
170170
rm -Rf /tmp/cloudstack-dev-dist
171171
cd /tmp

0 commit comments

Comments
 (0)