@Override protected MapSqlParameterSource createFullParametersMapper(DiskVmElement entity) { return createIdParameterMapper(entity.getId()) .addValue("is_boot", entity.isBoot()) .addValue("pass_discard", entity.isPassDiscard()) .addValue("disk_interface", EnumUtils.nameOrNull(entity.getDiskInterface())) .addValue("is_using_scsi_reservation", entity.isUsingScsiReservation()); }
private static void copyProperties(DiskVmElement source, DiskVmElement dest) { dest.setBoot(source.isBoot()); dest.setPassDiscard(source.isPassDiscard()); dest.setDiskInterface(source.getDiskInterface()); dest.setUsingScsiReservation(source.isUsingScsiReservation()); dest.setPlugged(source.isPlugged()); dest.setLogicalName(source.getLogicalName()); dest.setReadOnly(source.isReadOnly()); }
@Override protected void writeDisk(DiskImage image) { DiskVmElement dve = image.getDiskVmElementForVm(vmBase.getId()); _writer.writeAttributeString(getOvfUri(), "diskId", image.getImageId().toString()); _writer.writeAttributeString(getOvfUri(), "size", String.valueOf(bytesToGigabyte(image.getSize()))); _writer.writeAttributeString(getOvfUri(), "actual_size", String.valueOf(bytesToGigabyte(image.getActualSizeInBytes()))); _writer.writeAttributeString(getOvfUri(), "vm_snapshot_id", (image.getVmSnapshotId() != null) ? image .getVmSnapshotId().toString() : ""); writeDiskParentRef(image); _writer.writeAttributeString(getOvfUri(), "fileRef", OvfParser.createImageFile(image)); _writer.writeAttributeString(getOvfUri(), "format", getVolumeImageFormat(image.getVolumeFormat())); _writer.writeAttributeString(getOvfUri(), "volume-format", image.getVolumeFormat().toString()); _writer.writeAttributeString(getOvfUri(), "volume-type", image.getVolumeType().toString()); _writer.writeAttributeString(getOvfUri(), "disk-interface", dve.getDiskInterface().toString()); _writer.writeAttributeString(getOvfUri(), "read-only", String.valueOf(dve.isReadOnly())); _writer.writeAttributeString(getOvfUri(), "shareable", String.valueOf(image.isShareable())); _writer.writeAttributeString(getOvfUri(), "boot", String.valueOf(dve.isBoot())); _writer.writeAttributeString(getOvfUri(), "pass-discard", String.valueOf(dve.isPassDiscard())); if (image.getDiskAlias() != null) { _writer.writeAttributeString(getOvfUri(), "disk-alias", image.getDiskAlias()); } if (image.getDiskDescription() != null) { _writer.writeAttributeString(getOvfUri(), "disk-description", image.getDiskDescription()); } _writer.writeAttributeString(getOvfUri(), "wipe-after-delete", String.valueOf(image.isWipeAfterDelete())); }
_writer.writeAttributeString(getOvfUri(), "disk-description", lun.getDiskDescription()); _writer.writeAttributeString(getOvfUri(), "pass-discard", String.valueOf(dve.isPassDiscard())); _writer.writeAttributeString(getOvfUri(), "fileRef", OvfParser.createLunFile(lun)); _writer.writeAttributeString(getOvfUri(), "shareable", String.valueOf(lun.isShareable()));
_writer.writeAttributeString(OVF_PREFIX, getOvfUri(), "disk-interface", dve.getDiskInterface().toString()); _writer.writeAttributeString(OVF_PREFIX, getOvfUri(), "boot", String.valueOf(dve.isBoot())); _writer.writeAttributeString(OVF_PREFIX, getOvfUri(), "pass-discard", String.valueOf(dve.isPassDiscard())); if (image.getDiskAlias() != null) { _writer.writeAttributeString(OVF_PREFIX, getOvfUri(), "disk-alias", image.getDiskAlias());
protected void updatePassDiscardAvailability() { if (getIsFloating()) { getPassDiscard().setIsAvailable(false); } else { DiskInterface selectedInterface = getDiskInterface().getSelectedItem(); DiskStorageType selectedDiskStorageType = getDiskStorageType().getEntity(); boolean isApplicableInterface = selectedInterface == DiskInterface.VirtIO_SCSI || selectedInterface == DiskInterface.IDE || selectedInterface == DiskInterface.SATA; boolean isApplicableDiskStorageType = selectedDiskStorageType == DiskStorageType.LUN || selectedDiskStorageType == DiskStorageType.IMAGE; boolean isApplicableStorageType = selectedDiskStorageType == DiskStorageType.LUN || (getStorageDomain().getSelectedItem() != null && getStorageDomain().getSelectedItem().getStorageType().isInternal()); if (isApplicableInterface && isApplicableDiskStorageType && isApplicableStorageType) { getPassDiscard().setIsAvailable(true); if (!getIsNew()) { getPassDiscard().setEntity(getDiskVmElement().isPassDiscard()); } } else { // Reset PassDiscard's availability and value. getPassDiscard().setIsAvailable(false); getPassDiscard().setEntity(false); } } }
@Mapping(from = org.ovirt.engine.core.common.businessentities.storage.DiskVmElement.class, to = DiskAttachment.class) public static DiskAttachment map(org.ovirt.engine.core.common.businessentities.storage.DiskVmElement entity, DiskAttachment template) { DiskAttachment model = template != null ? template : new DiskAttachment(); Guid vmId = entity.getVmId(); if (vmId != null) { Vm vm = new Vm(); vm.setId(vmId.toString()); model.setVm(vm); } Guid diskId = entity.getDiskId(); if (diskId != null) { Disk disk = new Disk(); disk.setId(diskId.toString()); model.setDisk(disk); } model.setId(entity.getDiskId().toString()); model.setBootable(entity.isBoot()); model.setPassDiscard(entity.isPassDiscard()); model.setInterface(DiskMapper.mapInterface(entity.getDiskInterface())); model.setActive(entity.isPlugged()); model.setLogicalName(entity.getLogicalName()); model.setUsesScsiReservation(entity.isUsingScsiReservation()); model.setReadOnly(entity.isReadOnly()); return model; } }
getIsReadOnly().setEntity(getDiskVmElement().isReadOnly()); getIsBootable().setEntity(getDiskVmElement().isBoot()); getPassDiscard().setEntity(getDiskVmElement().isPassDiscard());