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);
}
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);
}
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");
}
}
Aggregations