use of org.ovirt.engine.core.common.businessentities.Cluster in project ovirt-engine by oVirt.
the class ClusterListModel method checkForNonResponsiveHosts.
/**
* Checks if in selected cluster are some non responsive hosts. If so, it adds warning about upgrading cluster level
* when some hosts are non responsive
*/
@SuppressWarnings("unchecked")
private void checkForNonResponsiveHosts(final ConfirmationModel confirmModel) {
startProgress();
Frontend.getInstance().runQuery(QueryType.GetHostsByClusterId, new IdQueryParameters(getSelectedItem().getId()), new AsyncQuery<>(returnValue -> {
List<VDS> hosts = null;
if (returnValue instanceof List) {
hosts = (List<VDS>) returnValue;
} else if (returnValue instanceof QueryReturnValue && ((QueryReturnValue) returnValue).getReturnValue() instanceof List) {
hosts = ((QueryReturnValue) returnValue).getReturnValue();
}
boolean foundNRHosts = false;
if (hosts != null) {
for (VDS host : hosts) {
if (VDSStatus.NonResponsive == host.getStatus()) {
foundNRHosts = true;
break;
}
}
}
String existingMsg = confirmModel.getMessage() == null ? "" : confirmModel.getMessage();
if (foundNRHosts) {
confirmModel.setMessage(existingMsg + constants.youAreAboutChangeClusterCompatibilityVersionNonResponsiveHostsMsg());
} else {
confirmModel.setMessage(existingMsg + constants.youAreAboutChangeClusterCompatibilityVersionMsg());
}
stopProgress();
}));
}
use of org.ovirt.engine.core.common.businessentities.Cluster in project ovirt-engine by oVirt.
the class ClusterListModel method onSaveConfirmGenericWarnings.
private void onSaveConfirmGenericWarnings() {
ClusterModel model = (ClusterModel) getWindow();
cancelConfirmation();
Cluster cluster = buildCluster(model, model.getIsNew() ? new Cluster() : (Cluster) Cloner.clone(getSelectedItem()));
AsyncDataProvider.getInstance().getClusterEditWarnings(new AsyncQuery<>(warnings -> {
if (!warnings.isEmpty()) {
ClusterWarningsModel confirmWindow = new ClusterWarningsModel();
confirmWindow.init(warnings);
// $NON-NLS-1$
confirmWindow.getCommands().add(UICommand.createDefaultOkUiCommand("OnSaveInternal", ClusterListModel.this));
// $NON-NLS-1$
confirmWindow.getCommands().add(UICommand.createCancelUiCommand("CancelConfirmation", ClusterListModel.this));
setConfirmWindow(confirmWindow);
} else {
onSaveInternal();
}
}), model.getClusterId(), cluster);
}
use of org.ovirt.engine.core.common.businessentities.Cluster in project ovirt-engine by oVirt.
the class ClusterListModel method updateDetailsAvailability.
@Override
protected void updateDetailsAvailability() {
super.updateDetailsAvailability();
Cluster cluster = getSelectedItem();
boolean clusterSupportsVirtService = cluster != null && cluster.supportsVirtService();
boolean clusterSupportsGlusterService = cluster != null && cluster.supportsGlusterService();
getVmListModel().setIsAvailable(clusterSupportsVirtService);
getServiceModel().setIsAvailable(clusterSupportsGlusterService);
getGlusterHookListModel().setIsAvailable(clusterSupportsGlusterService);
getAffinityGroupListModel().setIsAvailable(clusterSupportsVirtService);
getCpuProfileListModel().setIsAvailable(clusterSupportsVirtService);
getAffinityLabelListModel().setIsAvailable(clusterSupportsVirtService);
}
use of org.ovirt.engine.core.common.businessentities.Cluster in project ovirt-engine by oVirt.
the class ClusterModel method storagePool_SelectedItemChanged.
private void storagePool_SelectedItemChanged() {
// possible versions for new cluster (when editing cluster, this event won't occur)
// are actually the possible versions for the data-center that the cluster is going
// to be attached to.
final StoragePool selectedDataCenter = getDataCenter().getSelectedItem();
if (selectedDataCenter == null) {
getManagementNetwork().setItems(Collections.emptyList());
return;
}
if (selectedDataCenter.isLocal()) {
setMigrationTabAvailable(false);
} else {
setMigrationTabAvailable(true);
}
AsyncDataProvider.getInstance().getDataCenterVersions(new AsyncQuery<>(new AsyncCallback<List<Version>>() {
@Override
public void onSuccess(List<Version> versions) {
Version versionToSelect = calculateNewVersionWhichShouldBeSelected(versions);
getVersion().setItems(versions, versionToSelect);
}
private Version calculateNewVersionWhichShouldBeSelected(List<Version> versions) {
ListModel<Version> version = getVersion();
Version selectedVersion = version.getSelectedItem();
if (!getIsEdit() && (selectedVersion == null || !versions.contains(selectedVersion) || selectedVersion.compareTo(selectedDataCenter.getCompatibilityVersion()) > 0)) {
if (ApplicationModeHelper.getUiMode().equals(ApplicationMode.GlusterOnly)) {
return versions.stream().max(Comparator.naturalOrder()).orElse(null);
} else {
return selectedDataCenter.getCompatibilityVersion();
}
} else if (getIsEdit()) {
return Linq.firstOrNull(versions, x -> x.equals(getEntity().getCompatibilityVersion()));
} else {
return selectedVersion;
}
}
}), ApplicationModeHelper.getUiMode().equals(ApplicationMode.GlusterOnly) ? null : selectedDataCenter.getId());
if (getManagementNetwork().getIsChangable()) {
loadDcNetworks(selectedDataCenter.getId());
}
}
use of org.ovirt.engine.core.common.businessentities.Cluster in project ovirt-engine by oVirt.
the class ClusterGeneralModel method updateProperties.
private void updateProperties() {
Cluster cluster = getEntity();
setName(cluster.getName());
setDescription(cluster.getDescription());
setCpuType(cluster.getCpuName());
setDataCenterName(cluster.getStoragePoolName());
setMemoryOverCommit(cluster.getMaxVdsMemoryOverCommit());
setCpuThreads(cluster.getCountThreadsAsCores());
setResiliencePolicy(cluster.getMigrateOnError());
setEmulatedMachine(cluster.getEmulatedMachine());
setCompatibilityVersion(cluster.getCompatibilityVersion().getValue());
generateClusterType(cluster.supportsGlusterService(), cluster.supportsVirtService());
AsyncDataProvider.getInstance().getNumberOfVmsInCluster(new AsyncQuery<>((QueryReturnValue returnValue) -> setNumberOfVms((Integer) returnValue.getReturnValue())), cluster.getId());
}
Aggregations