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