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);
}
Aggregations