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

Bug 1723574

Summary: [downstream clone - 4.3.5] [RESTAPI] Adding ISO disables serial console
Product: Red Hat Enterprise Virtualization Manager Reporter: RHV bug bot <rhv-bugzilla-bot>
Component: ovirt-engineAssignee: Lucia Jelinkova <ljelinko>
Status: CLOSED DUPLICATE QA Contact: meital avital <mavital>
Severity: high Docs Contact:
Priority: high    
Version: 4.2.5CC: dfediuck, michal.skrivanek, rbarry, Rhev-m-bugs
Target Milestone: ovirt-4.3.5Keywords: Rebase, Reopened, ZStream
Target Release: ---Flags: lsvaty: testing_plan_complete-
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Cause: When updating VM machine using REST API, not specifying console value was treated as request for change to disabled state. Consequence: The console was set as disabled. Fix: When updating VM machine using REST API, not specifying console value now means that its state should not be changed. Result: The console keeps its previous state.
Story Points: ---
Clone Of: 1658101 Environment:
Last Closed: 2019-06-24 20:32:24 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: Virt RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 1658101    
Bug Blocks:    

Description RHV bug bot 2019-06-24 20:28:16 UTC
+++ This bug is a downstream clone. The original bug is: +++
+++   bug 1658101 +++
======================================================================

Description of problem:
On a VM that has a serial console enabled, adding a ISO/CDROM (for example for
installation purposes) will disable the serial console.


Version-Release number of selected component (if applicable):
ovirt-engine-restapi-4.2.5.2-0.1.el7ev.noarch


How reproducible:
Always


Steps to Reproduce:
1. Create a new VM
2. Using the API, enable serial console
   ~~~
   curl -s -k --header 'Accept: application/xml' --request PUT --header
   'Content-Type: application/xml' --data '
   <vm>
     <console>
       <enabled>true</enabled>
     </console>
   </vm>' -u 'admin internal:<password>' https://rhvm.example.com/ovirt-engine/api/vms/17226e86-1ccc-4b17-8ebe-f1685a2ffe98 |
   grep -A 2 '<console>'
       <console>
         <enabled>true</enabled>
       </console>
   ~~~


3. Adding ISO:
   ~~~
   curl -s -k --header 'Accept: application/xml' --request PUT --header 'Content-Type: application/xml' --data '
   <cdrom>
     <file id="rhel-server-6.9-x86_64-dvd.iso"/>
   </cdrom>
   ' -u 'admin internal:<password>' 'https://rhvm.example.com/ovirt-engine/api/vms/17226e86-1ccc-4b17-8ebe-f1685a2ffe98/cdroms/00000000-0000-0000-0000-000000000000?current=false'
   ~~~



Actual results:
Right after adding the ISO, the serial console is disabled:
   ~~~
   curl -s -k --header 'Accept: application/xml' --request GET --header 'All-Content: true' --header 'Content-Type: application/xml' \
   -u 'admin internal:<password>' https://rhvm.example.com/ovirt-engine/api/vms/17226e86-1ccc-4b17-8ebe-f1685a2ffe98 |
   grep -A 2 '<console>'
       <console>
         <enabled>false</enabled>
    </console>
   ~~~
   

Expected results:
Serial console setting to be unchanged!


Additional info:
Adding an ISO (either in run-once or general) using the webUI does not alter
the serial console setting.

(Originally by rvdwees)

Comment 1 RHV bug bot 2019-06-24 20:28:18 UTC
has the VM been restarted after your step 1? If not then serial console is a change which cannot be done while VM is running and as such the actual configuration change is just scheduled to be done after restart. If you want to make another non-live change in the meantime you need to either
- tell API to make the modification in the "next_run_ snapshot by using the next_run=1 parameter
- send both(all) changes in one request

However, changing CDROM *is* a change that can be done live, so in your case you can see the result in permanent configuration right away.

Reboot the VM and the serial console should be there. Please reopen if it's not the case

(Originally by michal.skrivanek)

Comment 2 RHV bug bot 2019-06-24 20:28:19 UTC
Reopening.

Even if I do not start the VM, just created it + enable the serial
console. Then when I add a CDROM, it gets disabled!

Similar workflow in the webUI does work as it should:
1. Create VM with NIC assigned and disk created
2. Edit the VM to add serial console
3. Edit once more and add a CDROM under boot options.
The serial console is kept in the correct state, being enabled!


In detail using the API:

# Create VM
curl -s -k --header 'Accept: application/xml' --request 'POST' --header 'Content-Type: application/xml' --data '<vm>
...
' -u "${upw}" "https://${host}/ovirt-engine/api/vms" 


# Add NIC
curl -s -k --header 'Accept: application/xml' --request 'POST' --header 'Content-Type: application/xml' --data '
...
' -u "${upw}" "https://${host}/ovirt-engine/api/vms/2409c422-fd16-48e8-9d3a-75b4dd6e7f22/nics"


# Add disk
curl -s -k --header 'Accept: application/xml' --request 'POST' --header 'Content-Type: application/xml' --data '
...
' -u "${upw}" "https://${host}/ovirt-engine/api/vms/2409c422-fd16-48e8-9d3a-75b4dd6e7f22/diskattachments"


# Check console
curl -s -k --header 'Accept: application/xml' --request GET --header 'All-Content: true' --header 'Content-Type: application/xml' \
-u "${upw}" https://${host}/ovirt-engine/api/vms/2409c422-fd16-48e8-9d3a-75b4dd6e7f22 |
   grep -A 2 '<console>'
    <console>
        <enabled>false</enabled>
    </console>


# Enable serial console
curl -s -k --header 'Accept: application/xml' --request 'PUT' --header 'Content-Type: application/xml' --data '
<vm>
  <console>
    <enabled>true</enabled>
  </console>
</vm>
' -u "${upw}" "https://${host}/ovirt-engine/api/vms/2409c422-fd16-48e8-9d3a-75b4dd6e7f22"


# Add CDROM
curl -s -k --header 'Accept: application/xml' --request 'PUT' --header 'All-Content: true' --header 'Content-Type: application/xml' --data '
<cdrom> 
  <file id="rhel-server-6.9-x86_64-dvd.iso"/>
</cdrom>
' -u "${upw}" "https://${host}/ovirt-engine/api/vms/2409c422-fd16-48e8-9d3a-75b4dd6e7f22/cdroms/00000000-0000-0000-0000-000000000000?current=false"

# Check serial console
curl -s -k --header 'Accept: application/xml' --request GET --header 'All-Content: true' --header 'Content-Type: application/xml' -u "${upw}" https://${host}/ovirt-engine/api/vms/2409c422-fd16-48e8-9d3a-75b4dd6e7f22 | grep -A 2 '<console>'
    <console>
        <enabled>false</enabled>
                 ^^^^^--------------------> notice it being disabled after inserting the CDROM
    </console>

(Originally by rvdwees)

Comment 3 RHV bug bot 2019-06-24 20:28:21 UTC
interesting. Yeah, for powered down VM it should work. Thanks for clarification

(Originally by michal.skrivanek)

Comment 4 RHV bug bot 2019-06-24 20:28:22 UTC
reproduced. weird...

(Originally by michal.skrivanek)

Comment 6 RHV bug bot 2019-06-24 20:28:26 UTC
Re-targeting to 4.3.1 since it is missing a patch, an acked blocker flag, or both

(Originally by Ryan Barry)

Comment 10 RHV bug bot 2019-06-24 20:28:32 UTC
It seems that values for console enablement and affinity labels are reset to defaults (console enabled = false, no affinity labels) if they are not specified in the request. This happens not only after modifying ISO/CDROM but also when modifying other VM parameters, e.g. comment.

(Originally by Lucia Jelinkova)

Comment 12 Ryan Barry 2019-06-24 20:32:24 UTC
Script got confused on the title. Clone already exists. Closing

*** This bug has been marked as a duplicate of bug 1710696 ***