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