mirror of
https://github.com/apache/cloudstack.git
synced 2025-11-03 04:12:31 +01:00
server: set download volume format to qcow2 for KVM volumes (#11198)
This commit is contained in:
parent
36cfd76ce1
commit
318a4f2b6e
@ -587,7 +587,7 @@ public class KVMStorageProcessor implements StorageProcessor {
|
|||||||
try {
|
try {
|
||||||
final String volumeName = UUID.randomUUID().toString();
|
final String volumeName = UUID.randomUUID().toString();
|
||||||
|
|
||||||
final String destVolumeName = volumeName + "." + destFormat.getFileExtension();
|
final String destVolumeName = volumeName + "." + ImageFormat.QCOW2.getFileExtension();
|
||||||
final KVMPhysicalDisk volume = storagePoolMgr.getPhysicalDisk(primaryStore.getPoolType(), primaryStore.getUuid(), srcVolumePath);
|
final KVMPhysicalDisk volume = storagePoolMgr.getPhysicalDisk(primaryStore.getPoolType(), primaryStore.getUuid(), srcVolumePath);
|
||||||
volume.setFormat(PhysicalDiskFormat.valueOf(srcFormat.toString()));
|
volume.setFormat(PhysicalDiskFormat.valueOf(srcFormat.toString()));
|
||||||
|
|
||||||
|
|||||||
@ -23,7 +23,9 @@ import java.util.UUID;
|
|||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
|
|
||||||
import com.cloud.agent.api.storage.DeleteEntityDownloadURLCommand;
|
import com.cloud.agent.api.storage.DeleteEntityDownloadURLCommand;
|
||||||
|
import com.cloud.agent.api.to.DataObjectType;
|
||||||
import com.cloud.host.dao.HostDao;
|
import com.cloud.host.dao.HostDao;
|
||||||
|
import com.cloud.hypervisor.Hypervisor.HypervisorType;
|
||||||
import com.cloud.storage.Upload;
|
import com.cloud.storage.Upload;
|
||||||
import com.cloud.utils.StringUtils;
|
import com.cloud.utils.StringUtils;
|
||||||
|
|
||||||
@ -72,7 +74,14 @@ public class CloudStackImageStoreDriverImpl extends NfsImageStoreDriverImpl {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (format != null) {
|
if (format != null) {
|
||||||
|
if (dataObject.getTO() != null
|
||||||
|
&& DataObjectType.VOLUME.equals(dataObject.getTO().getObjectType())
|
||||||
|
&& HypervisorType.KVM.equals(dataObject.getTO().getHypervisorType())) {
|
||||||
|
// Fix: The format of KVM volumes on image store is qcow2
|
||||||
|
objectNameInUrl = objectNameInUrl + "." + ImageFormat.QCOW2.getFileExtension();
|
||||||
|
} else {
|
||||||
objectNameInUrl = objectNameInUrl + "." + format.getFileExtension();
|
objectNameInUrl = objectNameInUrl + "." + format.getFileExtension();
|
||||||
|
}
|
||||||
} else if (installPath.lastIndexOf(".") != -1) {
|
} else if (installPath.lastIndexOf(".") != -1) {
|
||||||
objectNameInUrl = objectNameInUrl + "." + installPath.substring(installPath.lastIndexOf(".") + 1);
|
objectNameInUrl = objectNameInUrl + "." + installPath.substring(installPath.lastIndexOf(".") + 1);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user