use of org.ovirt.engine.core.common.action.VdsActionParameters in project ovirt-engine by oVirt.
the class HostListModel method onSshRestart.
public void onSshRestart() {
ConfirmationModel model = (ConfirmationModel) getConfirmWindow();
if (model.getProgress() != null) {
return;
}
ArrayList<ActionParametersBase> list = new ArrayList<>();
for (Object item : getSelectedItems()) {
VDS vds = (VDS) item;
VdsActionParameters params = new VdsActionParameters(vds.getId());
params.setPrevVdsStatus(vds.getStatus());
list.add(params);
}
model.startProgress();
Frontend.getInstance().runMultipleAction(ActionType.SshHostReboot, list, result -> {
ConfirmationModel localModel = (ConfirmationModel) result.getState();
localModel.stopProgress();
cancelConfirm();
}, model);
}
use of org.ovirt.engine.core.common.action.VdsActionParameters 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.action.VdsActionParameters in project ovirt-engine by oVirt.
the class DataCenterGuideModel method onSelectHost.
public void onSelectHost() {
MoveHost model = (MoveHost) getWindow();
if (model.getProgress() != null) {
return;
}
if (!model.validate()) {
return;
}
model.setSelectedHosts(new ArrayList<MoveHostData>());
for (MoveHostData a : model.getItems()) {
if (a.getIsSelected()) {
model.getSelectedHosts().add(a);
}
}
Cluster cluster = model.getCluster().getSelectedItem();
final List<ActionParametersBase> parameterList = new ArrayList<>();
for (MoveHostData hostData : model.getSelectedHosts()) {
VDS host = hostData.getEntity();
// Try to change host's cluster as neccessary.
if (host.getClusterId() != null && !host.getClusterId().equals(cluster.getId())) {
parameterList.add(new ChangeVDSClusterParameters(cluster.getId(), host.getId()));
}
}
model.startProgress();
Frontend.getInstance().runMultipleAction(ActionType.ChangeVDSCluster, parameterList, new IFrontendMultipleActionAsyncCallback() {
@Override
public void executed(FrontendMultipleActionAsyncResult result) {
final DataCenterGuideModel dataCenterGuideModel = (DataCenterGuideModel) result.getState();
List<MoveHostData> hosts = ((MoveHost) dataCenterGuideModel.getWindow()).getSelectedHosts();
List<ActionReturnValue> retVals = result.getReturnValue();
final List<ActionParametersBase> activateVdsParameterList = new ArrayList<>();
if (retVals != null && hosts.size() == retVals.size()) {
int i = 0;
for (MoveHostData selectedHostData : hosts) {
VDS selectedHost = selectedHostData.getEntity();
if (selectedHost.getStatus() == VDSStatus.PendingApproval && retVals.get(i) != null && retVals.get(i).getSucceeded()) {
Frontend.getInstance().runAction(ActionType.ApproveVds, new ApproveVdsParameters(selectedHost.getId()), null, this);
} else if (selectedHostData.getActivateHost()) {
activateVdsParameterList.add(new VdsActionParameters(selectedHostData.getEntity().getId()));
}
i++;
}
}
if (activateVdsParameterList.isEmpty()) {
dataCenterGuideModel.getWindow().stopProgress();
dataCenterGuideModel.cancel();
dataCenterGuideModel.postAction();
} else {
final String searchString = getVdsSearchString((MoveHost) dataCenterGuideModel.getWindow());
Timer timer = new Timer() {
public void run() {
checkVdsClusterChangeSucceeded(searchString, parameterList, activateVdsParameterList);
}
};
timer.schedule(2000);
}
}
}, this);
}
use of org.ovirt.engine.core.common.action.VdsActionParameters in project ovirt-engine by oVirt.
the class UpdateClusterCommand method executeCommand.
@Override
protected void executeCommand() {
Guid newMacPoolId = getNewMacPoolId();
moveMacs.migrateMacsToAnotherMacPool(oldCluster, newMacPoolId, getContext());
getCluster().setArchitecture(getArchitecture());
setDefaultSwitchTypeIfNeeded();
setDefaultFirewallTypeIfNeeded();
// TODO: This code should be revisited and proper compensation logic should be introduced here
checkMaxMemoryOverCommitValue();
if (!Objects.equals(oldCluster.getCompatibilityVersion(), getParameters().getCluster().getCompatibilityVersion())) {
String emulatedMachine = null;
// pick an UP host randomly - all should have latest compat version already if we passed validate.
for (VDS vds : allForCluster) {
if (vds.getStatus() == VDSStatus.Up) {
emulatedMachine = getEmulatedMachineOfHostInCluster(vds);
break;
}
}
if (emulatedMachine == null) {
getParameters().getCluster().setDetectEmulatedMachine(true);
} else {
getParameters().getCluster().setEmulatedMachine(emulatedMachine);
}
} else if (oldCluster.getArchitecture() != getCluster().getArchitecture()) {
// if architecture was changed, emulated machines must be updated when adding new host.
// At this point the cluster is empty and have changed CPU name
getParameters().getCluster().setDetectEmulatedMachine(true);
getParameters().getCluster().setEmulatedMachine(null);
}
if (getParameters().isForceResetEmulatedMachine()) {
getParameters().getCluster().setDetectEmulatedMachine(true);
}
boolean isKsmPolicyChanged = (getCluster().isKsmMergeAcrossNumaNodes() != getPrevCluster().isKsmMergeAcrossNumaNodes()) || (getCluster().isEnableKsm() != getPrevCluster().isEnableKsm());
clusterDao.update(getParameters().getCluster());
addOrUpdateAddtionalClusterFeatures();
if (!oldCluster.supportsGlusterService() && getCluster().supportsGlusterService()) {
// update gluster parameters on all hosts
updateGlusterHosts();
}
if (isAddedToStoragePool) {
for (VDS vds : allForCluster) {
VdsActionParameters parameters = new VdsActionParameters();
parameters.setVdsId(vds.getId());
ActionReturnValue addVdsSpmIdReturn = runInternalAction(ActionType.AddVdsSpmId, parameters, cloneContextAndDetachFromParent());
if (!addVdsSpmIdReturn.getSucceeded()) {
setSucceeded(false);
getReturnValue().setFault(addVdsSpmIdReturn.getFault());
return;
}
}
final NetworkCluster managementNetworkCluster = createManagementNetworkCluster();
networkClusterDao.save(managementNetworkCluster);
}
alertIfFencingDisabled();
if (isKsmPolicyChanged) {
momPolicyUpdatedEvent.fire(getCluster());
}
updateDefaultNetworkProvider();
// Call UpdateVmCommand on all VMs in the cluster to update defaults (i.e. DisplayType)
updateVms();
updateTemplates();
if (getCluster().getFirewallType() != getPrevCluster().getFirewallType()) {
markHostsForReinstall();
}
if (!failedUpgradeEntities.isEmpty()) {
logFailedUpgrades();
failValidation(Arrays.asList(EngineMessage.CLUSTER_CANNOT_UPDATE_CLUSTER_FAILED_TO_UPDATE_VMS), "$VmList " + StringUtils.join(failedUpgradeEntities.keySet(), ", "));
getReturnValue().setValid(false);
setSucceeded(false);
return;
}
if (!Objects.equals(oldCluster.getCompatibilityVersion(), getCluster().getCompatibilityVersion())) {
vmStaticDao.getAllByCluster(getCluster().getId()).forEach(this::updateClusterVersionInManager);
}
setSucceeded(true);
}
use of org.ovirt.engine.core.common.action.VdsActionParameters in project ovirt-engine by oVirt.
the class AutoRecoveryManager method recoverImpl.
public void recoverImpl() {
check(vdsDao, ActionType.ActivateVds, arg -> {
final VdsActionParameters params = new VdsActionParameters(arg.getId());
params.setRunSilent(true);
return params;
}, list -> {
List<VDS> filtered = new ArrayList<>(list.size());
List<VdsNetworkInterface> nics;
for (VDS vds : list) {
if (vds.getNonOperationalReason() == NonOperationalReason.NETWORK_INTERFACE_IS_DOWN) {
backend.getResourceManager().runVdsCommand(VDSCommandType.GetStats, new VdsIdAndVdsVDSCommandParametersBase(vds));
nics = vds.getInterfaces();
} else {
nics = interfaceDao.getAllInterfacesForVds(vds.getId());
}
Map<String, Set<String>> problematicNics = NetworkMonitoringHelper.determineProblematicNics(nics, networkDao.getAllForCluster(vds.getClusterId()));
if (problematicNics.isEmpty()) {
filtered.add(vds);
}
}
return filtered;
}, "hosts");
check(storageDomainDao, ActionType.ConnectDomainToStorage, arg -> {
final StorageDomainPoolParametersBase params = new StorageDomainPoolParametersBase(arg.getId(), arg.getStoragePoolId());
params.setRunSilent(true);
return params;
}, list -> list, "storage domains");
}
Aggregations