Search in sources :

Example 16 with ArchitectureType

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

the class OsTypeMockUtils method mockOsTypes.

public static void mockOsTypes() {
    OsRepository osRepositoryMock = mock(OsRepository.class);
    HashMap<Integer, String> osNames = new HashMap<>(1);
    osNames.put(0, "Unassigned");
    when(osRepositoryMock.getUniqueOsNames()).thenReturn(osNames);
    HashMap<ArchitectureType, Integer> defaultOSes = new HashMap<>();
    defaultOSes.put(ArchitectureType.x86_64, 0);
    when(osRepositoryMock.getDefaultOSes()).thenReturn(defaultOSes);
    SimpleDependencyInjector.getInstance().bind(OsRepository.class, osRepositoryMock);
}
Also used : ArchitectureType(org.ovirt.engine.core.common.businessentities.ArchitectureType) HashMap(java.util.HashMap) OsRepository(org.ovirt.engine.core.common.osinfo.OsRepository)

Example 17 with ArchitectureType

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

the class ImportVmsModel method initDataCenterCpuArchitectureMap.

private void initDataCenterCpuArchitectureMap() {
    final AsyncQuery<QueryReturnValue> callback = new AsyncQuery<>(new AsyncCallback<QueryReturnValue>() {

        @Override
        public void onSuccess(QueryReturnValue returnValue) {
            List<Cluster> allClusters = returnValue.getReturnValue();
            clusterArchitecturesInDataCenters = new HashMap<>();
            for (Cluster cluster : allClusters) {
                if (cluster.supportsVirtService() && cluster.getArchitecture() != null) {
                    addArchitecture(cluster.getStoragePoolId(), cluster.getArchitecture());
                }
            }
        }

        private void addArchitecture(Guid dataCenterId, ArchitectureType architecture) {
            Set<ArchitectureType> architectures = clusterArchitecturesInDataCenters.get(dataCenterId);
            if (architectures == null) {
                architectures = new HashSet<>();
                clusterArchitecturesInDataCenters.put(dataCenterId, architectures);
            }
            architectures.add(architecture);
        }
    });
    Frontend.getInstance().runQuery(QueryType.GetAllClusters, new QueryParametersBase(), callback);
}
Also used : ArchitectureType(org.ovirt.engine.core.common.businessentities.ArchitectureType) Set(java.util.Set) HashSet(java.util.HashSet) HashMap(java.util.HashMap) Cluster(org.ovirt.engine.core.common.businessentities.Cluster) Guid(org.ovirt.engine.core.compat.Guid) QueryReturnValue(org.ovirt.engine.core.common.queries.QueryReturnValue) QueryParametersBase(org.ovirt.engine.core.common.queries.QueryParametersBase) List(java.util.List) ArrayList(java.util.ArrayList) HashSet(java.util.HashSet)

Example 18 with ArchitectureType

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

the class RegisterTemplatePopupView method createEntityTable.

@Override
protected void createEntityTable(RegisterTemplateModel model) {
    AbstractTextColumn<Object> nameColumn = new AbstractTextColumn<Object>() {

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

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

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

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

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

        @Override
        public String getValue(Object object) {
            int numOfDisks = getEntity(object).getDiskTemplateMap().size();
            return String.valueOf(numOfDisks);
        }
    };
    // $NON-NLS-1$
    entityTable.addColumn(diskColumn, constants.disksVm(), "50px");
    // $NON-NLS-1$
    entityTable.addColumn(getClusterColumn(), constants.clusterVm(), "150px");
    if (model.isQuotaEnabled()) {
        // $NON-NLS-1$
        entityTable.addColumn(getClusterQuotaColumn(), constants.quotaVm(), "150px");
    }
}
Also used : AbstractEnumColumn(org.ovirt.engine.ui.common.widget.table.column.AbstractEnumColumn) ArchitectureType(org.ovirt.engine.core.common.businessentities.ArchitectureType) AbstractTextColumn(org.ovirt.engine.ui.common.widget.table.column.AbstractTextColumn)

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