Search in sources :

Example 1 with HotSetNumberOfCpusParameters

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

the class UpdateVmCommand method hotSetCpus.

private void hotSetCpus(VM newVm) {
    int currentSockets = getVm().getNumOfSockets();
    int newNumOfSockets = newVm.getNumOfSockets();
    // try hotplug only if topology (cpuPerSocket, threadsPerCpu) hasn't changed
    if (getVm().getStatus() == VMStatus.Up && VmCommonUtils.isCpusToBeHotpluggedOrUnplugged(getVm(), newVm)) {
        HotSetNumberOfCpusParameters params = new HotSetNumberOfCpusParameters(newVmStatic, currentSockets < newNumOfSockets ? PlugAction.PLUG : PlugAction.UNPLUG);
        ActionReturnValue setNumberOfCpusResult = runInternalAction(ActionType.HotSetNumberOfCpus, params, cloneContextAndDetachFromParent());
        // into the OVF store and automatically used during the next HE VM start
        if (!getVm().isHostedEngine()) {
            newVmStatic.setNumOfSockets(setNumberOfCpusResult.getSucceeded() ? newNumOfSockets : currentSockets);
        }
        logHotSetActionEvent(setNumberOfCpusResult, AuditLogType.FAILED_HOT_SET_NUMBER_OF_CPUS);
    }
}
Also used : HotSetNumberOfCpusParameters(org.ovirt.engine.core.common.action.HotSetNumberOfCpusParameters) ActionReturnValue(org.ovirt.engine.core.common.action.ActionReturnValue)

Aggregations

ActionReturnValue (org.ovirt.engine.core.common.action.ActionReturnValue)1 HotSetNumberOfCpusParameters (org.ovirt.engine.core.common.action.HotSetNumberOfCpusParameters)1