Search in sources :

Example 1 with MigrateVDSCommandParameters

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

the class MigrateVmCommand method createMigrateVDSCommandParameters.

private MigrateVDSCommandParameters createMigrateVDSCommandParameters() {
    String srcVdsHost = getVds().getHostName();
    String dstVdsHost = String.format("%1$s:%2$s", getDestinationVds().getHostName(), getDestinationVds().getPort());
    Map<String, Object> convergenceSchedule = null;
    Integer maxBandwidth = null;
    Boolean autoConverge = getAutoConverge();
    Boolean migrateCompressed = getMigrateCompressed();
    Boolean enableGuestEvents = null;
    Integer maxIncomingMigrations = null;
    Integer maxOutgoingMigrations = null;
    if (FeatureSupported.migrationPoliciesSupported(getVm().getCompatibilityVersion())) {
        MigrationPolicy clusterMigrationPolicy = convergenceConfigProvider.getMigrationPolicy(getCluster().getMigrationPolicyId(), getCluster().getCompatibilityVersion());
        MigrationPolicy effectiveMigrationPolicy = findEffectiveConvergenceConfig(clusterMigrationPolicy);
        ConvergenceConfig convergenceConfig = getVm().getStatus() == VMStatus.Paused ? filterOutPostcopy(effectiveMigrationPolicy.getConfig()) : effectiveMigrationPolicy.getConfig();
        convergenceSchedule = ConvergenceSchedule.from(convergenceConfig).asMap();
        maxBandwidth = getMaxBandwidth(clusterMigrationPolicy);
        if (!NoMigrationPolicy.ID.equals(effectiveMigrationPolicy.getId())) {
            autoConverge = effectiveMigrationPolicy.isAutoConvergence();
            migrateCompressed = effectiveMigrationPolicy.isMigrationCompression();
        }
        enableGuestEvents = effectiveMigrationPolicy.isEnableGuestEvents();
        maxIncomingMigrations = maxOutgoingMigrations = effectiveMigrationPolicy.getMaxMigrations();
    }
    return new MigrateVDSCommandParameters(getVdsId(), getVmId(), srcVdsHost, getDestinationVdsId(), dstVdsHost, MigrationMethod.ONLINE, isTunnelMigrationUsed(), getLiteralMigrationNetworkIp(), getVds().getClusterCompatibilityVersion(), getMaximumMigrationDowntime(), autoConverge, migrateCompressed, getDestinationVds().getConsoleAddress(), maxBandwidth, convergenceSchedule, enableGuestEvents, maxIncomingMigrations, maxOutgoingMigrations);
}
Also used : ConvergenceConfig(org.ovirt.engine.core.common.migration.ConvergenceConfig) NoMigrationPolicy(org.ovirt.engine.core.common.migration.NoMigrationPolicy) MigrationPolicy(org.ovirt.engine.core.common.migration.MigrationPolicy) MigrateVDSCommandParameters(org.ovirt.engine.core.common.vdscommands.MigrateVDSCommandParameters)

Aggregations

ConvergenceConfig (org.ovirt.engine.core.common.migration.ConvergenceConfig)1 MigrationPolicy (org.ovirt.engine.core.common.migration.MigrationPolicy)1 NoMigrationPolicy (org.ovirt.engine.core.common.migration.NoMigrationPolicy)1 MigrateVDSCommandParameters (org.ovirt.engine.core.common.vdscommands.MigrateVDSCommandParameters)1