Bug 1311899

Summary: Minimum guaranteed memory is higher than VM memory when hotplug fails
Product: [oVirt] ovirt-engine Reporter: Martin Sivák <msivak>
Component: BLL.VirtAssignee: jniederm
Status: CLOSED CURRENTRELEASE QA Contact: meital avital <mavital>
Severity: medium Docs Contact:
Priority: medium    
Version: 4.0.0CC: bugs, jniederm, mavital, mgoldboi, michal.skrivanek, sbonazzo, tjelinek
Target Milestone: ovirt-3.6.5Flags: rule-engine: ovirt-3.6.z+
mgoldboi: planning_ack+
tjelinek: devel_ack+
mavital: testing_ack+
Target Release: 3.6.5   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Cause: Consequence: If vm was not running nor up and a memory was changed without "apply later" flag then engine could show different memory size of VM than it actually had. Fix: If vm is not running, the memory is changed immediately. If vm is up and "apply later" flag is not selected, hotplug attempt is send to VDSM and memory is altered accordingly. If VM is in any other state and "apply later" flag is not selected, the memory change request is ignored (warning is logged, other UpdateVmCommand changes are applied, correct next-run confituration created). Result:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-04-21 14:38:07 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: Virt RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Martin Sivák 2016-02-25 09:56:48 UTC
Description of problem:

The UI logic of webadmin keeps VM's memory and minimal guaranteed memory in sync. So when the memory size is increased, the guaranteed memory increases too.

Now, hotplug is attempted for VMs in UP state and the memory size is reduced to the amount returned from the hotplug command (see org.ovirt.engine.core.bll.UpdateVmCommand#hotSetMemory). But the minimal guaranteed memory is not updated here.

Version-Release number of selected component (if applicable):

master branch, probably 3.6 too

How reproducible:

Always using fakevdsm.

Steps to Reproduce:
1. Edit a VM
2. Increase its memory
3. Save the VM
4. Wait for the hotplug command to finish (couple of seconds?)
5. Edit a VM again
6. Edit VM's name (for example), but do not touch the memory
7. Try saving the VM
8. Observe the error

Actual results:

Minimal guaranteed memory is higher than memory size and subsequent Edit VM attempts can't be saved until the memory size is fixed.

Expected results:

Minimal guaranteed memory is always kept <= memory size

Comment 1 jniederm 2016-03-02 18:17:57 UTC
I can't reproduce it following steps to reproduce from comment 0.
Steps to reproduce that works for me:
4.0 master, commit 46c9875
(using real vdsm (master snapshots))
(Supposing that ConfigValues.HotPlugMemoryMultiplicationSizeMb = 256)
1. Create VM 
    * 512 MB of memory (and guaranteed memory)
    * (to make it bootable) add network not nic1
    * (to make it bootable) set firts boot device to "Network (PXE)"
2. Run that VM.
3. Edit the VM to increase memory to 768 MB (do NOT check "Apply later" in confirmation dialog).
4. Edit the VM to decrease memory to 256 MB.
5. Power off VM.
6. Open Edit VM dialog
7. Confirm Edit VM dialog using OK button.

Actual results:
Minimal guaranteed memory is highlighted as being incorrect.

Comment 2 Michal Skrivanek 2016-03-14 07:15:05 UTC
also, hotSetMemlog() uses auditLogDirector.log(logable, AuditLogType.FAILED_HOT_SET_NUMBER_OF_CPUS) which seems to by a copy-paste mistake

Comment 3 Michal Skrivanek 2016-03-14 07:24:54 UTC
(In reply to jniederm from comment #1)

> Actual results:
> Minimal guaranteed memory is highlighted as being incorrect.

setting aside that you didn't do the original steps - isn't that the point, that it should not be incorrect?

Comment 4 jniederm 2016-03-14 19:32:30 UTC
It turned out that even steps to reproduce in comment 1 are not reliable. The key is try to decrease the memory when VM is in state "Starting". This allows to achieve state when actual memory is less than guaranteed memory.

Comment 5 jniederm 2016-03-15 11:31:13 UTC
(In reply to jniederm from comment #4)
"Starting" ~ "PoweringUp"

Comment 6 Michal Skrivanek 2016-03-16 13:00:53 UTC
also comment #2 please;-)

Comment 7 jniederm 2016-03-16 15:46:43 UTC
Regarging comment 2: yes, it's a bug. I've added a fix to the patch.

Comment 8 meital avital 2016-04-14 06:45:35 UTC
Verified on version: 3.6.5.3-0.1.el6

Verified steps:
1. Run VM.
2. While the VM is starting (powering up status) open the Edit dialog 
3. Increase its memory
4. Save the VM
5. Edit a VM again
6. Edit VM's name (for example), but do not touch the memory
7. Saving the VM