use of org.ovirt.engine.core.common.action.StopVmParameters in project ovirt-engine by oVirt.
the class ShutdownVmCommand method perform.
@Override
protected void perform() {
log.info("Entered (VM '{}').", getVm().getName());
vmHandler.updateVmGuestAgentVersion(getVm());
if (canShutdownVm()) {
// shutting down desktop and waiting for it in a separate thread to
// become 'down':
log.info("Sending shutdown command for VM '{}'.", getVmName());
int secondsToWait = getParameters().getWaitBeforeShutdown() ? Config.<Integer>getValue(ConfigValues.VmGracefulShutdownTimeout) : 0;
// sending a shutdown command to the VM:
setActionReturnValue(runVdsCommand(VDSCommandType.DestroyVm, new DestroyVmVDSCommandParameters(getVdsId(), getVmId(), getParameters().getStopReason(), true, secondsToWait)).getReturnValue());
} else {
// cannot shutdown -> send a StopVm command instead ('destroy'):
// don't log -> log will appear for the StopVmCommand we are about to run:
setCommandShouldBeLogged(false);
log.info("Cannot shutdown VM '{}', status is not up. Stopping instead.", getVmName());
StopVmParameters stopVmParams = new StopVmParameters(getVmId(), StopVmTypeEnum.CANNOT_SHUTDOWN);
stopVmParams.setStopReason(getParameters().getStopReason());
// stopVmParams.ParametersCurrentUser = CurrentUser;
stopVmParams.setSessionId(getParameters().getSessionId());
runInternalAction(ActionType.StopVm, stopVmParams);
}
setSucceeded(true);
}
use of org.ovirt.engine.core.common.action.StopVmParameters in project ovirt-engine by oVirt.
the class RemoveVmPoolCommand method stopVms.
private void stopVms() {
allVmsDown = true;
for (VM vm : getCachedVmsInPool()) {
if (!vm.isDown()) {
commandCoordinatorUtil.executeAsyncCommand(ActionType.StopVm, withRootCommandInfo(new StopVmParameters(vm.getId(), StopVmTypeEnum.NORMAL)), cloneContextAndDetachFromParent());
allVmsDown = false;
} else {
removeVm(vm);
}
}
}
use of org.ovirt.engine.core.common.action.StopVmParameters in project ovirt-engine by oVirt.
the class VmListModel method onStop.
private void onStop() {
final ConfirmationModel model = (ConfirmationModel) getWindow();
onPowerAction(ActionType.StopVm, vm -> new StopVmParameters(vm.getId(), StopVmTypeEnum.NORMAL, model.getReason().getEntity()));
}
Aggregations