DaanHoogland commented on a change in pull request #3828: [WIP DO NOT MERGE]
[KVM] Direct download agnostic of the storage provider
URL: https://github.com/apache/cloudstack/pull/3828#discussion_r369455351
##########
File path:
plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/storage/KVMStorageProcessor.java
##########
@@ -1693,38 +1696,77 @@ private DirectTemplateDownloader
getDirectTemplateDownloaderFromCommand(DirectDo
@Override
public Answer handleDownloadTemplateToPrimaryStorage(DirectDownloadCommand
cmd) {
final PrimaryDataStoreTO pool = cmd.getDestPool();
- if (!pool.getPoolType().equals(StoragePoolType.NetworkFilesystem)) {
- return new DirectDownloadAnswer(false, "Unsupported pool type " +
pool.getPoolType().toString(), true);
- }
- KVMStoragePool destPool =
storagePoolMgr.getStoragePool(pool.getPoolType(), pool.getUuid());
DirectTemplateDownloader downloader;
+ KVMPhysicalDisk template;
try {
- downloader = getDirectTemplateDownloaderFromCommand(cmd, destPool);
- } catch (IllegalArgumentException e) {
- return new DirectDownloadAnswer(false, "Unable to create direct
downloader: " + e.getMessage(), true);
- }
+ s_logger.info("Verifying temporary location for downloading the
template exists on the host");
+ String temporaryDownloadPath =
resource.getDirectDownloadTemporaryDownloadPath();
+ if (!isLocationAccessible(temporaryDownloadPath)) {
+ String msg = "The temporary location path for downloading
templates does not exist: " +
+ temporaryDownloadPath + " on this host";
+ s_logger.error(msg);
+ return new DirectDownloadAnswer(false, msg, true);
+ }
- try {
+ s_logger.info("Checking for free space on the host for downloading
the template");
+ if
(!isEnoughSpaceForDownloadTemplateOnTemporaryLocation(cmd.getTemplateSize())) {
+ String msg = "Not enough space on the defined temporary
location to download the template " + cmd.getTemplateId();
+ s_logger.error(msg);
+ return new DirectDownloadAnswer(false, msg, true);
+ }
+
+ KVMStoragePool destPool =
storagePoolMgr.getStoragePool(pool.getPoolType(), pool.getUuid());
+ downloader = getDirectTemplateDownloaderFromCommand(cmd, destPool,
temporaryDownloadPath);
s_logger.info("Trying to download template");
Review comment:
maybe change this one to debug as well, or move and add the resulting path
to 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]
With regards,
Apache Git Services