use of org.ovirt.engine.core.common.businessentities.storage.DiskVmElement in project ovirt-engine by oVirt.
the class DisksTree method getRootItem.
@Override
protected TreeItem getRootItem(DiskImage disk) {
HorizontalPanel panel = new HorizontalPanel();
panel.setSpacing(1);
// $NON-NLS-1$
panel.setWidth("100%");
DiskVmElement dve = disk.getDiskVmElements().iterator().next();
// $NON-NLS-1$
addItemToPanel(panel, new Image(resources.diskImage()), "25px");
// $NON-NLS-1$
addTextBoxToPanel(panel, new StringValueLabel(), disk.getDiskAlias(), "");
// $NON-NLS-1$
addItemToPanel(panel, dve.isReadOnly() ? new Image(resources.readOnlyDiskIcon()) : new Image(), "60px");
// $NON-NLS-1$
addValueLabelToPanel(panel, new DiskSizeLabel<Long>(), disk.getSizeInGigabytes(), "120px");
// $NON-NLS-1$
addValueLabelToPanel(panel, new DiskSizeLabel<Long>(SizeConverter.SizeUnit.BYTES), disk.getActualSizeInBytes(), "120px");
// $NON-NLS-1$
addValueLabelToPanel(panel, new EnumLabel<ImageStatus>(), disk.getImageStatus(), "120px");
// $NON-NLS-1$
addValueLabelToPanel(panel, new EnumLabel<VolumeType>(), disk.getVolumeType(), "120px");
// $NON-NLS-1$
addValueLabelToPanel(panel, new EnumLabel<DiskInterface>(), dve.getDiskInterface(), "120px");
// $NON-NLS-1$
addValueLabelToPanel(panel, new EnumLabel<DiskStorageType>(), disk.getDiskStorageType(), "120px");
// $NON-NLS-1$
addValueLabelToPanel(panel, new FullDateTimeLabel(), disk.getCreationDate(), "140px");
TreeItem treeItem = new TreeItem(panel);
treeItem.setUserObject(disk.getId());
return treeItem;
}
use of org.ovirt.engine.core.common.businessentities.storage.DiskVmElement in project ovirt-engine by oVirt.
the class VmValidator method populateDisksWithVmData.
private void populateDisksWithVmData(Collection<? extends Disk> disks, Guid vmId) {
for (Disk disk : disks) {
DiskVmElement dve = getDiskVmElementDao().get(new VmDeviceId(disk.getId(), vmId));
disk.setDiskVmElements(Collections.singletonList(dve));
}
}
use of org.ovirt.engine.core.common.businessentities.storage.DiskVmElement in project ovirt-engine by oVirt.
the class AddDiskCommandTest method mockVmWithDisk.
/**
* Mock a VM that has a disk.
*
* @param storageId
* Storage domain id of the disk.
*/
private void mockVmWithDisk(Guid storageId) {
DiskImage image = new DiskImage();
image.setId(Guid.newGuid());
image.setStorageIds(new ArrayList<>(Collections.singletonList(storageId)));
DiskVmElement dve = new DiskVmElement(image.getId(), vmId);
image.setDiskVmElements(Collections.singletonList(dve));
mockVm().getDiskMap().put(image.getId(), image);
}
use of org.ovirt.engine.core.common.businessentities.storage.DiskVmElement in project ovirt-engine by oVirt.
the class NewDiskModel method initialize.
@Override
public void initialize() {
super.initialize();
setDiskVmElement(new DiskVmElement(new VmDeviceId(null, getIsFloating() ? null : getVm().getId())));
if (!getIsFloating()) {
if (getIsBootable().getIsChangable()) {
getIsBootable().setEntity(true);
}
updateSuggestedDiskAliasFromServer();
getIsPlugged().setIsAvailable(true);
} else {
// Read only disk can be created only in the scope of VM.
getIsReadOnly().setIsAvailable(false);
getIsPlugged().setEntity(false);
getIsBootable().setIsAvailable(false);
getDiskInterface().setIsAvailable(false);
getPassDiscard().setIsAvailable(false);
// set using scsi reservation to be invisible
getIsUsingScsiReservation().setIsAvailable(false);
getIsUsingScsiReservation().setEntity(false);
}
getSizeExtend().setIsAvailable(false);
}
use of org.ovirt.engine.core.common.businessentities.storage.DiskVmElement in project ovirt-engine by oVirt.
the class VmDiskListModel method createPlugOrUnplugParams.
private ArrayList<ActionParametersBase> createPlugOrUnplugParams(boolean plug) {
ArrayList<ActionParametersBase> parametersList = new ArrayList<>();
VM vm = getEntity();
for (Object item : getSelectedItems()) {
Disk disk = (Disk) item;
disk.setPlugged(plug);
parametersList.add(new VmDiskOperationParameterBase(new DiskVmElement(disk.getId(), vm.getId())));
}
return parametersList;
}
Aggregations