Description of problem: The v4 REST API silently fails to update the read_only value for a disk attachment Version-Release number of selected component (if applicable): rhevm-4.1.10.3-0.1.el7 python-ovirt-engine-sdk4-4.1.7-1.el7ev How reproducible: 100% Steps to Reproduce: 1. Edit VM's attached disk and check "Read-Only" 2. Check read_only status to make sure it is "true" curl -u "user:pass" "https://rhvm.example.com/ovirt-engine/api/vms/<vm_guid>/diskattachments/<disk_id>" 3. Update read_only and set to "false" curl -u "user:pass" -X PUT -H "Content-Type: application/xml" -d "<disk_attachment><read_only>false</read_only></disk_attachment>" "https://rhvm.example.com/ovirt-engine/api/vms/<vm_guid>/diskattachments/<disk_id>" Actual results: REST API returns HTTP 200 along with disk attachment XML, and read_only is still set to "true" Expected results: REST API returns HTTP 200 and read_only is set to "false" Additional info: Issue was first seen using python-ovirt-engine-sdk4. We were testing v3 ovirt-engine-sdk-python script and found that /api/v3/vms/<vm_guid>/disks/<disk_id> does not return read_only value at all, so we switched to v4, then to simple curl test. Simple reproducer: # cat test.sh #!/bin/bash -x curl -u "admin@internal:mypass" "https://rhvm.example.com/ovirt-engine/api/vms/288662ee-e893-4e0a-be56-4a01af5c00ff/diskattachments/6ce0cc76-7be2-42c8-876b-769a5223e3e4" echo -e "\n###\n" curl -vvv -u "admin@internal:mypass" -X PUT -H "Content-Type: application/xml" -d "<disk_attachment><read_only>false</read_only></disk_attachment>" "https://rhvm.example.com/ovirt-engine/api/v4/vms/288662ee-e893-4e0a-be56-4a01af5c00ff/diskattachments/6ce0cc76-7be2-42c8-876b-769a5223e3e4" echo -e "\n###\n" curl -u "admin@internal:mypass" "https://rhvm.example.com/ovirt-engine/api/vms/288662ee-e893-4e0a-be56-4a01af5c00ff/diskattachments/6ce0cc76-7be2-42c8-876b-769a5223e3e4" # ./test.sh + curl -u 'admin@internal:mypass' https://rhvm.example.com/ovirt-engine/api/vms/288662ee-e893-4e0a-be56-4a01af5c00ff/diskattachments/6ce0cc76-7be2-42c8-876b-769a5223e3e4 <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <disk_attachment href="/ovirt-engine/api/vms/288662ee-e893-4e0a-be56-4a01af5c00ff/diskattachments/6ce0cc76-7be2-42c8-876b-769a5223e3e4" id="6ce0cc76-7be2-42c8-876b-769a5223e3e4"> <active>true</active> <bootable>false</bootable> <interface>virtio_scsi</interface> <pass_discard>false</pass_discard> <read_only>true</read_only> <uses_scsi_reservation>false</uses_scsi_reservation> <disk href="/ovirt-engine/api/disks/6ce0cc76-7be2-42c8-876b-769a5223e3e4" id="6ce0cc76-7be2-42c8-876b-769a5223e3e4"/> <vm href="/ovirt-engine/api/vms/288662ee-e893-4e0a-be56-4a01af5c00ff" id="288662ee-e893-4e0a-be56-4a01af5c00ff"/> </disk_attachment> + echo -e '\n###\n' ### + curl -vvv -u 'admin@internal:mypass' -X PUT -H 'Content-Type: application/xml' -d '<disk_attachment><read_only>false</read_only></disk_attachment>' https://rhvm.example.com/ovirt-engine/api/v4/vms/288662ee-e893-4e0a-be56-4a01af5c00ff/diskattachments/6ce0cc76-7be2-42c8-876b-769a5223e3e4 * About to connect() to rhvm.example.com port 443 (#0) * Trying 10.10.10.10... * Connected to rhvm.example.com (10.10.10.10) port 443 (#0) * Initializing NSS with certpath: sql:/etc/pki/nssdb * CAfile: /etc/pki/tls/certs/ca-bundle.crt CApath: none * SSL connection using TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 * Server certificate: * subject: CN=rhvm.example.com,O=example.com,C=US * start date: Mar 28 07:35:11 2018 GMT * expire date: Mar 03 07:35:12 2023 GMT * common name: rhvm.example.com * issuer: CN=rhvm.example.com.84661,O=example.com,C=US * Server auth using Basic with user 'admin@internal' > PUT /ovirt-engine/api/v4/vms/288662ee-e893-4e0a-be56-4a01af5c00ff/diskattachments/6ce0cc76-7be2-42c8-876b-769a5223e3e4 HTTP/1.1 > Authorization: Basic YWRtaW5AaW50ZXJuYWw6UmVkSGF0MSE= > User-Agent: curl/7.29.0 > Host: rhvm.example.com > Accept: */* > Content-Type: application/xml > Content-Length: 63 > * upload completely sent off: 63 out of 63 bytes < HTTP/1.1 200 OK < Date: Sun, 08 Apr 2018 17:13:43 GMT < Server: Apache/2.4.6 (Red Hat Enterprise Linux) OpenSSL/1.0.2k-fips < Content-Type: application/xml;charset=UTF-8 < Content-Length: 727 < Correlation-Id: 03f89294-e72c-4d05-8bba-86d77dd9fbd0 < Vary: Accept-Encoding < <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <disk_attachment href="/ovirt-engine/api/v4/vms/288662ee-e893-4e0a-be56-4a01af5c00ff/diskattachments/6ce0cc76-7be2-42c8-876b-769a5223e3e4" id="6ce0cc76-7be2-42c8-876b-769a5223e3e4"> <active>true</active> <bootable>false</bootable> <interface>virtio_scsi</interface> <pass_discard>false</pass_discard> <read_only>true</read_only> <uses_scsi_reservation>false</uses_scsi_reservation> <disk href="/ovirt-engine/api/v4/disks/6ce0cc76-7be2-42c8-876b-769a5223e3e4" id="6ce0cc76-7be2-42c8-876b-769a5223e3e4"/> <vm href="/ovirt-engine/api/v4/vms/288662ee-e893-4e0a-be56-4a01af5c00ff" id="288662ee-e893-4e0a-be56-4a01af5c00ff"/> </disk_attachment> * Connection #0 to host rhvm.example.com left intact + echo -e '\n###\n' ### + curl -u 'admin@internal:mypass' https://rhvm.example.com/ovirt-engine/api/vms/288662ee-e893-4e0a-be56-4a01af5c00ff/diskattachments/6ce0cc76-7be2-42c8-876b-769a5223e3e4 <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <disk_attachment href="/ovirt-engine/api/vms/288662ee-e893-4e0a-be56-4a01af5c00ff/diskattachments/6ce0cc76-7be2-42c8-876b-769a5223e3e4" id="6ce0cc76-7be2-42c8-876b-769a5223e3e4"> <active>true</active> <bootable>false</bootable> <interface>virtio_scsi</interface> <pass_discard>false</pass_discard> <read_only>true</read_only> <uses_scsi_reservation>false</uses_scsi_reservation> <disk href="/ovirt-engine/api/disks/6ce0cc76-7be2-42c8-876b-769a5223e3e4" id="6ce0cc76-7be2-42c8-876b-769a5223e3e4"/> <vm href="/ovirt-engine/api/vms/288662ee-e893-4e0a-be56-4a01af5c00ff" id="288662ee-e893-4e0a-be56-4a01af5c00ff"/> </disk_attachment>
I've also tested this with the v3 API, and, although /api/v3/vms/<vm_guid>/disks/<disk_id> does not return the read_only value at all, it does get updated properly # cat testv3.sh #!/bin/bash -x curl -v -u "admin@internal:mypass" "https://rhvm.example.com/ovirt-engine/api/v3/vms/288662ee-e893-4e0a-be56-4a01af5c00ff/disks/6ce0cc76-7be2-42c8-876b-769a5223e3e4" echo -e "\n###\n" curl -vvv -u "admin@internal:mypass" -X PUT -H "Content-Type: application/xml" -d "<disk><read_only>false</read_only></disk>" "https://rhvm.example.com/ovirt-engine/api/v3/vms/288662ee-e893-4e0a-be56-4a01af5c00ff/disks/6ce0cc76-7be2-42c8-876b-769a5223e3e4" echo -e "\n###\n" curl -v -u "admin@internal:mypass" "https://rhvm.example.com/ovirt-engine/api/v3/vms/288662ee-e893-4e0a-be56-4a01af5c00ff/disks/6ce0cc76-7be2-42c8-876b-769a5223e3e4" # /usr/share/ovirt-engine/dbscripts/engine-psql.sh -c "select is_readonly from vm_device where device_id = '6ce0cc76-7be2-42c8-876b-769a5223e3e4'" is_readonly ------------- t (1 row) # ./testv3.sh + curl -v -u 'admin@internal:mypass' https://rhvm.example.com/ovirt-engine/api/v3/vms/288662ee-e893-4e0a-be56-4a01af5c00ff/disks/6ce0cc76-7be2-42c8-876b-769a5223e3e4 * About to connect() to rhvm.example.com port 443 (#0) * Trying 10.10.10.10... * Connected to rhvm.example.com (10.10.10.10) port 443 (#0) * Initializing NSS with certpath: sql:/etc/pki/nssdb * CAfile: /etc/pki/tls/certs/ca-bundle.crt CApath: none * SSL connection using TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 * Server certificate: * subject: CN=rhvm.example.com,O=example.com,C=US * start date: Mar 28 07:35:11 2018 GMT * expire date: Mar 03 07:35:12 2023 GMT * common name: rhvm.example.com * issuer: CN=rhvm.example.com.84661,O=example.com,C=US * Server auth using Basic with user 'admin@internal' > GET /ovirt-engine/api/v3/vms/288662ee-e893-4e0a-be56-4a01af5c00ff/disks/6ce0cc76-7be2-42c8-876b-769a5223e3e4 HTTP/1.1 > Authorization: Basic YWRtaW5AaW50ZXJuYWw6UmVkSGF0MSE= > User-Agent: curl/7.29.0 > Host: rhvm.example.com > Accept: */* > < HTTP/1.1 200 OK < Date: Sun, 08 Apr 2018 17:37:54 GMT < Server: Apache/2.4.6 (Red Hat Enterprise Linux) OpenSSL/1.0.2k-fips < Content-Type: application/xml;charset=UTF-8 < Content-Length: 2198 < Correlation-Id: 35017d39-fcc8-49bf-ad7d-6a3374c881a4 < Vary: Accept-Encoding < <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <disk href="/ovirt-engine/api/v3/vms/288662ee-e893-4e0a-be56-4a01af5c00ff/disks/6ce0cc76-7be2-42c8-876b-769a5223e3e4" id="6ce0cc76-7be2-42c8-876b-769a5223e3e4"> <actions> <link href="/ovirt-engine/api/v3/vms/288662ee-e893-4e0a-be56-4a01af5c00ff/disks/6ce0cc76-7be2-42c8-876b-769a5223e3e4/activate" rel="activate"/> <link href="/ovirt-engine/api/v3/vms/288662ee-e893-4e0a-be56-4a01af5c00ff/disks/6ce0cc76-7be2-42c8-876b-769a5223e3e4/deactivate" rel="deactivate"/> <link href="/ovirt-engine/api/v3/vms/288662ee-e893-4e0a-be56-4a01af5c00ff/disks/6ce0cc76-7be2-42c8-876b-769a5223e3e4/export" rel="export"/> <link href="/ovirt-engine/api/v3/vms/288662ee-e893-4e0a-be56-4a01af5c00ff/disks/6ce0cc76-7be2-42c8-876b-769a5223e3e4/move" rel="move"/> </actions> <name>myLUN</name> <description>9de6</description> <link href="/ovirt-engine/api/v3/vms/288662ee-e893-4e0a-be56-4a01af5c00ff/disks/6ce0cc76-7be2-42c8-876b-769a5223e3e4/permissions" rel="permissions"/> <link href="/ovirt-engine/api/v3/vms/288662ee-e893-4e0a-be56-4a01af5c00ff/disks/6ce0cc76-7be2-42c8-876b-769a5223e3e4/statistics" rel="statistics"/> <vm href="/ovirt-engine/api/v3/vms/288662ee-e893-4e0a-be56-4a01af5c00ff" id="288662ee-e893-4e0a-be56-4a01af5c00ff"/> <alias>myLUN</alias> <interface>virtio_scsi</interface> <bootable>false</bootable> <shareable>false</shareable> <wipe_after_delete>false</wipe_after_delete> <propagate_errors>false</propagate_errors> <active>true</active> <lun_storage id="36001405cb64e284724a4b88a82559de6"> <logical_unit id="36001405cb64e284724a4b88a82559de6"> <serial>SLIO-ORG_iscsilun07_cb64e284-724a-4b88-a825-59de6c878fa0</serial> <vendor_id>LIO-ORG</vendor_id> <product_id>iscsilun07</product_id> <lun_mapping>10</lun_mapping> <size>1073741824</size> <paths>0</paths> <disk_id>6ce0cc76-7be2-42c8-876b-769a5223e3e4</disk_id> </logical_unit> </lun_storage> <uses_scsi_reservation>false</uses_scsi_reservation> <storage_type>lun</storage_type> </disk> * Connection #0 to host rhvm.example.com left intact + echo -e '\n###\n' ### + curl -vvv -u 'admin@internal:mypass' -X PUT -H 'Content-Type: application/xml' -d '<disk><read_only>false</read_only></disk>' https://rhvm.example.com/ovirt-engine/api/v3/vms/288662ee-e893-4e0a-be56-4a01af5c00ff/disks/6ce0cc76-7be2-42c8-876b-769a5223e3e4 * About to connect() to rhvm.example.com port 443 (#0) * Trying 10.10.10.10... * Connected to rhvm.example.com (10.10.10.10) port 443 (#0) * Initializing NSS with certpath: sql:/etc/pki/nssdb * CAfile: /etc/pki/tls/certs/ca-bundle.crt CApath: none * SSL connection using TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 * Server certificate: * subject: CN=rhvm.example.com,O=example.com,C=US * start date: Mar 28 07:35:11 2018 GMT * expire date: Mar 03 07:35:12 2023 GMT * common name: rhvm.example.com * issuer: CN=rhvm.example.com.84661,O=example.com,C=US * Server auth using Basic with user 'admin@internal' > PUT /ovirt-engine/api/v3/vms/288662ee-e893-4e0a-be56-4a01af5c00ff/disks/6ce0cc76-7be2-42c8-876b-769a5223e3e4 HTTP/1.1 > Authorization: Basic YWRtaW5AaW50ZXJuYWw6UmVkSGF0MSE= > User-Agent: curl/7.29.0 > Host: rhvm.example.com > Accept: */* > Content-Type: application/xml > Content-Length: 41 > * upload completely sent off: 41 out of 41 bytes < HTTP/1.1 200 OK < Date: Sun, 08 Apr 2018 17:37:55 GMT < Server: Apache/2.4.6 (Red Hat Enterprise Linux) OpenSSL/1.0.2k-fips < Content-Type: application/xml;charset=UTF-8 < Content-Length: 2198 < Correlation-Id: ecf1f0ba-570e-498c-a90e-de2e282928b8 < Vary: Accept-Encoding < <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <disk href="/ovirt-engine/api/v3/vms/288662ee-e893-4e0a-be56-4a01af5c00ff/disks/6ce0cc76-7be2-42c8-876b-769a5223e3e4" id="6ce0cc76-7be2-42c8-876b-769a5223e3e4"> <actions> <link href="/ovirt-engine/api/v3/vms/288662ee-e893-4e0a-be56-4a01af5c00ff/disks/6ce0cc76-7be2-42c8-876b-769a5223e3e4/activate" rel="activate"/> <link href="/ovirt-engine/api/v3/vms/288662ee-e893-4e0a-be56-4a01af5c00ff/disks/6ce0cc76-7be2-42c8-876b-769a5223e3e4/deactivate" rel="deactivate"/> <link href="/ovirt-engine/api/v3/vms/288662ee-e893-4e0a-be56-4a01af5c00ff/disks/6ce0cc76-7be2-42c8-876b-769a5223e3e4/export" rel="export"/> <link href="/ovirt-engine/api/v3/vms/288662ee-e893-4e0a-be56-4a01af5c00ff/disks/6ce0cc76-7be2-42c8-876b-769a5223e3e4/move" rel="move"/> </actions> <name>myLUN</name> <description>9de6</description> <link href="/ovirt-engine/api/v3/vms/288662ee-e893-4e0a-be56-4a01af5c00ff/disks/6ce0cc76-7be2-42c8-876b-769a5223e3e4/permissions" rel="permissions"/> <link href="/ovirt-engine/api/v3/vms/288662ee-e893-4e0a-be56-4a01af5c00ff/disks/6ce0cc76-7be2-42c8-876b-769a5223e3e4/statistics" rel="statistics"/> <vm href="/ovirt-engine/api/v3/vms/288662ee-e893-4e0a-be56-4a01af5c00ff" id="288662ee-e893-4e0a-be56-4a01af5c00ff"/> <alias>myLUN</alias> <interface>virtio_scsi</interface> <bootable>false</bootable> <shareable>false</shareable> <wipe_after_delete>false</wipe_after_delete> <propagate_errors>false</propagate_errors> <active>true</active> <lun_storage id="36001405cb64e284724a4b88a82559de6"> <logical_unit id="36001405cb64e284724a4b88a82559de6"> <serial>SLIO-ORG_iscsilun07_cb64e284-724a-4b88-a825-59de6c878fa0</serial> <vendor_id>LIO-ORG</vendor_id> <product_id>iscsilun07</product_id> <lun_mapping>10</lun_mapping> <size>1073741824</size> <paths>0</paths> <disk_id>6ce0cc76-7be2-42c8-876b-769a5223e3e4</disk_id> </logical_unit> </lun_storage> <uses_scsi_reservation>false</uses_scsi_reservation> <storage_type>lun</storage_type> </disk> * Connection #0 to host rhvm.example.com left intact + echo -e '\n###\n' ### + curl -v -u 'admin@internal:mypass' https://rhvm.example.com/ovirt-engine/api/v3/vms/288662ee-e893-4e0a-be56-4a01af5c00ff/disks/6ce0cc76-7be2-42c8-876b-769a5223e3e4 * About to connect() to rhvm.example.com port 443 (#0) * Trying 10.10.10.10... * Connected to rhvm.example.com (10.10.10.10) port 443 (#0) * Initializing NSS with certpath: sql:/etc/pki/nssdb * CAfile: /etc/pki/tls/certs/ca-bundle.crt CApath: none * SSL connection using TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 * Server certificate: * subject: CN=rhvm.example.com,O=example.com,C=US * start date: Mar 28 07:35:11 2018 GMT * expire date: Mar 03 07:35:12 2023 GMT * common name: rhvm.example.com * issuer: CN=rhvm.example.com.84661,O=example.com,C=US * Server auth using Basic with user 'admin@internal' > GET /ovirt-engine/api/v3/vms/288662ee-e893-4e0a-be56-4a01af5c00ff/disks/6ce0cc76-7be2-42c8-876b-769a5223e3e4 HTTP/1.1 > Authorization: Basic YWRtaW5AaW50ZXJuYWw6UmVkSGF0MSE= > User-Agent: curl/7.29.0 > Host: rhvm.example.com > Accept: */* > < HTTP/1.1 200 OK < Date: Sun, 08 Apr 2018 17:37:55 GMT < Server: Apache/2.4.6 (Red Hat Enterprise Linux) OpenSSL/1.0.2k-fips < Content-Type: application/xml;charset=UTF-8 < Content-Length: 2198 < Correlation-Id: 0942891f-eb01-4d3b-afa1-089e93cf9aa8 < Vary: Accept-Encoding < <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <disk href="/ovirt-engine/api/v3/vms/288662ee-e893-4e0a-be56-4a01af5c00ff/disks/6ce0cc76-7be2-42c8-876b-769a5223e3e4" id="6ce0cc76-7be2-42c8-876b-769a5223e3e4"> <actions> <link href="/ovirt-engine/api/v3/vms/288662ee-e893-4e0a-be56-4a01af5c00ff/disks/6ce0cc76-7be2-42c8-876b-769a5223e3e4/activate" rel="activate"/> <link href="/ovirt-engine/api/v3/vms/288662ee-e893-4e0a-be56-4a01af5c00ff/disks/6ce0cc76-7be2-42c8-876b-769a5223e3e4/deactivate" rel="deactivate"/> <link href="/ovirt-engine/api/v3/vms/288662ee-e893-4e0a-be56-4a01af5c00ff/disks/6ce0cc76-7be2-42c8-876b-769a5223e3e4/export" rel="export"/> <link href="/ovirt-engine/api/v3/vms/288662ee-e893-4e0a-be56-4a01af5c00ff/disks/6ce0cc76-7be2-42c8-876b-769a5223e3e4/move" rel="move"/> </actions> <name>myLUN</name> <description>9de6</description> <link href="/ovirt-engine/api/v3/vms/288662ee-e893-4e0a-be56-4a01af5c00ff/disks/6ce0cc76-7be2-42c8-876b-769a5223e3e4/permissions" rel="permissions"/> <link href="/ovirt-engine/api/v3/vms/288662ee-e893-4e0a-be56-4a01af5c00ff/disks/6ce0cc76-7be2-42c8-876b-769a5223e3e4/statistics" rel="statistics"/> <vm href="/ovirt-engine/api/v3/vms/288662ee-e893-4e0a-be56-4a01af5c00ff" id="288662ee-e893-4e0a-be56-4a01af5c00ff"/> <alias>myLUN</alias> <interface>virtio_scsi</interface> <bootable>false</bootable> <shareable>false</shareable> <wipe_after_delete>false</wipe_after_delete> <propagate_errors>false</propagate_errors> <active>true</active> <lun_storage id="36001405cb64e284724a4b88a82559de6"> <logical_unit id="36001405cb64e284724a4b88a82559de6"> <serial>SLIO-ORG_iscsilun07_cb64e284-724a-4b88-a825-59de6c878fa0</serial> <vendor_id>LIO-ORG</vendor_id> <product_id>iscsilun07</product_id> <lun_mapping>10</lun_mapping> <size>1073741824</size> <paths>0</paths> <disk_id>6ce0cc76-7be2-42c8-876b-769a5223e3e4</disk_id> </logical_unit> </lun_storage> <uses_scsi_reservation>false</uses_scsi_reservation> <storage_type>lun</storage_type> </disk> * Connection #0 to host rhvm.example.com left intact # /usr/share/ovirt-engine/dbscripts/engine-psql.sh -c "select is_readonly from vm_device where device_id = '6ce0cc76-7be2-42c8-876b-769a5223e3e4'" is_readonly ------------- f (1 row)
Verified using suggested reproduction flow in the description that readonly value is properly updated from true to false as well as from false to true. Version 4.2.3.2-0.1.el7 python-ovirt-engine-sdk4-4.2.6-1.el7ev.x86_64
Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory, and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. https://access.redhat.com/errata/RHEA-2018:1488
BZ<2>Jira Resync