Bugzilla will be upgraded to version 5.0. The upgrade date is tentatively scheduled for 2 December 2018, pending final testing and feedback.
Bug 1439970 - [v4 API] Specifying name and vm.disk_attachments returns error 500
[v4 API] Specifying name and vm.disk_attachments returns error 500
Status: CLOSED ERRATA
Product: Red Hat Enterprise Virtualization Manager
Classification: Red Hat
Component: ovirt-engine (Show other bugs)
4.0.7
x86_64 Linux
medium Severity low
: ovirt-4.2.0
: ---
Assigned To: Tomas Jelinek
Israel Pinto
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2017-04-06 20:38 EDT by Germano Veit Michel
Modified: 2018-05-15 13:43 EDT (History)
12 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Previously, when creating a template from a virtual machine with the REST API, if the disk attachments were customized, the virtual machine could not be referenced by its name. In the current release, it is possible to create a template from a virtual machine referenced by its name and to customize the disk attachments in the same request.
Story Points: ---
Clone Of:
Environment:
Last Closed: 2018-05-15 13:41:54 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: Virt
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)


External Trackers
Tracker ID Priority Status Summary Last Updated
Red Hat Knowledge Base (Solution) 3228141 None None None 2017-10-31 03:29 EDT
oVirt gerrit 75336 master MERGED restapi: Fix adding customized template with VM name 2017-04-17 04:24 EDT
Red Hat Product Errata RHEA-2018:1488 None None None 2018-05-15 13:43 EDT

  None (edit)
Description Germano Veit Michel 2017-04-06 20:38:33 EDT
Description of problem:

While creating a template using the API, according to [1] and [2], I have to specify the VM element using it's NAME or it's ID. And it works fine.

However, if in the same template create request, I customize the VM disk_attachment, ID works but NAME returns error 500.

[1] https://github.com/oVirt/ovirt-engine-api-model/blob/master/src/main/java/services/TemplatesService.java#L44

[2] https://gerrit.ovirt.org/75272 (see BZ#1425295)

Examples: 

A: No disk customization, VM by name: OK
========================================
<template>
  <name>lala_template_070420171032</name>
  <vm>
    <name>test</name>
  </vm>
</template>
upload completely sent off
HTTP/1.1 202 Accepted

B: Disk customization, VM by id: OK
===================================
<template>
  <name>lala_template_070420171020</name>
  <vm id="064dec9d-733d-46a8-91f8-78e85c6b150e">
    <disk_attachments>
      <disk_attachment>
        <disk id="901ce7f1-e5c0-4b16-8d0d-ff976bdcb94b">
          <format>cow</format>
          <sparse>true</sparse>
        </disk>
      </disk_attachment>
    </disk_attachments>
  </vm>
</template>
upload completely sent off
HTTP/1.1 202 Accepted

C: Disk customization, VM by name: ERROR
========================================
<template>
  <name>lala_template_070420171031</name>
  <vm>
    <name>test</name>
    <disk_attachments>
      <disk_attachment>
        <disk id="901ce7f1-e5c0-4b16-8d0d-ff976bdcb94b">
          <format>cow</format>
          <sparse>true</sparse>
        </disk>
      </disk_attachment>
    </disk_attachments>
  </vm>
</template>
upload completely sent off
HTTP/1.1 500 Internal Server Error

I also get this on engine.log, spamming all the logs since the first call is made. Engine goes into a error logging frenzy, repeating it all the time. Tons of these non-stop:

2017-04-07 10:33:23,454 ERROR [org.ovirt.engine.api.restapi.util.LinkHelper] (default task-13) [] Can't find relative path for class "org.ovirt.engine.api.resource.TemplateDisksResource", will return null
2017-04-07 10:33:23,501 ERROR [org.ovirt.engine.api.restapi.util.LinkHelper] (default task-10) [] Can't find relative path for class "org.ovirt.engine.api.resource.TemplateDisksResource", will return null
2017-04-07 10:33:23,501 ERROR [org.ovirt.engine.api.restapi.util.LinkHelper] (default task-10) [] Can't find relative path for class "org.ovirt.engine.api.resource.TemplateDisksResource", will return null
2017-04-07 10:33:23,513 ERROR [org.ovirt.engine.api.restapi.util.LinkHelper] (default task-25) [] Can't find relative path for class "org.ovirt.engine.api.resource.TemplateDisksResource", will return null
2017-04-07 10:33:23,513 ERROR [org.ovirt.engine.api.restapi.util.LinkHelper] (default task-25) [] Can't find relative path for class "org.ovirt.engine.api.resource.TemplateDisksResource", will return null
2017-04-07 10:33:23,514 ERROR [org.ovirt.engine.api.restapi.util.LinkHelper] (default task-25) [] Can't find relative path for class "org.ovirt.engine.api.resource.TemplateDisksResource", will return null
2017-04-07 10:33:23,514 ERROR [org.ovirt.engine.api.restapi.util.LinkHelper] (default task-25) [] Can't find relative path for class "org.ovirt.engine.api.resource.TemplateDisksResource", will return null
2017-04-07 10:33:23,520 ERROR [org.ovirt.engine.api.restapi.util.LinkHelper] (default task-9) [] Can't find relative path for class "org.ovirt.engine.api.resource.TemplateDisksResource", will return null
2017-04-07 10:33:23,520 ERROR [org.ovirt.engine.api.restapi.util.LinkHelper] (default task-9) [] Can't find relative path for class "org.ovirt.engine.api.resource.TemplateDisksResource", will return null

Right after issuing the API call I already have 500 of those. See:
# grep "Can't find relative path for class \"org.ovirt.engine.api.resource.TemplateDisksResource\"" /var/log/ovirt-engine/engine.log | wc -l
504

Version-Release number of selected component (if applicable):
rhevm-4.0.7.4-0.1.el7ev.noarch

How reproducible:
100%
Comment 1 Germano Veit Michel 2017-04-06 20:53:38 EDT
Looks like it can't follow the vm link if it's by name?

  <vm id="064dec9d-733d-46a8-91f8-78e85c6b150e">
    <disk_attachments>

VS:

  <vm>
    <name>test</name>
    <disk_attachments>
Comment 2 Juan Hernández 2017-04-07 03:20:53 EDT
I am taking this to investigate it. May need to move to a different team later.
Comment 3 Juan Hernández 2017-04-07 09:20:47 EDT
I believe that the proposed patch fixes the issue:

  restapi: Fix adding customized template with VM name
  https://gerrit.ovirt.org/75336

Michal, I'd appreciate if your team can take it from here, and target/backport as required.
Comment 4 Juan Hernández 2017-04-07 09:24:23 EDT
Germano, the proposed patch fixes the main issue. But I wasn't able to reproduce those log messages that you mention. They are really warnings, not errors, but anyhow they shouldn't flood the log. I'd appreciate if you can re-test, once the main error is fixed, and report back if you see that log flooding.
Comment 6 Germano Veit Michel 2017-04-09 20:49:01 EDT
(In reply to Juan Hernández from comment #4)
> Germano, the proposed patch fixes the main issue. But I wasn't able to
> reproduce those log messages that you mention. They are really warnings, not
> errors, but anyhow they shouldn't flood the log. I'd appreciate if you can
> re-test, once the main error is fixed, and report back if you see that log
> flooding.

Hi Juan and Michal,

Thanks. Can we get it on the 4.1 branch? If so I can test it straightforward.

FYI, there is no customer hitting this at the moment and it's really easy to workaround (use ID), so not sure about real the need for a zstream.
Comment 7 rhev-integ 2017-11-02 09:39:32 EDT
INFO: Bug status wasn't changed from MODIFIED to ON_QA due to the following reason:

[No relevant external trackers attached]

For more info please contact: rhv-devops@redhat.com
Comment 9 Israel Pinto 2017-11-20 04:15:45 EST
Verify with:
Software version:4.2.0-0.0.master.20171114111003.git7aa1b91.el7.centos

Steps:
Create template with VM name and custom disk id:
<template>
  <name>template_BZ</name>
  <vm>
    <name>golden_env_mixed_virtio_5</name>
    <disk_attachments>
      <disk_attachment>
        <disk id="b45d0d47-4234-4db9-80e0-769dae8cfb34">
          <format>cow</format>
          <sparse>true</sparse>
        </disk>
      </disk_attachment>
    </disk_attachments>
  </vm>
</template>

Template created
Comment 12 errata-xmlrpc 2018-05-15 13:41:54 EDT
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

Note You need to log in before you can comment on or make changes to this bug.