Search in sources :

Example 6 with VolumeType

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);
    }
}
Also used : DiskModel(org.ovirt.engine.ui.uicommonweb.models.vms.DiskModel) StorageDomain(org.ovirt.engine.core.common.businessentities.StorageDomain) VolumeFormat(org.ovirt.engine.core.common.businessentities.storage.VolumeFormat) VolumeType(org.ovirt.engine.core.common.businessentities.storage.VolumeType) DiskImage(org.ovirt.engine.core.common.businessentities.storage.DiskImage) DiskProfile(org.ovirt.engine.core.common.businessentities.profiles.DiskProfile)

Example 7 with VolumeType

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();
        }
    });
}
Also used : VolumeType(org.ovirt.engine.core.common.businessentities.storage.VolumeType) Quota(org.ovirt.engine.core.common.businessentities.Quota) RepoImage(org.ovirt.engine.core.common.businessentities.storage.RepoImage) NullSafeRenderer(org.ovirt.engine.ui.common.widget.renderer.NullSafeRenderer) CpuProfile(org.ovirt.engine.core.common.businessentities.profiles.CpuProfile) Cluster(org.ovirt.engine.core.common.businessentities.Cluster) EntityModelCheckBoxEditor(org.ovirt.engine.ui.common.widget.editor.generic.EntityModelCheckBoxEditor) StorageDomainFreeSpaceRenderer(org.ovirt.engine.ui.common.widget.renderer.StorageDomainFreeSpaceRenderer)

Example 8 with VolumeType

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;
}
Also used : TreeItem(com.google.gwt.user.client.ui.TreeItem) ImageStatus(org.ovirt.engine.core.common.businessentities.storage.ImageStatus) DiskStorageType(org.ovirt.engine.core.common.businessentities.storage.DiskStorageType) Image(com.google.gwt.user.client.ui.Image) DiskImage(org.ovirt.engine.core.common.businessentities.storage.DiskImage) StringValueLabel(org.ovirt.engine.ui.common.widget.label.StringValueLabel) FullDateTimeLabel(org.ovirt.engine.ui.webadmin.widget.label.FullDateTimeLabel) VolumeType(org.ovirt.engine.core.common.businessentities.storage.VolumeType) HorizontalPanel(com.google.gwt.user.client.ui.HorizontalPanel) DiskVmElement(org.ovirt.engine.core.common.businessentities.storage.DiskVmElement) DiskInterface(org.ovirt.engine.core.common.businessentities.storage.DiskInterface)

Example 9 with VolumeType

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;
}
Also used : TreeItem(com.google.gwt.user.client.ui.TreeItem) ImageStatus(org.ovirt.engine.core.common.businessentities.storage.ImageStatus) DiskStorageType(org.ovirt.engine.core.common.businessentities.storage.DiskStorageType) Image(com.google.gwt.user.client.ui.Image) DiskImage(org.ovirt.engine.core.common.businessentities.storage.DiskImage) StringValueLabel(org.ovirt.engine.ui.common.widget.label.StringValueLabel) DateLabel(com.google.gwt.user.client.ui.DateLabel) VolumeType(org.ovirt.engine.core.common.businessentities.storage.VolumeType) HorizontalPanel(com.google.gwt.user.client.ui.HorizontalPanel) DiskInterface(org.ovirt.engine.core.common.businessentities.storage.DiskInterface) DiskImage(org.ovirt.engine.core.common.businessentities.storage.DiskImage)

Example 10 with VolumeType

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);
}
Also used : VolumeType(org.ovirt.engine.core.common.businessentities.storage.VolumeType) ListModel(org.ovirt.engine.ui.uicommonweb.models.ListModel) ArrayList(java.util.ArrayList) CinderDisk(org.ovirt.engine.core.common.businessentities.storage.CinderDisk) CinderDisk(org.ovirt.engine.core.common.businessentities.storage.CinderDisk) Disk(org.ovirt.engine.core.common.businessentities.storage.Disk) DiskImage(org.ovirt.engine.core.common.businessentities.storage.DiskImage) DiskByDiskAliasComparator(org.ovirt.engine.core.common.businessentities.comparators.DiskByDiskAliasComparator)

Aggregations

VolumeType (org.ovirt.engine.core.common.businessentities.storage.VolumeType)10 DiskImage (org.ovirt.engine.core.common.businessentities.storage.DiskImage)7 ArrayList (java.util.ArrayList)4 DiskStorageType (org.ovirt.engine.core.common.businessentities.storage.DiskStorageType)3 HorizontalPanel (com.google.gwt.user.client.ui.HorizontalPanel)2 Image (com.google.gwt.user.client.ui.Image)2 TreeItem (com.google.gwt.user.client.ui.TreeItem)2 StorageDomain (org.ovirt.engine.core.common.businessentities.StorageDomain)2 DiskInterface (org.ovirt.engine.core.common.businessentities.storage.DiskInterface)2 ImageStatus (org.ovirt.engine.core.common.businessentities.storage.ImageStatus)2 StorageType (org.ovirt.engine.core.common.businessentities.storage.StorageType)2 VolumeFormat (org.ovirt.engine.core.common.businessentities.storage.VolumeFormat)2 StringValueLabel (org.ovirt.engine.ui.common.widget.label.StringValueLabel)2 ListModel (org.ovirt.engine.ui.uicommonweb.models.ListModel)2 DateLabel (com.google.gwt.user.client.ui.DateLabel)1 Cluster (org.ovirt.engine.core.common.businessentities.Cluster)1 Quota (org.ovirt.engine.core.common.businessentities.Quota)1 DiskByDiskAliasComparator (org.ovirt.engine.core.common.businessentities.comparators.DiskByDiskAliasComparator)1 CpuProfile (org.ovirt.engine.core.common.businessentities.profiles.CpuProfile)1 DiskProfile (org.ovirt.engine.core.common.businessentities.profiles.DiskProfile)1