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

Bug 1278738

Summary: The "virtio_scsi" element isn't populated when a VM is requested
Product: [oVirt] ovirt-engine Reporter: Juan Hernández <juan.hernandez>
Component: RestAPIAssignee: Juan Hernández <juan.hernandez>
Status: CLOSED CURRENTRELEASE QA Contact: Shira Maximov <mshira>
Severity: low Docs Contact:
Priority: unspecified    
Version: 3.5.5CC: bugs, mavital, pspacek
Target Milestone: ovirt-4.0.0-alphaKeywords: Reopened
Target Release: 4.0.0Flags: rule-engine: ovirt-4.0.0+
rule-engine: planning_ack+
rule-engine: devel_ack+
mavital: testing_ack+
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: ovirt 4.0.0 alpha1 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-08-17 14:37:40 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:
Bug Depends On:    
Bug Blocks: 1213937    

Description Juan Hernández 2015-11-06 10:32:15 UTC
When a VM is requested using the RESTAPI the "virtio_scsi" element isn't populated. The expected result should be the following:

  GET /vms/{vm:id}
  <vm>
    ...
    <virtio_scsi>
      <enabled>true|false</enabled>
    </virtio_scsi>
    ...
  </vm>

As a side effect, when using the Python SDK the following code used to disable VirtIO SCSI will fail:

  vm = api.vms.get(name="myvm")
  vm.get_virtio_scsi().set_enabled(False)
  vm.update()

It will fail because "vm.get_virtio_scsi()" returns "None".

As a workaround Python SDK users can do the following:

  vm=api.vms.get(name="myvm")
  vm.set_virtio_scsi(
    params.VirtIO_SCSI(
      enabled=False
    )
  )
  vm.update()

Comment 1 Juan Hernández 2015-11-06 10:51:10 UTC
The reason for this missing information is that computing it is expensive, as it requires an additional query per VM, so it has been made optional, it will only be returned when the "All-Content" header is "true":

  GET /vms/{vm:id}
  All-Content: true

  <vm>
    ...
    <virtio_scsi enabled="true|false"/>
    ...
  </vm>

Note also that "enabled" is an attribute, not an inner element as in the description of the bug.

In the Python SDK the "All-Content" header can be activated using the "all_content" parameter of the operation that retrieves the VM:

  vm = api.vms.get(name="myvm", all_content=True)
  vm.get_virtio_scsi().set_enabled(False)
  vm.update()

As this was a design decision and there are workarounds I think that we aren't going to change it.

Comment 2 Michal Skrivanek 2015-12-04 14:59:47 UTC
I agree with comment #1. I guess the bug can be closed, right

Comment 3 Petr Spacek 2015-12-04 15:14:41 UTC
Honesly I cannot believe that either RHEV or Python SDK will not be fixed. How can I as a mere user know that this workaround is necessary?

Speaking as a regular SDK user, I would like something which acts consistently and does not blow up in unexpected ways.

Comment 4 Juan Hernández 2015-12-09 10:29:13 UTC
I this kind of situation we can change the server so that it returns always all the information by default. That hurts performance, so we aren't doing it.

We can improve things for users documenting it. That is what the proposed patch does.

In version 4.0 the documentation will be available from the server, and will look like this:

  https://jhernand.fedorapeople.org/ovirt-api-explorer/#/services/vm/methods/get

This documentation will eventually also added to the SDK itself.

But other than documenting it I don't see how we can make the system more consistent in these regards, unless we always return all the information.

Comment 5 Shira Maximov 2016-08-16 13:39:26 UTC
verified on :
Red Hat Virtualization Manager Version: 4.0.2.6-0.1.el7ev

verification steps:
in REST API:
  GET /vms/{vm:id}
  All-Content: true



result:
<virtio_scsi>
<enabled>true</enabled>
</virtio_scsi>