mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
CLOUDSTACK-5704. OVA files exist for templates created from volumes.
Don't package the OVF and VMDK files into OVA after a template is created from volume. Since packaging process contains reading and writing from the NFS mount, it doubles the amount of data that needs to be moved around Conflicts: plugins/hypervisors/vmware/src/com/cloud/storage/resource/VmwareStorageProcessor.java
This commit is contained in:
parent
fd0fabd3e2
commit
50c2119a84
@ -614,16 +614,31 @@ public class VmwareStorageProcessor implements StorageProcessor {
|
||||
vmMo.cloneFromCurrentSnapshot(workerVmName, 0, 4, volumeDeviceInfo.second(), VmwareHelper.getDiskDeviceDatastore(volumeDeviceInfo.first()));
|
||||
clonedVm = cloneResult.first();
|
||||
|
||||
clonedVm.exportVm(secondaryMountPoint + "/" + installPath, templateUniqueName, true, false);
|
||||
clonedVm.exportVm(secondaryMountPoint + "/" + installPath, templateUniqueName, false, false);
|
||||
|
||||
long physicalSize = new File(installFullPath + "/" + templateUniqueName + ".ova").length();
|
||||
// Get VMDK filename
|
||||
String templateVMDKName = "";
|
||||
File[] files = new File(installFullPath).listFiles();
|
||||
if(files != null) {
|
||||
for(File file : files) {
|
||||
String fileName = file.getName();
|
||||
if(fileName.toLowerCase().startsWith(templateUniqueName) && fileName.toLowerCase().endsWith(".vmdk")) {
|
||||
templateVMDKName += fileName;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
long physicalSize = new File(installFullPath + "/" + templateVMDKName).length();
|
||||
OVAProcessor processor = new OVAProcessor();
|
||||
|
||||
Map<String, Object> params = new HashMap<String, Object>();
|
||||
params.put(StorageLayer.InstanceConfigKey, _storage);
|
||||
processor.configure("OVA Processor", params);
|
||||
long virtualSize = processor.getTemplateVirtualSize(installFullPath, templateUniqueName);
|
||||
|
||||
postCreatePrivateTemplate(installFullPath, templateId, templateUniqueName, physicalSize, virtualSize);
|
||||
writeMetaOvaForTemplate(installFullPath, templateUniqueName + ".ovf", templateVMDKName, templateUniqueName, physicalSize);
|
||||
return new Ternary<String, Long, Long>(installPath + "/" + templateUniqueName + ".ova", physicalSize, virtualSize);
|
||||
|
||||
} finally {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user