mirror of https://github.com/apache/cloudstack.git
bug 13492: vmware:Template sizes are incorrectly reported
status 13492: resolved fixed reviewed-by: Nitin virtual size of the private templated from size mentioned in the OVF file
This commit is contained in:
parent
faaa7593de
commit
a4c891d002
|
|
@ -9,6 +9,7 @@ import java.io.File;
|
|||
import java.io.FileOutputStream;
|
||||
import java.io.OutputStreamWriter;
|
||||
import java.rmi.RemoteException;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
|
|
@ -37,6 +38,7 @@ import com.cloud.hypervisor.vmware.util.VmwareHelper;
|
|||
import com.cloud.storage.JavaStorageLayer;
|
||||
import com.cloud.storage.Storage.ImageFormat;
|
||||
import com.cloud.storage.StorageLayer;
|
||||
import com.cloud.storage.template.VmdkProcessor;
|
||||
import com.cloud.utils.NumbersUtil;
|
||||
import com.cloud.utils.Pair;
|
||||
import com.cloud.utils.StringUtils;
|
||||
|
|
@ -498,11 +500,15 @@ public class VmwareStorageManagerImpl implements VmwareStorageManager {
|
|||
|
||||
clonedVm.exportVm(secondaryMountPoint + "/" + installPath, templateName, true, false);
|
||||
|
||||
// TODO, need to find out virtual size and physical size
|
||||
long size = new File(installFullPath + "/" + templateName + ".ova").length();
|
||||
postCreatePrivateTemplate(installFullPath, templateId, templateName, size, size);
|
||||
|
||||
return new Ternary<String, Long, Long>(installPath + "/" + templateName + ".ova", size, size);
|
||||
long physicalSize = new File(installFullPath + "/" + templateName + ".ova").length();
|
||||
VmdkProcessor processor = new VmdkProcessor();
|
||||
Map<String, Object> params = new HashMap<String, Object>();
|
||||
params.put(StorageLayer.InstanceConfigKey, _storage);
|
||||
processor.configure("VMDK Processor", params);
|
||||
long virtualSize = processor.getTemplateVirtualSize(installFullPath, templateName);
|
||||
|
||||
postCreatePrivateTemplate(installFullPath, templateId, templateName, physicalSize, virtualSize);
|
||||
return new Ternary<String, Long, Long>(installPath + "/" + templateName + ".ova", physicalSize, virtualSize);
|
||||
|
||||
} finally {
|
||||
if(clonedVm != null) {
|
||||
|
|
@ -562,9 +568,15 @@ public class VmwareStorageManagerImpl implements VmwareStorageManager {
|
|||
throw new Exception(msg);
|
||||
}
|
||||
|
||||
long size = new File(installFullName).length();
|
||||
postCreatePrivateTemplate(installFullPath, templateId, templateName, size, size);
|
||||
return new Ternary<String, Long, Long>(installPath + "/" + templateName + ".ova", size, size);
|
||||
long physicalSize = new File(installFullPath + "/" + templateName + ".ova").length();
|
||||
VmdkProcessor processor = new VmdkProcessor();
|
||||
Map<String, Object> params = new HashMap<String, Object>();
|
||||
params.put(StorageLayer.InstanceConfigKey, _storage);
|
||||
processor.configure("VMDK Processor", params);
|
||||
long virtualSize = processor.getTemplateVirtualSize(installFullPath, templateName);
|
||||
|
||||
postCreatePrivateTemplate(installFullPath, templateId, templateName, physicalSize, virtualSize);
|
||||
return new Ternary<String, Long, Long>(installPath + "/" + templateName + ".ova", physicalSize, virtualSize);
|
||||
|
||||
} catch(Exception e) {
|
||||
// TODO, clean up left over files
|
||||
|
|
|
|||
Loading…
Reference in New Issue