use of org.ovirt.engine.core.common.businessentities.VDS in project ovirt-engine by oVirt.
the class HostListModel method updateHaMaintenanceAvailability.
private void updateHaMaintenanceAvailability() {
VDS vds = getSelectedItem();
boolean singleVdsSelected = singleHostSelected(getSelectedItems());
boolean haConfigured = vds != null && vds.getHighlyAvailableIsConfigured();
boolean inGlobalMaintenance = vds != null && vds.getHighlyAvailableGlobalMaintenance();
getEnableGlobalHaMaintenanceCommand().setIsExecutionAllowed(!inGlobalMaintenance && haConfigured && singleVdsSelected);
getDisableGlobalHaMaintenanceCommand().setIsExecutionAllowed(inGlobalMaintenance && haConfigured && singleVdsSelected);
}
use of org.ovirt.engine.core.common.businessentities.VDS in project ovirt-engine by oVirt.
the class HostListModel method maintenance.
private void maintenance(boolean isMaintenanceReasonVisible, boolean supportsGlusterService) {
if (getConfirmWindow() != null) {
return;
}
HostMaintenanceConfirmationModel model = new HostMaintenanceConfirmationModel();
setConfirmWindow(model);
model.setTitle(ConstantsManager.getInstance().getConstants().maintenanceHostsTitle());
model.setHelpTag(HelpTag.maintenance_host);
// $NON-NLS-1$
model.setHashName("maintenance_host");
model.setMessage(ConstantsManager.getInstance().getConstants().areYouSureYouWantToPlaceFollowingHostsIntoMaintenanceModeMsg());
model.setReasonVisible(isMaintenanceReasonVisible);
if (supportsGlusterService) {
model.getStopGlusterServices().setIsAvailable(true);
model.getStopGlusterServices().setEntity(false);
model.getForce().setIsAvailable(true);
model.getForce().setEntity(false);
model.setForceLabel(ConstantsManager.getInstance().getConstants().ignoreGlusterQuorumChecks());
}
// model.Items = SelectedItems.Cast<VDS>().Select(a => a.vds_name);
ArrayList<String> vdss = new ArrayList<>();
for (Object item : getSelectedItems()) {
VDS vds = (VDS) item;
vdss.add(vds.getName());
}
model.setItems(vdss);
// $NON-NLS-1$
UICommand tempVar = UICommand.createDefaultOkUiCommand("OnMaintenance", this);
model.getCommands().add(tempVar);
// $NON-NLS-1$
UICommand tempVar2 = UICommand.createCancelUiCommand("CancelConfirm", this);
model.getCommands().add(tempVar2);
}
use of org.ovirt.engine.core.common.businessentities.VDS in project ovirt-engine by oVirt.
the class HostListModel method refreshCapabilities.
private void refreshCapabilities() {
ArrayList<ActionParametersBase> list = new ArrayList<>();
for (Object item : getSelectedItems()) {
VDS vds = (VDS) item;
list.add(new VdsActionParameters(vds.getId()));
}
Frontend.getInstance().runMultipleAction(ActionType.RefreshHost, list, result -> {
}, null);
}
use of org.ovirt.engine.core.common.businessentities.VDS in project ovirt-engine by oVirt.
the class HostListModel method remove.
public void remove() {
if (getWindow() != null) {
return;
}
final ConfirmationModel model = new ConfirmationModel();
setWindow(model);
model.setTitle(ConstantsManager.getInstance().getConstants().removeHostsTitle());
model.setHelpTag(HelpTag.remove_host);
// $NON-NLS-1$
model.setHashName("remove_host");
Set<Guid> clusters = new HashSet<>();
ArrayList<String> list = new ArrayList<>();
boolean heOnHosts = false;
for (VDS item : getSelectedItems()) {
clusters.add(item.getClusterId());
String name = item.getName();
if (item.isHostedEngineDeployed()) {
// $NON-NLS-1$
name = name + " *";
heOnHosts = true;
}
list.add(name);
}
model.setItems(list);
if (heOnHosts) {
model.setNote(ConstantsManager.getInstance().getConstants().heHostRemovalWarning());
}
// - the cluster should have gluster service enabled
if (clusters.size() == 1) {
model.startProgress();
AsyncDataProvider.getInstance().getClusterById(new AsyncQuery<>(cluster -> {
if (cluster != null && cluster.supportsGlusterService()) {
model.getForce().setIsAvailable(true);
}
model.stopProgress();
}), clusters.iterator().next());
}
// $NON-NLS-1$
UICommand tempVar = UICommand.createDefaultOkUiCommand("OnRemove", this);
model.getCommands().add(tempVar);
// $NON-NLS-1$
UICommand tempVar2 = UICommand.createCancelUiCommand("Cancel", this);
model.getCommands().add(tempVar2);
}
use of org.ovirt.engine.core.common.businessentities.VDS in project ovirt-engine by oVirt.
the class HostListModel method getAttachedTagsToSelectedHosts.
private void getAttachedTagsToSelectedHosts(final TagListModel model) {
ArrayList<Guid> hostIds = new ArrayList<>();
for (VDS vds : getSelectedItems()) {
hostIds.add(vds.getId());
}
attachedTagsToEntities = new HashMap<>();
allAttachedTags = new ArrayList<>();
selectedItemsCounter = 0;
for (Guid hostId : hostIds) {
AsyncDataProvider.getInstance().getAttachedTagsToHost(new AsyncQuery<>(returnValue -> {
allAttachedTags.addAll(returnValue);
selectedItemsCounter++;
if (selectedItemsCounter == getSelectedItems().size()) {
postGetAttachedTags(model);
}
}), hostId);
}
}
Aggregations