Search in sources :

Example 1 with UpdateVdsVMsClearedVDSCommandParameters

use of org.ovirt.engine.core.common.vdscommands.UpdateVdsVMsClearedVDSCommandParameters in project ovirt-engine by oVirt.

the class VdsKdumpDetectionCommand method restartVdsVms.

private void restartVdsVms() {
    List<VM> vms = vmDao.getAllRunningForVds(getVdsId());
    if (!vms.isEmpty()) {
        RestartVdsVmsOperation restartVmsOper = new RestartVdsVmsOperation(getContext(), getVds());
        restartVmsOper.restartVms(vms);
        runVdsCommand(VDSCommandType.UpdateVdsVMsCleared, new UpdateVdsVMsClearedVDSCommandParameters(getVds().getId()));
    }
}
Also used : RestartVdsVmsOperation(org.ovirt.engine.core.bll.RestartVdsVmsOperation) VM(org.ovirt.engine.core.common.businessentities.VM) UpdateVdsVMsClearedVDSCommandParameters(org.ovirt.engine.core.common.vdscommands.UpdateVdsVMsClearedVDSCommandParameters)

Example 2 with UpdateVdsVMsClearedVDSCommandParameters

use of org.ovirt.engine.core.common.vdscommands.UpdateVdsVMsClearedVDSCommandParameters in project ovirt-engine by oVirt.

the class StopVdsCommand method handleSpecificCommandActions.

@Override
protected void handleSpecificCommandActions() {
    List<VM> vmList = getVmList();
    if (vmList.size() > 0) {
        RestartVdsVmsOperation restartVmsOper = new RestartVdsVmsOperation(getContext(), getVds());
        restartVmsOper.restartVms(vmList);
        runVdsCommand(VDSCommandType.UpdateVdsVMsCleared, new UpdateVdsVMsClearedVDSCommandParameters(getVds().getId()));
    }
}
Also used : RestartVdsVmsOperation(org.ovirt.engine.core.bll.RestartVdsVmsOperation) VM(org.ovirt.engine.core.common.businessentities.VM) UpdateVdsVMsClearedVDSCommandParameters(org.ovirt.engine.core.common.vdscommands.UpdateVdsVMsClearedVDSCommandParameters)

Example 3 with UpdateVdsVMsClearedVDSCommandParameters

use of org.ovirt.engine.core.common.vdscommands.UpdateVdsVMsClearedVDSCommandParameters in project ovirt-engine by oVirt.

the class ClearNonResponsiveVdsVmsCommand method executeCommand.

@Override
protected void executeCommand() {
    List<VM> vms = vmDao.getAllRunningForVds(getVdsId());
    Collections.sort(vms, Collections.reverseOrder(new VmsComparer()));
    List<Guid> autoStartVmIdsToRerun = new ArrayList<>();
    for (VM vm : vms) {
        if (vm.isAutoStartup()) {
            autoStartVmIdsToRerun.add(vm.getId());
        }
        VDSReturnValue returnValue = runVdsCommand(VDSCommandType.SetVmStatus, new SetVmStatusVDSCommandParameters(vm.getId(), VMStatus.Down, VmExitStatus.Error));
        // Write that this VM was shut down by host reboot or manual fence
        if (returnValue != null && returnValue.getSucceeded()) {
            logSettingVmToDown(vm);
        }
        runInternalActionWithTasksContext(ActionType.ProcessDownVm, new ProcessDownVmParameters(vm.getId(), true));
    }
    runVdsCommand(VDSCommandType.UpdateVdsVMsCleared, new UpdateVdsVMsClearedVDSCommandParameters(getVdsId()));
    if (!autoStartVmIdsToRerun.isEmpty()) {
        haAutoStartVmsRunner.addVmsToRun(autoStartVmIdsToRerun);
    }
    setSucceeded(true);
}
Also used : ProcessDownVmParameters(org.ovirt.engine.core.common.action.ProcessDownVmParameters) VM(org.ovirt.engine.core.common.businessentities.VM) SetVmStatusVDSCommandParameters(org.ovirt.engine.core.common.vdscommands.SetVmStatusVDSCommandParameters) VmsComparer(org.ovirt.engine.core.common.businessentities.comparators.VmsComparer) ArrayList(java.util.ArrayList) Guid(org.ovirt.engine.core.compat.Guid) UpdateVdsVMsClearedVDSCommandParameters(org.ovirt.engine.core.common.vdscommands.UpdateVdsVMsClearedVDSCommandParameters) VDSReturnValue(org.ovirt.engine.core.common.vdscommands.VDSReturnValue)

Aggregations

VM (org.ovirt.engine.core.common.businessentities.VM)3 UpdateVdsVMsClearedVDSCommandParameters (org.ovirt.engine.core.common.vdscommands.UpdateVdsVMsClearedVDSCommandParameters)3 RestartVdsVmsOperation (org.ovirt.engine.core.bll.RestartVdsVmsOperation)2 ArrayList (java.util.ArrayList)1 ProcessDownVmParameters (org.ovirt.engine.core.common.action.ProcessDownVmParameters)1 VmsComparer (org.ovirt.engine.core.common.businessentities.comparators.VmsComparer)1 SetVmStatusVDSCommandParameters (org.ovirt.engine.core.common.vdscommands.SetVmStatusVDSCommandParameters)1 VDSReturnValue (org.ovirt.engine.core.common.vdscommands.VDSReturnValue)1 Guid (org.ovirt.engine.core.compat.Guid)1