use of org.ovirt.engine.core.common.businessentities.storage.VolumeType in project ovirt-engine by oVirt.
the class DisksAllocationModel method updateImageToDestinationDomainMap.
private void updateImageToDestinationDomainMap() {
if (disks == null) {
return;
}
for (DiskModel diskModel : disks) {
StorageDomain storageDomain = diskModel.getStorageDomain().getSelectedItem();
DiskImage diskImage = (DiskImage) diskModel.getDisk();
diskImage.setStorageIds(new ArrayList<>(Collections.singletonList(storageDomain.getId())));
diskImage.setDiskAlias(diskModel.getAlias().getEntity());
DiskProfile diskProfile = diskModel.getDiskProfile().getSelectedItem();
diskImage.setDiskProfileId(diskProfile != null ? diskProfile.getId() : null);
if (diskModel.getQuota().getSelectedItem() != null) {
diskImage.setQuotaId(diskModel.getQuota().getSelectedItem().getId());
}
if (diskModel.getVolumeFormat().getIsAvailable()) {
VolumeFormat volumeFormat = diskModel.getVolumeFormat().getSelectedItem();
diskImage.setVolumeFormat(volumeFormat);
diskImage.setVolumeType(AsyncDataProvider.getInstance().getVolumeType(volumeFormat, storageDomain.getStorageType()));
} else if (diskModel.getVolumeType().getIsAvailable()) {
VolumeType volumeType = diskModel.getVolumeType().getSelectedItem();
diskImage.setVolumeType(volumeType);
diskImage.setVolumeFormat(AsyncDataProvider.getInstance().getDiskVolumeFormat(volumeType, storageDomain.getStorageType()));
}
imageToDestinationDomainMap.put(diskImage.getId(), diskImage);
}
}
use of org.ovirt.engine.core.common.businessentities.storage.VolumeType in project ovirt-engine by oVirt.
the class ImportVmFromExternalProviderPopupView method initListBoxEditors.
private void initListBoxEditors() {
destClusterEditor = new ListModelListBoxEditor<>(new NullSafeRenderer<Cluster>() {
@Override
public String renderNullSafe(Cluster object) {
return object.getName();
}
});
destClusterQuotaEditor = new ListModelListBoxEditor<>(new NullSafeRenderer<Quota>() {
@Override
public String renderNullSafe(Quota object) {
return object.getQuotaName();
}
});
destStorageEditor = new ListModelListBoxEditor<>(new StorageDomainFreeSpaceRenderer());
cpuProfileEditor = new ListModelListBoxEditor<>(new NullSafeRenderer<CpuProfile>() {
@Override
protected String renderNullSafe(CpuProfile object) {
return object.getName();
}
});
disksAllocationEditor = new ListModelListBoxEditor<>(new NullSafeRenderer<VolumeType>() {
@Override
protected String renderNullSafe(VolumeType object) {
return new EnumRenderer<VolumeType>().render(object);
}
});
attachDriversEditor = new EntityModelCheckBoxEditor(Align.LEFT);
cdImageEditor = new ListModelListBoxOnlyEditor<>(new NullSafeRenderer<RepoImage>() {
@Override
protected String renderNullSafe(RepoImage object) {
return object.getRepoImageId();
}
});
}
use of org.ovirt.engine.core.common.businessentities.storage.VolumeType 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.VolumeType in project ovirt-engine by oVirt.
the class StoragesTree method getNodeItem.
@Override
protected TreeItem getNodeItem(DiskModel diskModel) {
HorizontalPanel panel = new HorizontalPanel();
panel.setSpacing(1);
// $NON-NLS-1$
panel.setWidth("100%");
DiskImage disk = (DiskImage) diskModel.getDisk();
// $NON-NLS-1$
addItemToPanel(panel, new Image(resources.diskImage()), "30px");
// $NON-NLS-1$
addTextBoxToPanel(panel, new StringValueLabel(), disk.getDiskAlias(), "");
// $NON-NLS-1$
addValueLabelToPanel(panel, new DiskSizeLabel<Long>(), disk.getSizeInGigabytes(), "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>(), disk.getDiskVmElements().iterator().next().getDiskInterface(), "110px");
// $NON-NLS-1$
addValueLabelToPanel(panel, new EnumLabel<DiskStorageType>(), disk.getDiskStorageType(), "110px");
// $NON-NLS-1$
addValueLabelToPanel(panel, new DateLabel(), disk.getCreationDate(), "100px");
TreeItem treeItem = new TreeItem(panel);
treeItem.setUserObject(getEntityId(diskModel));
return treeItem;
}
use of org.ovirt.engine.core.common.businessentities.storage.VolumeType in project ovirt-engine by oVirt.
the class NewTemplateVmModelBehavior method initDisks.
private void initDisks(ArrayList<Disk> disks) {
Collections.sort(disks, new DiskByDiskAliasComparator());
ArrayList<DiskModel> list = new ArrayList<>();
for (Disk disk : disks) {
DiskModel diskModel = new DiskModel();
switch(disk.getDiskStorageType()) {
case IMAGE:
DiskImage diskImage = (DiskImage) disk;
diskModel.setSize(new EntityModel<>((int) diskImage.getSizeInGigabytes()));
ListModel volumes = new ListModel();
volumes.setItems(diskImage.getVolumeType() == VolumeType.Preallocated ? new ArrayList<>(Arrays.asList(new VolumeType[] { VolumeType.Preallocated })) : AsyncDataProvider.getInstance().getVolumeTypeList(), diskImage.getVolumeType());
diskModel.setVolumeType(volumes);
diskModel.getAlias().setEntity(diskImage.getDiskAlias());
break;
case CINDER:
CinderDisk cinderDisk = (CinderDisk) disk;
diskModel.setSize(new EntityModel<>((int) cinderDisk.getSizeInGigabytes()));
ListModel volumeTypes = new ListModel();
volumeTypes.setItems(new ArrayList<>(Arrays.asList(cinderDisk.getVolumeType())), cinderDisk.getVolumeType());
diskModel.setVolumeType(volumeTypes);
diskModel.getAlias().setEntity(cinderDisk.getDiskAlias());
diskModel.getVolumeFormat().setIsChangeable(false);
break;
}
diskModel.setDisk(disk);
list.add(diskModel);
diskModel.getVolumeFormat().setIsAvailable(true);
}
getModel().setDisks(list);
}
Aggregations