use of org.ovirt.engine.core.common.businessentities.MigrationSupport in project ovirt-engine by oVirt.
the class AddVmCommand method setDefaultMigrationPolicy.
protected void setDefaultMigrationPolicy() {
if (getCluster() != null) {
boolean isMigrationSupported = FeatureSupported.isMigrationSupported(getCluster().getArchitecture(), getEffectiveCompatibilityVersion());
MigrationSupport migrationSupport = isMigrationSupported ? MigrationSupport.MIGRATABLE : MigrationSupport.PINNED_TO_HOST;
getParameters().getVmStaticData().setMigrationSupport(migrationSupport);
}
}
use of org.ovirt.engine.core.common.businessentities.MigrationSupport in project ovirt-engine by oVirt.
the class FindVmAndDestinationsTest method testGetMigratableVmsFromHost.
/**
* This test verifies that VMs can be selected as sources when they support migration
* and that migration support is not tied to host pinning.
*/
@Test
public void testGetMigratableVmsFromHost() throws Exception {
List<VDS> hosts = new ArrayList<>();
hosts.add(createHost());
hosts.add(createHost());
hosts.add(createHost());
/*
* Prepare all combinations of migration support and affinity.
* There will be hosts.size() + 1 VMs for each migration support value.
* The VMs will have 0, 1, 2 ... hosts.size() hosts in their dedicatedVmForVds list.
*/
List<VM> vms = new ArrayList<>();
for (MigrationSupport m : EnumSet.allOf(MigrationSupport.class)) {
for (int i = 0; i <= hosts.size(); i++) {
vms.add(createVm(m, hosts.subList(0, i)));
}
}
doReturn(vms).when(vmDao).getAllRunningForVds(null);
List<VM> selected = findVmAndDestinations.getMigratableVmsRunningOnVds(vmDao, null);
assertEquals(hosts.size() + 1, selected.size());
for (VM vm : selected) {
assertEquals(MigrationSupport.MIGRATABLE, vm.getMigrationSupport());
}
}
Aggregations