Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.

Bug 1509375

Summary: Update VM from REST fails if next run spanshot exists
Product: [oVirt] ovirt-engine Reporter: jniederm
Component: BLL.VirtAssignee: jniederm
Status: CLOSED CURRENTRELEASE QA Contact: Vladimir <vshypygu>
Severity: medium Docs Contact:
Priority: medium    
Version: futureCC: bugs, tjelinek
Target Milestone: ovirt-4.2.0Flags: rule-engine: ovirt-4.2+
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-02-22 09:58:34 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:
Attachments:
Description Flags
engine-log-generated-by-the-erroneous-request.txt none

Description jniederm 2017-11-03 16:09:33 UTC
Created attachment 1347437 [details]
engine-log-generated-by-the-erroneous-request.txt

Description of problem:
UpdateVmCommand fails since #areUpdatedFieldsLegal() returns false since VM instance form DB and from params differs not only in socket count but also in e.g. 'managedDeviceMap' (from params: filled, from db: empty) and 'exportDate' (from params: date of next run snapshot, from db: null).

List of all changed field according to ObjectIdentityChecker#getChangedFields(): [clusterCompatibilityVersionOrigin, dbGeneration, exportDate, managedDeviceMap, numOfSockets, ovfVersion, quotaEnforcementType, quotaName, vmInit]

Version-Release number of selected component (if applicable):
current master, commit 930bddb235

How reproducible:
100%

Steps to Reproduce:
1. Create a VM with 2 CPU sockets
2. Run the VM
3. Set num of cpu sockets to 1 using REST with next_run=true options
   PUT api/vms/{vmId}?next_run=true
   <vm>
       <cpu>
           <topology>
               <sockets>1</sockets>
           </topology>
       </cpu>
   </vm>
4. Send the same request again

Actual results:
It fails with status code 400:
<fault>
    <detail>[There was an attempt to change VM values while the VM is not down. Please shut down the VM in order to modify these properties.]</detail>
    <reason>Operation Failed</reason>
</fault>


Expected results:
VM keeps its configuration, request passes

Additional info:

Comment 1 Vladimir 2018-02-12 15:10:56 UTC
Verified on 4.2.1.6-0.1.el7

Scenario:
1. Update sockets using next_run=true
2. Update sockets once more - PASS

Comment 2 Sandro Bonazzola 2018-02-22 09:58:34 UTC
This bugzilla is included in oVirt 4.2.0 release, published on Dec 20th 2017.

Since the problem described in this bug report should be
resolved in oVirt 4.2.0 release, published on Dec 20th 2017, it has been closed with a resolution of CURRENT RELEASE.

If the solution does not work for you, please open a new bug report.