use of org.ovirt.engine.core.common.vdscommands.VDSReturnValue in project ovirt-engine by oVirt.
the class VmsListFetcherTest method getFailedVdsReturnValue.
private VDSReturnValue getFailedVdsReturnValue() {
VDSReturnValue value = new VDSReturnValue();
value.setSucceeded(false);
return value;
}
use of org.ovirt.engine.core.common.vdscommands.VDSReturnValue in project ovirt-engine by oVirt.
the class FreezeVmCommand method perform.
@Override
protected void perform() {
VDSReturnValue returnValue = runVdsCommand(VDSCommandType.Freeze, new VdsAndVmIDVDSParametersBase(getVdsId(), getVmId()));
setActionReturnValue(returnValue.getReturnValue());
setSucceeded(returnValue.getSucceeded());
}
use of org.ovirt.engine.core.common.vdscommands.VDSReturnValue in project ovirt-engine by oVirt.
the class RunVmCommand method resumeVm.
private void resumeVm() {
setVdsId(getVm().getRunOnVds());
if (getVds() != null) {
try {
VDSReturnValue result = getVdsBroker().runAsyncVdsCommand(VDSCommandType.Resume, new ResumeVDSCommandParameters(getVdsId(), getVm().getId()), this);
setActionReturnValue(result.getReturnValue());
setSucceeded(result.getSucceeded());
ExecutionHandler.setAsyncJob(getExecutionContext(), true);
} finally {
freeLock();
}
} else {
setActionReturnValue(getVm().getStatus());
}
}
use of org.ovirt.engine.core.common.vdscommands.VDSReturnValue in project ovirt-engine by oVirt.
the class SealVmTemplateCommand method executeCommand.
@Override
protected void executeCommand() {
if (getDiskImages().isEmpty()) {
setSucceeded(true);
return;
}
VDSReturnValue vdsReturnValue = vdsCommandsHelper.runVdsCommandWithFailover(VDSCommandType.SealDisks, buildSealDisksVDSCommandParameters(), getDiskImages().get(0).getStoragePoolId(), this);
if (!vdsReturnValue.getSucceeded()) {
setCommandStatus(CommandStatus.FAILED);
}
setSucceeded(vdsReturnValue.getSucceeded());
}
use of org.ovirt.engine.core.common.vdscommands.VDSReturnValue 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);
}
}
Aggregations