wido commented on code in PR #11069: URL: https://github.com/apache/cloudstack/pull/11069#discussion_r2161368784
########## plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/storage/LibvirtStorageAdaptor.java: ########## @@ -224,10 +224,35 @@ public KVMPhysicalDisk createTemplateFromDirectDownloadFile(String templateFileP } else { Script.runSimpleBashScript("mv " + templateFilePath + " " + destinationFile); } + } else if (destPool.getType() == StoragePoolType.RBD) { + String temporaryExtractFilePath = sourceFile.getParent() + File.separator + templateUuid; + extractDownloadedTemplate(templateFilePath, destPool, temporaryExtractFilePath); + createTemplateOnRBDFromDirectDownloadFile(temporaryExtractFilePath, templateUuid, destPool, timeout); } return destPool.getPhysicalDisk(templateUuid); } + private void createTemplateOnRBDFromDirectDownloadFile(String srcTemplateFilePath, String templateUuid, KVMStoragePool destPool, int timeout) { + try { + QemuImg.PhysicalDiskFormat srcFileFormat = QemuImg.PhysicalDiskFormat.QCOW2; + QemuImgFile srcFile = new QemuImgFile(srcTemplateFilePath, srcFileFormat); + QemuImg qemu = new QemuImg(timeout); + Map<String, String> info = qemu.info(srcFile); + Long virtualSize = Long.parseLong(info.get(QemuImg.VIRTUAL_SIZE)); + KVMPhysicalDisk destDisk = new KVMPhysicalDisk(destPool.getSourceDir() + "/" + templateUuid, templateUuid, destPool); + destDisk.setFormat(PhysicalDiskFormat.RAW); + destDisk.setSize(virtualSize); + destDisk.setVirtualSize(virtualSize); + QemuImgFile destFile = new QemuImgFile(KVMPhysicalDisk.RBDStringBuilder(destPool, destDisk.getPath())); Review Comment: This line here makes that it doesn't need ceph.conf, right? -- 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. To unsubscribe, e-mail: commits-unsubscr...@cloudstack.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org