Search in sources :

Example 31 with VDSReturnValue

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;
}
Also used : VDSReturnValue(org.ovirt.engine.core.common.vdscommands.VDSReturnValue)

Example 32 with VDSReturnValue

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());
}
Also used : VdsAndVmIDVDSParametersBase(org.ovirt.engine.core.common.vdscommands.VdsAndVmIDVDSParametersBase) VDSReturnValue(org.ovirt.engine.core.common.vdscommands.VDSReturnValue)

Example 33 with VDSReturnValue

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());
    }
}
Also used : ResumeVDSCommandParameters(org.ovirt.engine.core.common.vdscommands.ResumeVDSCommandParameters) VDSReturnValue(org.ovirt.engine.core.common.vdscommands.VDSReturnValue)

Example 34 with VDSReturnValue

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());
}
Also used : VDSReturnValue(org.ovirt.engine.core.common.vdscommands.VDSReturnValue)

Example 35 with VDSReturnValue

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);
    }
}
Also used : AuditLogableBase(org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogableBase) ProcessDownVmParameters(org.ovirt.engine.core.common.action.ProcessDownVmParameters) VM(org.ovirt.engine.core.common.businessentities.VM) SetVmStatusVDSCommandParameters(org.ovirt.engine.core.common.vdscommands.SetVmStatusVDSCommandParameters) ArrayList(java.util.ArrayList) Guid(org.ovirt.engine.core.compat.Guid) VDSReturnValue(org.ovirt.engine.core.common.vdscommands.VDSReturnValue) AuditLogDirector(org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogDirector)

Aggregations

VDSReturnValue (org.ovirt.engine.core.common.vdscommands.VDSReturnValue)250 Guid (org.ovirt.engine.core.compat.Guid)65 ArrayList (java.util.ArrayList)43 VDS (org.ovirt.engine.core.common.businessentities.VDS)29 EngineException (org.ovirt.engine.core.common.errors.EngineException)29 Pair (org.ovirt.engine.core.common.utils.Pair)26 StorageDomain (org.ovirt.engine.core.common.businessentities.StorageDomain)23 List (java.util.List)16 Test (org.junit.Test)15 StorageDomainStatic (org.ovirt.engine.core.common.businessentities.StorageDomainStatic)15 DiskImage (org.ovirt.engine.core.common.businessentities.storage.DiskImage)15 VdsIdVDSCommandParametersBase (org.ovirt.engine.core.common.vdscommands.VdsIdVDSCommandParametersBase)15 HashMap (java.util.HashMap)13 VDSError (org.ovirt.engine.core.common.errors.VDSError)13 Map (java.util.Map)11 Callable (java.util.concurrent.Callable)11 StoragePool (org.ovirt.engine.core.common.businessentities.StoragePool)11 StoragePoolIsoMap (org.ovirt.engine.core.common.businessentities.StoragePoolIsoMap)11 EngineLock (org.ovirt.engine.core.utils.lock.EngineLock)9 GlusterGeoRepSession (org.ovirt.engine.core.common.businessentities.gluster.GlusterGeoRepSession)8