use of org.ovirt.engine.core.common.action.MaintenanceVdsParameters in project ovirt-engine by oVirt.
the class HostMaintenanceCallback method evaluateMaintenanceHostCommandProgress.
/**
* Evaluates the host status in regards to maintenance status: The host must move to {@code VDSStatus.Maintenance}
* in order to stop gluster service
*
* @param maintenanceCommand
* The root command
*/
private void evaluateMaintenanceHostCommandProgress(MaintenanceVdsCommand<MaintenanceVdsParameters> maintenanceCommand) {
MaintenanceVdsParameters parameters = maintenanceCommand.getParameters();
VdsDynamic host = vdsDynamicDao.get(parameters.getVdsId());
switch(host.getStatus()) {
// Wait till moving to maintenance ends
case PreparingForMaintenance:
break;
// Stop Gluster processes
case Maintenance:
log.info("Host '{}' is on maintenance mode. Stoping all gluster services.", getHostName(parameters.getVdsId()));
stopGlusterServices(parameters.getVdsId());
maintenanceCommand.setCommandStatus(CommandStatus.SUCCEEDED);
break;
// Any other status implies maintenance action failed, and the callback cannot proceed with stopping gluster's services
default:
if (isMaintenanceCommandExecuted(maintenanceCommand)) {
log.info("Host '{}' failed to move to maintenance mode. Could not stop Gluster services.", getHostName(parameters.getVdsId()));
maintenanceCommand.setCommandStatus(CommandStatus.FAILED);
}
break;
}
}
use of org.ovirt.engine.core.common.action.MaintenanceVdsParameters in project ovirt-engine by oVirt.
the class MaintenanceNumberOfVdssCommand method migrateAllVdss.
private void migrateAllVdss() {
for (Guid vdsId : vdssToMaintenance.keySet()) {
// ParametersCurrentUser = CurrentUser
MaintenanceVdsParameters tempVar = new MaintenanceVdsParameters(vdsId, getParameters().getIsInternal(), getParameters().isStopGlusterService());
tempVar.setSessionId(getParameters().getSessionId());
tempVar.setCorrelationId(getParameters().getCorrelationId());
ActionReturnValue result = runInternalAction(ActionType.MaintenanceVds, tempVar, ExecutionHandler.createInternalJobContext(getContext()));
if (!result.isValid()) {
getReturnValue().getValidationMessages().addAll(result.getValidationMessages());
getReturnValue().setValid(false);
}
}
}
Aggregations