Search in sources :

Example 1 with MigrationSupport

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);
    }
}
Also used : MigrationSupport(org.ovirt.engine.core.common.businessentities.MigrationSupport)

Example 2 with 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());
    }
}
Also used : VDS(org.ovirt.engine.core.common.businessentities.VDS) VM(org.ovirt.engine.core.common.businessentities.VM) ArrayList(java.util.ArrayList) MigrationSupport(org.ovirt.engine.core.common.businessentities.MigrationSupport) Test(org.junit.Test)

Aggregations

MigrationSupport (org.ovirt.engine.core.common.businessentities.MigrationSupport)2 ArrayList (java.util.ArrayList)1 Test (org.junit.Test)1 VDS (org.ovirt.engine.core.common.businessentities.VDS)1 VM (org.ovirt.engine.core.common.businessentities.VM)1