Search in sources :

Example 1 with VmReplicateDiskParameters

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

the class LiveMigrateDiskCommand method replicateDiskStart.

private void replicateDiskStart() {
    if (Guid.Empty.equals(getParameters().getVdsId())) {
        throw new EngineException(EngineError.down, "VM " + getParameters().getVmId() + " is not running on any VDS");
    }
    StorageType targetType = getDstStorageDomain().getStorageStaticData().getStorageType();
    Optional<String> diskType = vmInfoBuildUtils.getNetworkDiskType(getVm(), targetType);
    // Start disk migration
    VmReplicateDiskParameters migrationStartParams = new VmReplicateDiskParameters(getParameters().getVdsId(), getParameters().getVmId(), getParameters().getStoragePoolId(), getParameters().getSourceStorageDomainId(), getParameters().getTargetStorageDomainId(), getParameters().getImageGroupID(), getParameters().getDestinationImageId(), diskType.orElse(null));
    VDSReturnValue ret = resourceManager.runVdsCommand(VDSCommandType.VmReplicateDiskStart, migrationStartParams);
    if (!ret.getSucceeded()) {
        log.error("Failed VmReplicateDiskStart (Disk '{}' , VM '{}')", getParameters().getImageGroupID(), getParameters().getVmId());
        throw new EngineException(ret.getVdsError().getCode(), ret.getVdsError().getMessage());
    }
}
Also used : StorageType(org.ovirt.engine.core.common.businessentities.storage.StorageType) DiskStorageType(org.ovirt.engine.core.common.businessentities.storage.DiskStorageType) EngineException(org.ovirt.engine.core.common.errors.EngineException) VmReplicateDiskParameters(org.ovirt.engine.core.common.vdscommands.VmReplicateDiskParameters) VDSReturnValue(org.ovirt.engine.core.common.vdscommands.VDSReturnValue)

Example 2 with VmReplicateDiskParameters

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

the class LiveMigrateDiskCommand method replicateDiskFinish.

private void replicateDiskFinish(Guid srcDomain, Guid dstDomain) {
    VmReplicateDiskParameters migrationStartParams = new VmReplicateDiskParameters(getParameters().getVdsId(), getParameters().getVmId(), getParameters().getStoragePoolId(), srcDomain, dstDomain, getParameters().getImageGroupID(), getParameters().getDestinationImageId(), null);
    VDSReturnValue ret = resourceManager.runVdsCommand(VDSCommandType.VmReplicateDiskFinish, migrationStartParams);
    if (!ret.getSucceeded()) {
        throw new EngineException(ret.getVdsError().getCode(), ret.getVdsError().getMessage());
    }
}
Also used : EngineException(org.ovirt.engine.core.common.errors.EngineException) VmReplicateDiskParameters(org.ovirt.engine.core.common.vdscommands.VmReplicateDiskParameters) VDSReturnValue(org.ovirt.engine.core.common.vdscommands.VDSReturnValue)

Aggregations

EngineException (org.ovirt.engine.core.common.errors.EngineException)2 VDSReturnValue (org.ovirt.engine.core.common.vdscommands.VDSReturnValue)2 VmReplicateDiskParameters (org.ovirt.engine.core.common.vdscommands.VmReplicateDiskParameters)2 DiskStorageType (org.ovirt.engine.core.common.businessentities.storage.DiskStorageType)1 StorageType (org.ovirt.engine.core.common.businessentities.storage.StorageType)1