Bug 1043500

Summary: [TEXT] typo in error message for add snapshot
Product: Red Hat Enterprise Virtualization Manager Reporter: Barak Dagan <bdagan>
Component: ovirt-engine-cliAssignee: Juan Hernández <juan.hernandez>
Status: CLOSED ERRATA QA Contact: Aharon Canan <acanan>
Severity: low Docs Contact:
Priority: unspecified    
Version: 3.3.0CC: acanan, acathrow, adahms, amureini, ebenahar, iheim, juan.hernandez, lnatapov, oramraz, pstehlik, Rhev-m-bugs, scohen, yeylon
Target Milestone: ---   
Target Release: 3.4.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard: storage
Fixed In Version: rhevm-cli-3.4.0.3-1 Doc Type: Bug Fix
Doc Text:
Previously, attempting to execute a command via the command line interface using a non-existing or incorrectly spelled sub-collection name would result in an error. This was caused by the logic used to retrieve the attributes of specified sub-collections, whereby the existence of the target sub-collection was not checked before attempting to retrieve the attributes of that sub-collection. Now, this logic has been revised so that the existence of the specified sub-collection is checked, allowing a more meaningful error message to be returned when the specified sub-collection cannot be found.
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-06-09 14:06:46 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:
Bug Depends On:    
Bug Blocks: 1078909, 1142926    

Description Barak Dagan 2013-12-16 13:42:55 UTC
Description of problem:

while the action was on wrongly typed attibute "snapshots", the error message added an extra s "snapshots"

# add snapshots --description 'is27_engine' --vm-identifier myvm

unknown error: 'VM' object has no attribute 'snapshotss'


Version-Release number of selected component (if applicable):
backend version: 3.3 (is27)
sdk version    : 3.3.0.17.*final-.1
cli version    : 3.3.0.8.*final-.1
python version : 2.6.6.final.0


How reproducible:
100 %

Steps to Reproduce:
1. 
2.
3.

Actual results:


Expected results:


Additional info:

Comment 2 Juan Hernández 2014-01-17 11:39:42 UTC
Allon, can you explain why did you assign it to yourself? Do you already know what is the root cause? How do you plan to fix it?

Comment 3 Allon Mureinik 2014-01-22 11:05:24 UTC
(In reply to Juan Hernández from comment #2)
> Allon, can you explain why did you assign it to yourself? Do you already
> know what is the root cause? How do you plan to fix it?

When I discussed this with Michael, his approach was that this is a bug in a specific storage api implementation, not the underlying infrastructure, which I tend to agree with.
Under this assumption, I took the BZ off his hands. If you disagree, by all means, feel free to take it back.

As for the solution - I haven't started looking into this yet, so I don't really have a direction. If I indeed end up implementing this, I won't hesitate to ask for help. `-)

Comment 4 Juan Hernández 2014-01-22 13:01:00 UTC
Actually this is a CLI only problem. When we add a new object with "add snapshot" we calculate the name of the collection appending a "s" to the name, and then we use introspection to try to find an attribute with the name in the corresponding object, in this case in the VM object. But we do that without checking that it exists, and this raises a Python internal exception, which results in this message. What we need to do is to check if the attribute exists before trying to get it, and generate an appropriate message, like we do for top level collections. The message will be the following:

  error: cannot create "snapshots" because snapshotss collection is not available or given arguments not valid.

Comment 5 Allon Mureinik 2014-01-22 14:25:49 UTC
Thanks for the explanation (not to mention the solution :-))

Comment 6 Allon Mureinik 2014-01-28 08:53:19 UTC
Juan, I see the patch referenced in the external trackers has been merged. Does ovirt-engine-cli have a stable branch for 3.4, or should this BZ just be moved to MODIFIED?

Comment 7 Juan Hernández 2014-01-28 09:40:58 UTC
The patch has been merged to the upstream master branch, it now has to go to the sdk_3.4 branch, and then has to go downstream. I will move it to modified when it has been merged to the corresponding downstream branch.

Comment 8 Leonid Natapov 2014-02-19 12:13:12 UTC
tested on ovirt-engine-cli-3.4.0.3-1.el6.noarch


[oVirt shell (connected)]# add snapshots --description 'is27_engine' --vm-identifier lesik

  ================================================================================================================== ERROR ================================================================================================================
                                                                   cannot create "snapshots" because snapshotss collection is not available or given arguments not valid.

Double "s" still present.

Comment 9 Juan Hernández 2014-02-19 12:31:56 UTC
The message displayed now is an accurate description of the reason for the error: it is telling the user that the "snapshotss" collection doesn't exist. The same happens with any object that doesn't have a corresponding collection, for example:

  # add apple --description 'myapple' ...
  === ERROR ===
  cannot create "apple" because apples collection ...

Note that the error message includes now the name of the object as typed by the user, and also the name of the collection. In the name of the collection the extra "s" needs to be present, to indicate the user what is the name name of the collection that doesn't exist.

I'm open to improve the wording of the message. Any suggestion?

Comment 10 Juan Hernández 2014-02-25 15:04:40 UTC
Leonid, can we move this to VERIFIED?

Comment 11 Juan Hernández 2014-02-25 15:19:36 UTC
*** Bug 950059 has been marked as a duplicate of this bug. ***

Comment 13 errata-xmlrpc 2014-06-09 14:06:46 UTC
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.

http://rhn.redhat.com/errata/RHEA-2014-0662.html