use of org.ovirt.engine.core.common.businessentities.VDS in project ovirt-engine by oVirt.
the class HostListModel method upgrade.
public void upgrade() {
final VDS host = getSelectedItem();
Model model = createUpgradeModel(host);
setWindow(model);
model.initialize();
// $NON-NLS-1$
model.getCommands().add(UICommand.createCancelUiCommand("Cancel", this));
}
use of org.ovirt.engine.core.common.businessentities.VDS in project ovirt-engine by oVirt.
the class HostListModel method updateActionAvailability.
private void updateActionAvailability() {
List<VDS> items = getSelectedItems() != null ? getSelectedItems() : new ArrayList<VDS>();
boolean isAllPMEnabled = items.stream().allMatch(VDS::isPmEnabled);
getEditCommand().setIsExecutionAllowed(items.size() == 1 && ActionUtils.canExecute(items, VDS.class, ActionType.UpdateVds));
getEditWithPMemphasisCommand().setIsExecutionAllowed(items.size() == 1 && ActionUtils.canExecute(items, VDS.class, ActionType.UpdateVds));
getRemoveCommand().setIsExecutionAllowed(items.size() > 0 && ActionUtils.canExecute(items, VDS.class, ActionType.RemoveVds));
getActivateCommand().setIsExecutionAllowed(items.size() > 0 && ActionUtils.canExecute(items, VDS.class, ActionType.ActivateVds));
// or special case where its installation failed but its oVirt node
boolean approveAvailability = items.size() == 1 && (ActionUtils.canExecute(items, VDS.class, ActionType.ApproveVds) || (items.get(0).getStatus() == VDSStatus.InstallFailed && items.get(0).isOvirtVintageNode()));
getApproveCommand().setIsExecutionAllowed(approveAvailability);
boolean installAvailability = false;
if (singleHostSelected(items)) {
VDS host = items.get(0);
installAvailability = host.getStatus() == VDSStatus.InstallFailed || host.getStatus() == VDSStatus.Maintenance;
}
getInstallCommand().setIsExecutionAllowed(installAvailability);
boolean webConsoleAvailability = singleHostSelected(items);
getHostConsoleCommand().setIsExecutionAllowed(webConsoleAvailability);
boolean checkForUpgradeAvailability = false;
if (singleHostSelected(items)) {
VDS host = items.get(0);
checkForUpgradeAvailability = canCheckForHostUpgrade(host);
}
getCheckForUpgradeCommand().setIsExecutionAllowed(checkForUpgradeAvailability);
boolean upgradeAvailability = false;
if (singleHostSelected(items)) {
VDS host = items.get(0);
upgradeAvailability = canUpgradeHost(host);
}
getUpgradeCommand().setIsExecutionAllowed(upgradeAvailability);
getEnrollCertificateCommand().setIsExecutionAllowed(installAvailability);
getMaintenanceCommand().setIsExecutionAllowed(items.size() > 0 && ActionUtils.canExecute(items, VDS.class, ActionType.MaintenanceVds));
getSshRestartCommand().setIsExecutionAllowed(items.size() > 0 && ActionUtils.canExecute(items, VDS.class, ActionType.SshHostReboot));
getSshStopCommand().setIsExecutionAllowed(items.size() > 0 && ActionUtils.canExecute(items, VDS.class, ActionType.VdsPowerDown));
getRestartCommand().setIsExecutionAllowed(items.size() > 0 && ActionUtils.canExecute(items, VDS.class, ActionType.RestartVds) && isAllPMEnabled);
getStartCommand().setIsExecutionAllowed(items.size() > 0 && ActionUtils.canExecute(items, VDS.class, ActionType.StartVds) && isAllPMEnabled);
getStopCommand().setIsExecutionAllowed(items.size() > 0 && ActionUtils.canExecute(items, VDS.class, ActionType.StopVds) && isAllPMEnabled);
setIsPowerManagementEnabled(getRestartCommand().getIsExecutionAllowed() || getStartCommand().getIsExecutionAllowed() || getStopCommand().getIsExecutionAllowed());
getManualFenceCommand().setIsExecutionAllowed(items.size() == 1);
getAssignTagsCommand().setIsExecutionAllowed(items.size() > 0);
getSelectAsSpmCommand().setIsExecutionAllowed(isSelectAsSpmCommandAllowed(items));
updateConfigureLocalStorageCommandAvailability();
getRefreshCapabilitiesCommand().setIsExecutionAllowed(items.size() > 0 && ActionUtils.canExecute(items, VDS.class, ActionType.RefreshHostCapabilities));
boolean numaVisible = false;
if (getSelectedItem() != null) {
numaVisible = getSelectedItem().isNumaSupport();
}
getNumaSupportCommand().setIsVisible(numaVisible);
updateHaMaintenanceAvailability();
}
use of org.ovirt.engine.core.common.businessentities.VDS in project ovirt-engine by oVirt.
the class NetworkHostListModel method syncSearch.
@Override
protected void syncSearch() {
if (getEntity() == null) {
return;
}
final NetworkHostFilter filter = getViewFilterType();
AsyncQuery<QueryReturnValue> asyncQuery = new AsyncQuery<>(returnValue -> {
if (filter.equals(getViewFilterType())) {
final Iterable returnList = returnValue.getReturnValue();
if (NetworkHostFilter.unattached.equals(getViewFilterType())) {
final List<PairQueryable<VdsNetworkInterface, VDS>> items = new ArrayList<>();
for (Object obj : returnList) {
items.add(new PairQueryable<VdsNetworkInterface, VDS>(null, (VDS) obj));
}
setItems(items);
} else if (NetworkHostFilter.attached.equals(getViewFilterType())) {
initAttachedInterfaces((Collection<PairQueryable<VdsNetworkInterface, VDS>>) returnList);
}
}
});
IdQueryParameters params = new IdQueryParameters(getEntity().getId());
params.setRefresh(getIsQueryFirstTime());
if (NetworkHostFilter.unattached.equals(getViewFilterType())) {
Frontend.getInstance().runQuery(QueryType.GetVdsWithoutNetwork, params, asyncQuery);
} else if (NetworkHostFilter.attached.equals(getViewFilterType())) {
Frontend.getInstance().runQuery(QueryType.GetVdsAndNetworkInterfacesByNetworkId, params, asyncQuery);
}
setIsQueryFirstTime(false);
}
use of org.ovirt.engine.core.common.businessentities.VDS in project ovirt-engine by oVirt.
the class AddDataCenterRM method rollback3.
public void rollback3() {
Enlistment enlistment = context.enlistment;
EnlistmentContext enlistmentContext = (EnlistmentContext) enlistment.getContext();
HostListModel<?> model = enlistmentContext.getModel();
VDS host = context.hostFoundById;
boolean abort = false;
if (model.getSelectedItem() != null) {
// Perform rollback only when the host is in maintenance.
if (host.getStatus() != VDSStatus.Maintenance) {
abort = true;
}
} else {
abort = true;
}
if (abort) {
context.enlistment = null;
enlistment.done();
return;
}
StoragePool dataCenter = context.dataCenterFoundById;
// Perform rollback only when the Data Center is un uninitialized.
if (dataCenter.getStatus() != StoragePoolStatus.Uninitialized) {
context.enlistment = null;
enlistment.done();
return;
}
if (enlistmentContext.getOldClusterId() != null) {
// Switch host back to previous cluster.
Frontend.getInstance().runAction(ActionType.ChangeVDSCluster, new ChangeVDSClusterParameters(enlistmentContext.getOldClusterId(), host.getId()), result -> {
ActionReturnValue returnValue = result.getReturnValue();
context.changeVDSClusterReturnValue = returnValue;
rollback4();
});
} else {
context.enlistment = null;
enlistment.done();
}
}
use of org.ovirt.engine.core.common.businessentities.VDS in project ovirt-engine by oVirt.
the class AddDataCenterRM method rollback2.
public void rollback2() {
Enlistment enlistment = context.enlistment;
EnlistmentContext enlistmentContext = (EnlistmentContext) enlistment.getContext();
HostListModel<?> model = enlistmentContext.getModel();
VDS host = model.getSelectedItem();
// Retrieve host to make sure we have an updated status etc.
AsyncDataProvider.getInstance().getHostById(new AsyncQuery<>(returnValue -> {
context.hostFoundById = returnValue;
rollback3();
}), host.getId());
}
Aggregations