Search in sources :

Example 1 with HotSetAmountOfMemoryParameters

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

the class UpdateVmCommand method hotPlugMemoryDevice.

private void hotPlugMemoryDevice(int currentMemoryMb, int newAmountOfMemoryMb) {
    HotSetAmountOfMemoryParameters params = new HotSetAmountOfMemoryParameters(newVmStatic, currentMemoryMb < newAmountOfMemoryMb ? PlugAction.PLUG : PlugAction.UNPLUG, // We always use node 0, auto-numa should handle the allocation
    0, newAmountOfMemoryMb - currentMemoryMb);
    ActionReturnValue setAmountOfMemoryResult = runInternalAction(ActionType.HotSetAmountOfMemory, params, cloneContextAndDetachFromParent());
    // into the OVF store and automatically used during the next HE VM start
    if (!getVm().isHostedEngine()) {
        newVmStatic.setMemSizeMb(setAmountOfMemoryResult.getSucceeded() ? newAmountOfMemoryMb : currentMemoryMb);
    }
    logHotSetActionEvent(setAmountOfMemoryResult, AuditLogType.FAILED_HOT_SET_MEMORY);
}
Also used : HotSetAmountOfMemoryParameters(org.ovirt.engine.core.common.action.HotSetAmountOfMemoryParameters) ActionReturnValue(org.ovirt.engine.core.common.action.ActionReturnValue)

Aggregations

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