@Override protected void readDisk(XmlNode node, DiskImage image) { super.readDisk(node, image); if (!StringUtils.isEmpty(node.attributes.get("ovf:size").getValue())) { image.setSize(convertGigabyteToBytes(Long.parseLong(node.attributes.get("ovf:size").getValue()))); } if (!StringUtils.isEmpty(node.attributes.get("ovf:actual_size").getValue())) { image.setActualSizeInBytes( convertGigabyteToBytes(Long.parseLong(node.attributes.get("ovf:actual_size").getValue()))); } }
protected void mapEntity(ResultSet rs, DiskImage entity) throws SQLException { entity.setCreationDate(DbFacadeUtils.fromDate(rs .getTimestamp("creation_date"))); entity.setActualSizeInBytes(rs.getLong("actual_size")); entity.setDescription(rs.getString("description")); entity.setImageId(getGuidDefaultEmpty(rs, "image_guid"));
XmlAttribute populatedSize = node.attributes.get("ovf:populatedSize"); if (populatedSize != null) { image.setActualSizeInBytes(Long.parseLong(populatedSize.getValue())); } else { XmlAttribute actualSize = fileIdToFileAttributes.get(fileRef).get("ovf:size"); if (actualSize != null) { image.setActualSizeInBytes(Long.parseLong(actualSize.getValue())); } else { log.warn("didn't find disk provisioned size thus allocating the virtual size"); image.setActualSizeInBytes(virtualSize);
public boolean flush() { if (validate()) { diskModel.flush(); DiskImage diskImage = (DiskImage) getDiskModel().getDisk(); diskImage.setSize(getVirtualSize()); diskImage.setActualSizeInBytes(imageInfoModel.getActualSize()); diskImage.setVolumeFormat(getImageInfoModel().getFormat()); diskImage.setVolumeType(AsyncDataProvider.getInstance().getVolumeType( diskImage.getVolumeFormat(), getDiskModel().getStorageDomain().getSelectedItem().getStorageType(), null, null)); diskImage.setContentType(getImageInfoModel().getContentType()); return true; } else { setIsValid(false); } return false; }
diskImage.setActualSizeInBytes(disk.getInitialSize());