Search in sources :

Example 1 with MigrateVmParameters

use of org.ovirt.engine.core.common.action.MigrateVmParameters in project ovirt-engine by oVirt.

the class MaintenanceVdsCommand method migrateVm.

protected boolean migrateVm(VM vm, ExecutionContext parentContext) {
    MigrateVmParameters parameters = new MigrateVmParameters(false, vm.getId());
    parameters.setReason(MessageBundler.getMessage(AuditLogType.MIGRATION_REASON_HOST_IN_MAINTENANCE));
    return runInternalAction(ActionType.MigrateVm, parameters, createMigrateVmContext(parentContext, vm)).getSucceeded();
}
Also used : MigrateVmParameters(org.ovirt.engine.core.common.action.MigrateVmParameters)

Example 2 with MigrateVmParameters

use of org.ovirt.engine.core.common.action.MigrateVmParameters in project ovirt-engine by oVirt.

the class AffinityRulesEnforcementManager method migrateVM.

protected void migrateVM(final VM vmToMigrate) {
    MigrateVmParameters parameters = new MigrateVmParameters(false, vmToMigrate.getId());
    parameters.setReason(MessageBundler.getMessage(AuditLogType.MIGRATION_REASON_AFFINITY_ENFORCEMENT));
    backend.runInternalAction(ActionType.BalanceVm, parameters, ExecutionHandler.createInternalJobContext());
}
Also used : MigrateVmParameters(org.ovirt.engine.core.common.action.MigrateVmParameters)

Example 3 with MigrateVmParameters

use of org.ovirt.engine.core.common.action.MigrateVmParameters in project ovirt-engine by oVirt.

the class BasicMigrationHandler method migrateVM.

@Override
public void migrateVM(List<Guid> initialHosts, Guid vmToMigrate, String reason) {
    MigrateVmParameters parameters = new MigrateVmParameters(false, vmToMigrate);
    parameters.setInitialHosts(new ArrayList<>(initialHosts));
    parameters.setReason(reason);
    backendInternal.runInternalAction(ActionType.BalanceVm, parameters, ExecutionHandler.createInternalJobContext());
}
Also used : MigrateVmParameters(org.ovirt.engine.core.common.action.MigrateVmParameters)

Example 4 with MigrateVmParameters

use of org.ovirt.engine.core.common.action.MigrateVmParameters in project ovirt-engine by oVirt.

the class VmListModel method onMigrate.

private void onMigrate() {
    MigrateModel model = (MigrateModel) getWindow();
    if (model.getProgress() != null) {
        return;
    }
    model.startProgress();
    if (model.getIsAutoSelect()) {
        ArrayList<ActionParametersBase> list = new ArrayList<>();
        for (Object item : getSelectedItems()) {
            VM vm = (VM) item;
            list.add(new MigrateVmParameters(true, vm.getId(), vm.getClusterId()));
        }
        Frontend.getInstance().runMultipleAction(ActionType.MigrateVm, list, result -> {
            MigrateModel localModel = (MigrateModel) result.getState();
            localModel.stopProgress();
            cancel();
        }, model);
    } else {
        ArrayList<ActionParametersBase> list = new ArrayList<>();
        for (Object item : getSelectedItems()) {
            VM vm = (VM) item;
            if (vm.getRunOnVds().equals(model.getHosts().getSelectedItem().getId())) {
                continue;
            }
            list.add(new MigrateVmToServerParameters(true, vm.getId(), model.getHosts().getSelectedItem().getId(), vm.getClusterId()));
        }
        Frontend.getInstance().runMultipleAction(ActionType.MigrateVmToServer, list, result -> {
            MigrateModel localModel = (MigrateModel) result.getState();
            localModel.stopProgress();
            cancel();
        }, model);
    }
}
Also used : MigrateVmParameters(org.ovirt.engine.core.common.action.MigrateVmParameters) VM(org.ovirt.engine.core.common.businessentities.VM) MigrateVmToServerParameters(org.ovirt.engine.core.common.action.MigrateVmToServerParameters) ArrayList(java.util.ArrayList) ActionParametersBase(org.ovirt.engine.core.common.action.ActionParametersBase)

Aggregations

MigrateVmParameters (org.ovirt.engine.core.common.action.MigrateVmParameters)4 ArrayList (java.util.ArrayList)1 ActionParametersBase (org.ovirt.engine.core.common.action.ActionParametersBase)1 MigrateVmToServerParameters (org.ovirt.engine.core.common.action.MigrateVmToServerParameters)1 VM (org.ovirt.engine.core.common.businessentities.VM)1