use of org.ovirt.engine.core.common.businessentities.storage.DiskImage in project ovirt-engine by oVirt.
the class ImportVmFromExportDomainPopupView method initDiskTable.
private void initDiskTable() {
diskTable = new ListModelObjectCellTable<>();
diskTable.enableColumnResizing();
AbstractTextColumn<DiskImage> aliasColumn = new AbstractTextColumn<DiskImage>() {
@Override
public String getValue(DiskImage object) {
return object.getDiskAlias();
}
};
// $NON-NLS-1$
diskTable.addColumn(aliasColumn, constants.aliasDisk(), "100px");
AbstractImageResourceColumn<DiskImage> bootableDiskColumn = new AbstractImageResourceColumn<DiskImage>() {
@Override
public ImageResource getValue(DiskImage object) {
return object.getDiskVmElements().iterator().next().isBoot() ? getDefaultImage() : null;
}
@Override
public ImageResource getDefaultImage() {
return resources.bootableDiskIcon();
}
@Override
public SafeHtml getTooltip(DiskImage object) {
if (object.getDiskVmElements().iterator().next().isBoot()) {
return SafeHtmlUtils.fromSafeConstant(constants.bootableDisk());
}
return null;
}
};
diskTable.addColumn(bootableDiskColumn, new ImageResourceHeader(DisksViewColumns.bootableDiskColumn.getDefaultImage(), SafeHtmlUtils.fromSafeConstant(constants.bootableDisk())), // $NON-NLS-1$
"30px");
AbstractDiskSizeColumn<DiskImage> sizeColumn = new AbstractDiskSizeColumn<DiskImage>() {
@Override
protected Long getRawValue(DiskImage object) {
return object.getSize();
}
};
// $NON-NLS-1$
diskTable.addColumn(sizeColumn, constants.provisionedSizeDisk(), "130px");
AbstractDiskSizeColumn<DiskImage> actualSizeColumn = new AbstractDiskSizeColumn<DiskImage>() {
@Override
protected Long getRawValue(DiskImage object) {
return object.getActualSizeInBytes();
}
};
// $NON-NLS-1$
diskTable.addColumn(actualSizeColumn, constants.sizeDisk(), "130px");
AbstractTextColumn<DiskImage> dateCreatedColumn = new AbstractFullDateTimeColumn<DiskImage>() {
@Override
protected Date getRawValue(DiskImage object) {
return object.getCreationDate();
}
};
// $NON-NLS-1$
diskTable.addColumn(dateCreatedColumn, constants.dateCreatedInterface(), "120px");
diskTable.setSelectionModel(new NoSelectionModel<DiskImage>());
addAllocationColumn();
diskTable.getElement().getStyle().setPosition(Position.RELATIVE);
}
use of org.ovirt.engine.core.common.businessentities.storage.DiskImage in project ovirt-engine by oVirt.
the class GetVmsFullInfoFromExternalProviderVDSCommand method executeVdsBrokerCommand.
@Override
protected void executeVdsBrokerCommand() {
vmListReturn = getBroker().getExternalVmList(getParameters().getUrl(), getParameters().getUsername(), getParameters().getPassword(), getParameters().getNamesOfVms());
proceedProxyReturnValue();
List<VM> vms = new ArrayList<>();
List<VM> notDownVms = new ArrayList<>();
for (Map<String, Object> map : vmListReturn.vmList) {
VM vm = VdsBrokerObjectsBuilder.buildVmsDataFromExternalProvider(map);
if (vm != null) {
vm.setOrigin(getParameters().getOriginType());
if (vm.getOrigin() == OriginType.KVM) {
if (VmDeviceCommonUtils.isVirtIoScsiDiskInterfaceExists(vm.getStaticData())) {
VmDeviceCommonUtils.addVirtIoScsiDevice(vm.getStaticData());
}
if (!VmDeviceCommonUtils.hasCdDevice(vm.getStaticData())) {
VmDeviceCommonUtils.addCdDevice(vm.getStaticData());
}
for (DiskImage image : vm.getImages()) {
image.getDiskVmElementForVm(vm.getId()).setBoot(true);
break;
}
} else {
// set default value in case of non KVM provider type
// since VirtIO interface doesn't require having an appropriate controller
// so validation will pass. This will anyway be overridden later by virt-v2v OVF.
VmDeviceCommonUtils.setDiskInterfaceForVm(vm.getStaticData(), DiskInterface.VirtIO);
}
vms.add(vm);
// identify vms not in Down status
if (!vm.isDown()) {
notDownVms.add(vm);
}
}
}
logNonDownVms(notDownVms);
setReturnValue(vms);
}
use of org.ovirt.engine.core.common.businessentities.storage.DiskImage in project ovirt-engine by oVirt.
the class VmSnapshotListViewItem method createDisksItemContainerPanel.
private Container createDisksItemContainerPanel(List<DiskImage> diskImages) {
Row content = new Row();
Column column = new Column(ColumnSize.MD_12);
content.add(column);
for (DiskImage image : diskImages) {
DListElement dl = Document.get().createDLElement();
dl.addClassName(DL_HORIZONTAL);
addDetailItem(SafeHtmlUtils.fromSafeConstant(constants.statusDisk()), SafeHtmlUtils.fromString(getImageStatus(image.getImageStatus())), dl);
addDetailItem(SafeHtmlUtils.fromSafeConstant(constants.aliasDisk()), SafeHtmlUtils.fromString(image.getDiskAlias()), dl);
addDetailItem(SafeHtmlUtils.fromSafeConstant(constants.provisionedSizeDisk()), SafeHtmlUtils.fromString(String.valueOf(sizeRenderer.render(image.getSize()))), dl);
addDetailItem(SafeHtmlUtils.fromSafeConstant(constants.sizeDisk()), SafeHtmlUtils.fromString(String.valueOf(sizeRenderer.render(image.getActualSizeInBytes()))), dl);
addDetailItem(SafeHtmlUtils.fromSafeConstant(constants.allocationDisk()), SafeHtmlUtils.fromString(String.valueOf(VolumeType.forValue(image.getVolumeType().getValue()))), dl);
addDetailItem(SafeHtmlUtils.fromSafeConstant(constants.interfaceDisk()), SafeHtmlUtils.fromString(getInterface(image)), dl);
addDetailItem(SafeHtmlUtils.fromSafeConstant(constants.creationDateDisk()), SafeHtmlUtils.fromString(dateRenderer.render(image.getCreationDate())), dl);
addDetailItem(SafeHtmlUtils.fromSafeConstant(constants.diskSnapshotIDDisk()), SafeHtmlUtils.fromString(String.valueOf(image.getImageId())), dl);
addDetailItem(SafeHtmlUtils.fromSafeConstant(constants.typeDisk()), SafeHtmlUtils.fromString(String.valueOf(image.getDiskStorageType())), dl);
addDetailItem(SafeHtmlUtils.fromSafeConstant(constants.descriptionDisk()), SafeHtmlUtils.fromString(StringHelper.isNotNullOrEmpty(image.getDiskDescription()) ? image.getDiskDescription() : constants.notAvailableLabel()), dl);
column.getElement().appendChild(dl);
}
if (diskImages.isEmpty()) {
column.getElement().setInnerHTML(constants.noItemsToDisplay());
}
return createItemContainerPanel(content);
}
use of org.ovirt.engine.core.common.businessentities.storage.DiskImage in project ovirt-engine by oVirt.
the class VmSnapshotCreatePopupWidget method updateMemoryWarning.
private void updateMemoryWarning(SnapshotModel model) {
Collection<DiskImage> diskImages = model.getSnapshotDisks().getItems();
List<DiskImage> selectedDiskImages = model.getSnapshotDisks().getSelectedItems();
boolean partialDisksSelection = selectedDiskImages != null && diskImages.size() != selectedDiskImages.size();
boolean includeMemory = model.getMemory().getEntity();
SafeHtml warningImage = SafeHtmlUtils.fromTrustedString(AbstractImagePrototype.create(resources.logWarningImage()).getHTML());
HTML partialSnapshotWithMemoryWarningWidget = new HTML(templates.iconWithText(warningImage, constants.snapshotCreationWithMemoryAndPartialDisksWarning()));
HTML memoryWarningWidget = new HTML(templates.iconWithText(warningImage, constants.snapshotCreationWithMemoryNotLiveWarning()));
warningPanel.clear();
// Show warning in case of saving memory to snapshot and excluding some disks.
if (includeMemory && partialDisksSelection) {
warningPanel.add(partialSnapshotWithMemoryWarningWidget);
}
// Show warning in case of saving memory since it is not really 'live'
if (includeMemory) {
warningPanel.add(memoryWarningWidget);
}
}
use of org.ovirt.engine.core.common.businessentities.storage.DiskImage in project ovirt-engine by oVirt.
the class DiskListModel method updateCopyAndMoveCommandAvailability.
private void updateCopyAndMoveCommandAvailability(List<Disk> disks) {
boolean isCopyAllowed = true;
boolean isMoveAllowed = true;
if (disks == null || disks.isEmpty() || disks.get(0).getDiskStorageType() != DiskStorageType.IMAGE) {
disableMoveAndCopyCommands();
return;
}
Guid datacenterId = ((DiskImage) disks.get(0)).getStoragePoolId();
boolean foundTemplateDisk = false;
boolean foundVmDisk = false;
boolean foundUnattachedDisk = false;
for (Disk disk : disks) {
if ((!isCopyAllowed && !isMoveAllowed) || disk.getDiskStorageType() != DiskStorageType.IMAGE) {
disableMoveAndCopyCommands();
return;
}
DiskImage diskImage = (DiskImage) disk;
if (diskImage.getImageStatus() != ImageStatus.OK || !datacenterId.equals(diskImage.getStoragePoolId()) || diskImage.isOvfStore()) {
disableMoveAndCopyCommands();
return;
}
VmEntityType vmEntityType = disk.getVmEntityType();
if (vmEntityType == null) {
foundUnattachedDisk = true;
} else if (vmEntityType.isTemplateType()) {
foundTemplateDisk = true;
} else if (vmEntityType.isVmType()) {
foundVmDisk = true;
}
if (foundTemplateDisk && (foundUnattachedDisk || foundVmDisk)) {
isCopyAllowed = false;
}
if (vmEntityType != null && vmEntityType.isTemplateType()) {
isMoveAllowed = false;
}
}
getCopyCommand().setIsExecutionAllowed(isCopyAllowed);
getMoveCommand().setIsExecutionAllowed(isMoveAllowed);
}
Aggregations