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

Bug 1373880

Summary: [REST API] Add a 2nd bootable disk give error with '$'s
Product: Red Hat Enterprise Virtualization Manager Reporter: Ilanit Stein <istein>
Component: ovirt-engineAssignee: Nobody <nobody>
Status: CLOSED DUPLICATE QA Contact: meital avital <mavital>
Severity: high Docs Contact:
Priority: unspecified    
Version: 4.0.3CC: amureini, gklein, juan.hernandez, lsurette, rbalakri, Rhev-m-bugs, srevivo, tjelinek, ykaul
Target Milestone: ovirt-4.0.4   
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: 2016-09-08 08:13:37 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: Storage RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Ilanit Stein 2016-09-07 11:13:59 UTC
Description of problem:
When trying to add a 2nd bootable disk to a VM, via RES API (On RHV GUI such operation is blocked), an error with '$' is generated:

"Cannot add Virtual Disk. Disk ${DiskName} in VM ${VmName} is already marked as boot., vmname, test 2, diskname, test 2 disk1"

Importance:
On CFME/RHV Provider, Add a 2nd bootable disk to a VM (bug 1093655) is allowed.
It ends up failing with the above error, propagated from RHV, 
and displayed to the user, in CFME UI.

How to reproduce:

Method: POST 
Accept: application/xml
Content-Type: application/xml
URL: https://<RHV FQDN>/ovirt-engine/api/vms/< VM guid>/diskattachments

body:
<disk_attachment>
  <bootable>false</bootable>
  <interface>virtio</interface>
  <disk>
    <description>My disk</description>
    <format>cow</format>
    <name>mydisk</name>
    <provisioned_size>1048576</provisioned_size>
    <storage_domains>
      <storage_domain>
        <name>mydata</name>
      </storage_domain>
    </storage_domains>
  </disk>
</disk_attachment> 

Response:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<fault>
    <detail>[Cannot add Virtual Disk. Disk ${DiskName} in VM ${VmName} is already marked as boot., vmname, test 2, diskname, test 2 disk1]</detail>
    <reason>Operation Failed</reason>
</fault>



Version-Release number of selected component (if applicable):
RHV-4.0.3

How reproducible:
100%

Actual results:
Error given contain '$'s

Expected results:
Error should be clear, and not contain '$'s

Comment 1 Tomas Jelinek 2016-09-08 06:01:17 UTC
@Juan, Im not sure, but is this not the case for all validation messages containing variables? Or do we have some mechanism for variable replacing inside messages on the REST side?

Comment 2 Juan Hernández 2016-09-08 08:13:37 UTC
The mechanism to handle ${...} in error messages is in the backend, in the ErrorTranslatorImpl class. The API takes the message from the backend and sends them to the user without modification.

In this particular case this seems to be a duplicate of bug 1368954, which is already fixed in version 4.0.4 of the engine:

  core: Fix validation message replacement when attaching boot disk to VM
  https://gerrit.ovirt.org/62716

I'm closing the bug as duplicate.

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