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