Search in sources :

Example 1 with ArchitectureType

use of org.ovirt.engine.core.common.businessentities.ArchitectureType in project ovirt-engine by oVirt.

the class ManageBackupModel method validateSingleArchitecture.

protected boolean validateSingleArchitecture() {
    // Checks if there are selected VMs of multiple architectures
    ArchitectureType firstArch = null;
    boolean multipleArchs = false;
    for (T item : getSelectedItems()) {
        ArchitectureType arch = getArchitectureFromItem(item);
        if (firstArch == null) {
            firstArch = arch;
        } else {
            if (!firstArch.equals(arch)) {
                multipleArchs = true;
                break;
            }
        }
    }
    if (multipleArchs) {
        ConfirmationModel confirmModel = new ConfirmationModel();
        setConfirmWindow(confirmModel);
        confirmModel.setTitle(ConstantsManager.getInstance().getConstants().invalidImportTitle());
        confirmModel.setHelpTag(HelpTag.multiple_archs_dialog);
        // $NON-NLS-1$
        confirmModel.setHashName("multiple_archs_dialog");
        confirmModel.setMessage(ConstantsManager.getInstance().getConstants().invalidImportMsg());
        // $NON-NLS-1$
        UICommand command = UICommand.createDefaultOkUiCommand("multipleArchsOK", this);
        confirmModel.getCommands().add(command);
        setConfirmWindow(confirmModel);
        return false;
    }
    return true;
}
Also used : ArchitectureType(org.ovirt.engine.core.common.businessentities.ArchitectureType) UICommand(org.ovirt.engine.ui.uicommonweb.UICommand) ConfirmationModel(org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel)

Example 2 with ArchitectureType

use of org.ovirt.engine.core.common.businessentities.ArchitectureType in project ovirt-engine by oVirt.

the class RegisterVmPopupView method createEntityTable.

@Override
protected void createEntityTable(RegisterVmModel model) {
    entityTable.addColumn(new AbstractImageResourceColumn<RegisterVmData>() {

        @Override
        public ImageResource getValue(RegisterVmData registerVmData) {
            if (registerVmData.getError() != null) {
                return resources.errorImage();
            }
            if (registerVmData.getWarning() != null) {
                return resources.alertImage();
            }
            return null;
        }

        @Override
        public SafeHtml getTooltip(RegisterVmData registerVmData) {
            String problem;
            if (registerVmData.getError() != null) {
                problem = registerVmData.getError();
            } else {
                problem = registerVmData.getWarning();
            }
            return problem == null ? null : new SafeHtmlBuilder().appendEscapedLines(problem).toSafeHtml();
        }
    }, constants.empty(), // $NON-NLS-1$
    "20px");
    AbstractTextColumn<RegisterVmData> nameColumn = new AbstractTextColumn<RegisterVmData>() {

        @Override
        public String getValue(RegisterVmData registerVmData) {
            return registerVmData.getVm().getName();
        }
    };
    // $NON-NLS-1$
    entityTable.addColumn(nameColumn, constants.nameVm(), "150px");
    AbstractTextColumn<RegisterVmData> originColumn = new AbstractEnumColumn<RegisterVmData, OriginType>() {

        @Override
        protected OriginType getRawValue(RegisterVmData registerVmData) {
            return registerVmData.getVm().getOrigin();
        }
    };
    // $NON-NLS-1$
    entityTable.addColumn(originColumn, constants.originVm(), "100px");
    AbstractTextColumn<RegisterVmData> memoryColumn = new AbstractTextColumn<RegisterVmData>() {

        @Override
        public String getValue(RegisterVmData registerVmData) {
            int size = registerVmData.getVm().getVmMemSizeMb();
            return messages.megabytes(String.valueOf(size));
        }
    };
    // $NON-NLS-1$
    entityTable.addColumn(memoryColumn, constants.memoryVm(), "100px");
    AbstractTextColumn<RegisterVmData> cpuColumn = new AbstractTextColumn<RegisterVmData>() {

        @Override
        public String getValue(RegisterVmData registerVmData) {
            int numOfCpus = registerVmData.getVm().getNumOfCpus();
            return String.valueOf(numOfCpus);
        }
    };
    // $NON-NLS-1$
    entityTable.addColumn(cpuColumn, constants.cpusVm(), "50px");
    AbstractTextColumn<RegisterVmData> archColumn = new AbstractTextColumn<RegisterVmData>() {

        @Override
        public String getValue(RegisterVmData registerVmData) {
            ArchitectureType clusterArch = registerVmData.getVm().getClusterArch();
            return String.valueOf(clusterArch);
        }
    };
    // $NON-NLS-1$
    entityTable.addColumn(archColumn, constants.architectureVm(), "100px");
    AbstractTextColumn<RegisterVmData> diskColumn = new AbstractTextColumn<RegisterVmData>() {

        @Override
        public String getValue(RegisterVmData registerVmData) {
            int numOfDisks = registerVmData.getVm().getDiskMap().size();
            return String.valueOf(numOfDisks);
        }
    };
    // $NON-NLS-1$
    entityTable.addColumn(diskColumn, constants.disksVm(), "50px");
    // $NON-NLS-1$
    entityTable.addColumn(creatReassignMacsColumn(), new ReassignBadMacsHeader(), "150px");
    // $NON-NLS-1$
    entityTable.addColumn(createAllowPartialColumn(), constants.allowPartial(), "95px");
    // $NON-NLS-1$
    entityTable.addColumn(getClusterColumn(), constants.clusterVm(), "150px");
    if (model.isQuotaEnabled()) {
        // $NON-NLS-1$
        entityTable.addColumn(getClusterQuotaColumn(), constants.quotaVm(), "150px");
    }
}
Also used : ArchitectureType(org.ovirt.engine.core.common.businessentities.ArchitectureType) RegisterVmData(org.ovirt.engine.ui.uicommonweb.models.vms.register.RegisterVmData) SafeHtml(com.google.gwt.safehtml.shared.SafeHtml) SafeHtmlBuilder(com.google.gwt.safehtml.shared.SafeHtmlBuilder) AbstractEnumColumn(org.ovirt.engine.ui.common.widget.table.column.AbstractEnumColumn) ImageResource(com.google.gwt.resources.client.ImageResource) AbstractTextColumn(org.ovirt.engine.ui.common.widget.table.column.AbstractTextColumn)

Example 3 with ArchitectureType

use of org.ovirt.engine.core.common.businessentities.ArchitectureType in project ovirt-engine by oVirt.

the class ImportVmFromExportDomainModel method doInit.

protected void doInit() {
    StoragePool dataCenter = getStoragePool();
    if (dataCenter == null) {
        return;
    }
    getClusterQuota().setIsAvailable(dataCenter.getQuotaEnforcementType() != QuotaEnforcementTypeEnum.DISABLED);
    getCluster().getSelectedItemChangedEvent().addListener(clusterChangedListener);
    // get cluster
    getCluster().setItems(null);
    AsyncDataProvider.getInstance().getClusterByServiceList(new AsyncQuery<>(clusters -> {
        ArchitectureType targetArch = getTargetArchitecture();
        if (targetArch != null) {
            List<Cluster> filteredClusters = AsyncDataProvider.getInstance().filterByArchitecture(clusters, targetArch);
            getCluster().setItems(filteredClusters);
            getCluster().setSelectedItem(Linq.firstOrNull(filteredClusters));
        } else {
            getCluster().setItems(clusters);
            getCluster().setSelectedItem(Linq.firstOrNull(clusters));
        }
        // get storage domains
        AsyncDataProvider.getInstance().getStorageDomainList(new AsyncQuery<>(storageDomains -> {
            // filter storage domains
            filteredStorageDomains = new ArrayList<>();
            for (StorageDomain domain : storageDomains) {
                if (Linq.isDataActiveStorageDomain(domain)) {
                    filteredStorageDomains.add(domain);
                }
            }
            if (getClusterQuota().getIsAvailable()) {
                initQuotaForStorageDomains();
            } else {
                initDisksStorageDomainsList();
            }
        }), getStoragePool().getId());
    }), dataCenter.getId(), true, false);
}
Also used : NotEmptyValidation(org.ovirt.engine.ui.uicommonweb.validation.NotEmptyValidation) StoragePool(org.ovirt.engine.core.common.businessentities.StoragePool) QueryType(org.ovirt.engine.core.common.queries.QueryType) GetAllFromExportDomainQueryParameters(org.ovirt.engine.core.common.queries.GetAllFromExportDomainQueryParameters) ArchitectureType(org.ovirt.engine.core.common.businessentities.ArchitectureType) Guid(org.ovirt.engine.core.compat.Guid) Inject(com.google.inject.Inject) StorageDomain(org.ovirt.engine.core.common.businessentities.StorageDomain) HashMap(java.util.HashMap) SearchableListModel(org.ovirt.engine.ui.uicommonweb.models.SearchableListModel) ActionParametersBase(org.ovirt.engine.core.common.action.ActionParametersBase) DiskImage(org.ovirt.engine.core.common.businessentities.storage.DiskImage) IdQueryParameters(org.ovirt.engine.core.common.queries.IdQueryParameters) QuotaEnforcementTypeEnum(org.ovirt.engine.core.common.businessentities.QuotaEnforcementTypeEnum) IFrontendMultipleActionAsyncCallback(org.ovirt.engine.ui.uicompat.IFrontendMultipleActionAsyncCallback) ArrayList(java.util.ArrayList) AsyncCallback(org.ovirt.engine.ui.frontend.AsyncCallback) EntityModel(org.ovirt.engine.ui.uicommonweb.models.EntityModel) HashSet(java.util.HashSet) ActionType(org.ovirt.engine.core.common.action.ActionType) CpuProfile(org.ovirt.engine.core.common.businessentities.profiles.CpuProfile) Frontend(org.ovirt.engine.ui.frontend.Frontend) QuotaListModel(org.ovirt.engine.ui.uicommonweb.models.quota.QuotaListModel) Map(java.util.Map) ConstantsManager(org.ovirt.engine.ui.uicompat.ConstantsManager) VolumeFormat(org.ovirt.engine.core.common.businessentities.storage.VolumeFormat) AsyncDataProvider(org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider) ClusterListModel(org.ovirt.engine.ui.uicommonweb.models.clusters.ClusterListModel) QueryParametersBase(org.ovirt.engine.core.common.queries.QueryParametersBase) QueryReturnValue(org.ovirt.engine.core.common.queries.QueryReturnValue) Linq(org.ovirt.engine.ui.uicommonweb.Linq) IValidation(org.ovirt.engine.ui.uicommonweb.validation.IValidation) Collection(java.util.Collection) VmTemplate(org.ovirt.engine.core.common.businessentities.VmTemplate) Set(java.util.Set) Disk(org.ovirt.engine.core.common.businessentities.storage.Disk) VolumeType(org.ovirt.engine.core.common.businessentities.storage.VolumeType) Quota(org.ovirt.engine.core.common.businessentities.Quota) ImportVmParameters(org.ovirt.engine.core.common.action.ImportVmParameters) List(java.util.List) VM(org.ovirt.engine.core.common.businessentities.VM) Cluster(org.ovirt.engine.core.common.businessentities.Cluster) Entry(java.util.Map.Entry) PropertyChangedEventArgs(org.ovirt.engine.ui.uicompat.PropertyChangedEventArgs) ArchitectureType(org.ovirt.engine.core.common.businessentities.ArchitectureType) StorageDomain(org.ovirt.engine.core.common.businessentities.StorageDomain) StoragePool(org.ovirt.engine.core.common.businessentities.StoragePool) ArrayList(java.util.ArrayList) List(java.util.List)

Example 4 with ArchitectureType

use of org.ovirt.engine.core.common.businessentities.ArchitectureType in project ovirt-engine by oVirt.

the class ImportVmFromExternalProviderModel method initClusterAndStorage.

private void initClusterAndStorage(StoragePool dataCenter) {
    AsyncDataProvider.getInstance().getClusterByServiceList(new AsyncQuery<>(clusters -> {
        ArchitectureType targetArch = getTargetArchitecture();
        if (targetArch != null) {
            clusters = AsyncDataProvider.getInstance().filterByArchitecture(clusters, targetArch);
        }
        getCluster().setItems(clusters);
        getCluster().setSelectedItem(Linq.firstOrNull(clusters));
        // get storage domains
        AsyncDataProvider.getInstance().getStorageDomainList(new AsyncQuery<>(storageDomains -> {
            // filter storage domains
            List<StorageDomain> filteredStorageDomains = new ArrayList<>();
            for (StorageDomain domain : storageDomains) {
                if (Linq.isDataActiveStorageDomain(domain)) {
                    filteredStorageDomains.add(domain);
                }
            }
            getStorage().setItems(filteredStorageDomains);
            if (getClusterQuota().getIsAvailable()) {
                initQuotaForStorageDomains();
            } else {
                initDisksStorageDomainsList();
            }
        }), getStoragePool().getId());
    }), dataCenter.getId(), true, false);
}
Also used : StoragePool(org.ovirt.engine.core.common.businessentities.StoragePool) QueryType(org.ovirt.engine.core.common.queries.QueryType) Arrays(java.util.Arrays) ArchitectureType(org.ovirt.engine.core.common.businessentities.ArchitectureType) Guid(org.ovirt.engine.core.compat.Guid) StorageDomain(org.ovirt.engine.core.common.businessentities.StorageDomain) HashMap(java.util.HashMap) ImagesDataProvider(org.ovirt.engine.ui.uicommonweb.dataprovider.ImagesDataProvider) SearchableListModel(org.ovirt.engine.ui.uicommonweb.models.SearchableListModel) DiskImage(org.ovirt.engine.core.common.businessentities.storage.DiskImage) IdQueryParameters(org.ovirt.engine.core.common.queries.IdQueryParameters) QuotaEnforcementTypeEnum(org.ovirt.engine.core.common.businessentities.QuotaEnforcementTypeEnum) ArrayList(java.util.ArrayList) AsyncCallback(org.ovirt.engine.ui.frontend.AsyncCallback) EntityModel(org.ovirt.engine.ui.uicommonweb.models.EntityModel) Frontend(org.ovirt.engine.ui.frontend.Frontend) OriginType(org.ovirt.engine.core.common.businessentities.OriginType) QuotaListModel(org.ovirt.engine.ui.uicommonweb.models.quota.QuotaListModel) Map(java.util.Map) ConstantsManager(org.ovirt.engine.ui.uicompat.ConstantsManager) AsyncDataProvider(org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider) ClusterListModel(org.ovirt.engine.ui.uicommonweb.models.clusters.ClusterListModel) QueryParametersBase(org.ovirt.engine.core.common.queries.QueryParametersBase) QueryReturnValue(org.ovirt.engine.core.common.queries.QueryReturnValue) Iterator(java.util.Iterator) Linq(org.ovirt.engine.ui.uicommonweb.Linq) VmNetworkInterface(org.ovirt.engine.core.common.businessentities.network.VmNetworkInterface) UICommand(org.ovirt.engine.ui.uicommonweb.UICommand) ListModel(org.ovirt.engine.ui.uicommonweb.models.ListModel) Disk(org.ovirt.engine.core.common.businessentities.storage.Disk) VolumeType(org.ovirt.engine.core.common.businessentities.storage.VolumeType) Quota(org.ovirt.engine.core.common.businessentities.Quota) Objects(java.util.Objects) List(java.util.List) VM(org.ovirt.engine.core.common.businessentities.VM) RepoImage(org.ovirt.engine.core.common.businessentities.storage.RepoImage) VnicProfileView(org.ovirt.engine.core.common.businessentities.network.VnicProfileView) PropertyChangedEventArgs(org.ovirt.engine.ui.uicompat.PropertyChangedEventArgs) ArchitectureType(org.ovirt.engine.core.common.businessentities.ArchitectureType) StorageDomain(org.ovirt.engine.core.common.businessentities.StorageDomain) ArrayList(java.util.ArrayList)

Example 5 with ArchitectureType

use of org.ovirt.engine.core.common.businessentities.ArchitectureType in project ovirt-engine by oVirt.

the class UnitVmModel method validateMemoryAlignment.

private void validateMemoryAlignment(EntityModel<Integer> model) {
    if (!model.getIsValid()) {
        return;
    }
    int memSize = model.getEntity();
    DataCenterWithCluster dataCenterWithCluster = getDataCenterWithClustersList().getSelectedItem();
    if (dataCenterWithCluster == null) {
        return;
    }
    Cluster cluster = dataCenterWithCluster.getCluster();
    ArchitectureType architectureFamily = cluster.getArchitecture().getFamily();
    if (architectureFamily == ArchitectureType.ppc && memSize % 256 != 0) {
        model.getInvalidityReasons().add(ConstantsManager.getInstance().getMessages().memSizeMultipleOf(architectureFamily.toString(), 256));
        model.setIsValid(false);
    }
}
Also used : ArchitectureType(org.ovirt.engine.core.common.businessentities.ArchitectureType) Cluster(org.ovirt.engine.core.common.businessentities.Cluster)

Aggregations

ArchitectureType (org.ovirt.engine.core.common.businessentities.ArchitectureType)18 HashMap (java.util.HashMap)5 ServerCpu (org.ovirt.engine.core.common.businessentities.ServerCpu)4 Guid (org.ovirt.engine.core.compat.Guid)4 ArrayList (java.util.ArrayList)3 HashSet (java.util.HashSet)3 List (java.util.List)3 Map (java.util.Map)3 Cluster (org.ovirt.engine.core.common.businessentities.Cluster)3 QueryParametersBase (org.ovirt.engine.core.common.queries.QueryParametersBase)3 QueryReturnValue (org.ovirt.engine.core.common.queries.QueryReturnValue)3 Linq (org.ovirt.engine.ui.uicommonweb.Linq)3 AsyncDataProvider (org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider)3 Quota (org.ovirt.engine.core.common.businessentities.Quota)2 QuotaEnforcementTypeEnum (org.ovirt.engine.core.common.businessentities.QuotaEnforcementTypeEnum)2 StorageDomain (org.ovirt.engine.core.common.businessentities.StorageDomain)2 StoragePool (org.ovirt.engine.core.common.businessentities.StoragePool)2 VM (org.ovirt.engine.core.common.businessentities.VM)2 Disk (org.ovirt.engine.core.common.businessentities.storage.Disk)2 DiskImage (org.ovirt.engine.core.common.businessentities.storage.DiskImage)2