use of org.ovirt.engine.core.common.action.ProcessDownVmParameters in project ovirt-engine by oVirt.
the class RestartVdsVmsOperation method restartVms.
/**
* Changes status of specified VMs to Down and starts HA VMs on another hosts
*
* @param vms list of VM to stopped/restarted
*/
public void restartVms(List<VM> vms) {
List<Guid> autoStartVmIdsToRerun = new ArrayList<>();
// restart all running vms of a failed vds.
for (VM vm : vms) {
destroyVmOnDestination(vm);
VDSReturnValue returnValue = Backend.getInstance().getResourceManager().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()) {
Injector.get(AuditLogDirector.class).log(Injector.injectMembers(new AuditLogableBase(vds.getId(), vm.getId())), AuditLogType.VM_WAS_SET_DOWN_DUE_TO_HOST_REBOOT_OR_MANUAL_FENCE);
}
Backend.getInstance().runInternalAction(ActionType.ProcessDownVm, new ProcessDownVmParameters(vm.getId(), true), ExecutionHandler.createDefaultContextForTasks(commandContext));
// Handle highly available VMs
if (vm.isAutoStartup()) {
autoStartVmIdsToRerun.add(vm.getId());
}
}
if (!autoStartVmIdsToRerun.isEmpty()) {
Injector.get(HaAutoStartVmsRunner.class).addVmsToRun(autoStartVmIdsToRerun);
}
}
use of org.ovirt.engine.core.common.action.ProcessDownVmParameters in project ovirt-engine by oVirt.
the class VdsEventListener method processOnVmStopInternal.
private void processOnVmStopInternal(final Collection<Guid> vmIds, final Guid hostId) {
for (Guid vmId : vmIds) {
backend.runInternalAction(ActionType.ProcessDownVm, new ProcessDownVmParameters(vmId, true));
}
HostDeviceManager hostDeviceManager = Injector.get(HostDeviceManager.class);
hostDeviceManager.refreshHostIfAnyVmHasHostDevices(vmIds, hostId);
}
use of org.ovirt.engine.core.common.action.ProcessDownVmParameters in project ovirt-engine by oVirt.
the class RunVmCommand method removeStatlessSnapshot.
private void removeStatlessSnapshot() {
runInternalAction(ActionType.ProcessDownVm, new ProcessDownVmParameters(getVm().getId(), true), ExecutionHandler.createDefaultContextForTasks(getContext(), getLock()));
// setting lock to null in order not to release lock twice
setLock(null);
setSucceeded(true);
}
use of org.ovirt.engine.core.common.action.ProcessDownVmParameters 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);
}
Aggregations