Search in sources :

Example 16 with VDSReturnValue

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

the class GetAddedGlusterServersQuery method executeQueryCommand.

@Override
@SuppressWarnings("unchecked")
protected void executeQueryCommand() {
    Map<String, String> glusterServers = new HashMap<>();
    VDS upServer = glusterUtil.getUpServer(getParameters().getClusterId());
    if (upServer != null) {
        VDSReturnValue returnValue = runVdsCommand(VDSCommandType.GlusterServersList, new VdsIdVDSCommandParametersBase(upServer.getId()));
        glusterServers = getAddedGlusterServers((List<GlusterServerInfo>) returnValue.getReturnValue());
    }
    getQueryReturnValue().setReturnValue(glusterServers);
}
Also used : VdsIdVDSCommandParametersBase(org.ovirt.engine.core.common.vdscommands.VdsIdVDSCommandParametersBase) VDS(org.ovirt.engine.core.common.businessentities.VDS) HashMap(java.util.HashMap) List(java.util.List) VDSReturnValue(org.ovirt.engine.core.common.vdscommands.VDSReturnValue)

Example 17 with VDSReturnValue

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

the class GetGlusterVolumeOptionsInfoQuery method executeQueryCommand.

@Override
protected void executeQueryCommand() {
    VDSReturnValue returnValue = runVdsCommand(VDSCommandType.GetGlusterVolumeOptionsInfo, new VdsIdVDSCommandParametersBase(getUpServerId(getParameters().getClusterId())));
    getQueryReturnValue().setReturnValue(returnValue.getReturnValue());
}
Also used : VdsIdVDSCommandParametersBase(org.ovirt.engine.core.common.vdscommands.VdsIdVDSCommandParametersBase) VDSReturnValue(org.ovirt.engine.core.common.vdscommands.VDSReturnValue)

Example 18 with VDSReturnValue

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

the class AddVmLeaseCommand method endSuccessfully.

@Override
protected void endSuccessfully() {
    // it would be nicer to get this as part of the tasks rather
    // than initiating another call to the host, this approach is
    // easier and backward compatible though
    VDSReturnValue retVal = null;
    try {
        retVal = runVdsCommand(VDSCommandType.GetVmLeaseInfo, new VmLeaseVDSParameters(getParameters().getStoragePoolId(), getParameters().getStorageDomainId(), getParameters().getVmId()));
    } catch (EngineException e) {
        log.error("Failure in getting lease info for VM {}, message: {}", getParameters().getVmId(), e.getMessage());
    }
    if (retVal == null || !retVal.getSucceeded()) {
        log.error("Failed to get info on the lease of VM {}", getParameters().getVmId());
        return;
    }
    vmDynamicDao.updateVmLeaseInfo(getParameters().getVmId(), (Map<String, String>) retVal.getReturnValue());
    if (getParameters().isHotPlugLease()) {
        boolean hotPlugSucceeded = false;
        try {
            hotPlugSucceeded = runVdsCommand(VDSCommandType.HotPlugLease, new LeaseVDSParameters(getParameters().getVdsId(), getParameters().getVmId(), getParameters().getStorageDomainId())).getSucceeded();
        } catch (EngineException e) {
            log.error("Failure in hot plugging a lease to VM {}, message: {}", getParameters().getVmId(), e.getMessage());
        }
        if (!hotPlugSucceeded) {
            setVmId(getParameters().getVmId());
            auditLog(this, AuditLogType.HOT_PLUG_LEASE_FAILED);
            getReturnValue().setEndActionTryAgain(false);
            setSucceeded(false);
            return;
        }
    }
    setSucceeded(true);
}
Also used : EngineException(org.ovirt.engine.core.common.errors.EngineException) LeaseVDSParameters(org.ovirt.engine.core.common.vdscommands.LeaseVDSParameters) VmLeaseVDSParameters(org.ovirt.engine.core.common.vdscommands.VmLeaseVDSParameters) VmLeaseVDSParameters(org.ovirt.engine.core.common.vdscommands.VmLeaseVDSParameters) VDSReturnValue(org.ovirt.engine.core.common.vdscommands.VDSReturnValue)

Example 19 with VDSReturnValue

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

the class VmLeaseCommandBase method executeCommand.

@Override
protected void executeCommand() {
    Guid taskId = persistAsyncTaskPlaceHolder(getParameters().getParentCommand());
    VmLeaseVDSParameters params = new VmLeaseVDSParameters(getParameters().getStoragePoolId(), getParameters().getStorageDomainId(), getParameters().getVmId());
    VDSReturnValue returnValue = runVdsCommand(getLeaseAction(), params);
    if (returnValue.getSucceeded()) {
        getTaskIdList().add(createTask(taskId, returnValue.getCreationInfo(), getParameters().getParentCommand(), VdcObjectType.Storage, getParameters().getStorageDomainId()));
    }
    setSucceeded(returnValue.getSucceeded());
}
Also used : Guid(org.ovirt.engine.core.compat.Guid) VmLeaseVDSParameters(org.ovirt.engine.core.common.vdscommands.VmLeaseVDSParameters) VDSReturnValue(org.ovirt.engine.core.common.vdscommands.VDSReturnValue)

Example 20 with VDSReturnValue

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

the class LiveMigrateDiskCommand method updateImagesInfo.

private void updateImagesInfo() {
    for (DiskImage image : diskImageDao.getAllSnapshotsForImageGroup(getParameters().getImageGroupID())) {
        VDSReturnValue ret = runVdsCommand(VDSCommandType.GetImageInfo, new GetImageInfoVDSCommandParameters(getParameters().getStoragePoolId(), getParameters().getTargetStorageDomainId(), getParameters().getImageGroupID(), image.getImageId()));
        DiskImage imageFromIRS = (DiskImage) ret.getReturnValue();
        setQcowCompatForSnapshot(image, imageFromIRS);
        DiskImageDynamic diskImageDynamic = diskImageDynamicDao.get(image.getImageId());
        // Update image's actual size in DB
        if (imageFromIRS != null && diskImageDynamic != null) {
            diskImageDynamic.setActualSize(imageFromIRS.getActualSizeInBytes());
            diskImageDynamicDao.update(diskImageDynamic);
        }
    }
}
Also used : GetImageInfoVDSCommandParameters(org.ovirt.engine.core.common.vdscommands.GetImageInfoVDSCommandParameters) DiskImage(org.ovirt.engine.core.common.businessentities.storage.DiskImage) DiskImageDynamic(org.ovirt.engine.core.common.businessentities.storage.DiskImageDynamic) VDSReturnValue(org.ovirt.engine.core.common.vdscommands.VDSReturnValue)

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