Bug 836777 - ovirt-engine-iso-uploader: Wrong return value is printed when upload operation fails and using verbose mode .
Summary: ovirt-engine-iso-uploader: Wrong return value is printed when upload operatio...
Keywords:
Status: CLOSED WONTFIX
Alias: None
Product: Red Hat Enterprise Virtualization Manager
Classification: Red Hat
Component: ovirt-engine-iso-uploader
Version: 3.1.0
Hardware: Unspecified
OS: Unspecified
unspecified
medium
Target Milestone: ---
: ---
Assignee: Keith Robertson
QA Contact: Pavel Stehlik
URL:
Whiteboard: integration
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2012-07-01 09:03 UTC by Oded Ramraz
Modified: 2016-07-04 01:35 UTC (History)
5 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2012-07-18 06:27:40 UTC
oVirt Team: ---
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description Oded Ramraz 2012-07-01 09:03:21 UTC
Description of problem:

ovirt-engine-iso-uploader: Wrong return value when using verbose mode and trying to upload the same ISO twice , or when passing wrong path as an input ( see Additional Information )
wrong return code is printed:  0 instead of 3 
DEBUG: returncode(0)

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


How reproducible:


Steps to Reproduce:
1.
2.
3.
  
Actual results:


Expected results:


Additional info:


Return values:
    0: The program ran to completion with no errors.
    1: The program encountered a critical failure and stopped.
    2: The program did not discover any ISO domains.
    3: The program encountered a problem uploading to an ISO domain.
    4: The program encountered a problem un-mounting and removing the temporary directory.

[root@aqua-rhel base_iso]# rhevm-iso-uploader upload -v -i iso  WindowsXP-sp2-vlk.iso 
Please provide the REST API password for the admin@internal RHEV-M user (CTRL+D to abort): 
DEBUG: API Vendor(ovirt.org)    API Version(3.1.0)
DEBUG: id=fb1c28e4-2c8b-4bb5-882a-0372d98c7733 address=multipass.eng.lab.tlv.redhat.com path=/export/images/qa/aqua_rest/iso
DEBUG: local NFS mount point is /tmp/tmpz3tvnV
DEBUG: NFS mount command (/bin/mount -t nfs -o rw,sync,soft multipass.eng.lab.tlv.redhat.com:/export/images/qa/aqua_rest/iso /tmp/tmpz3tvnV)
DEBUG: /bin/mount -t nfs -o rw,sync,soft multipass.eng.lab.tlv.redhat.com:/export/images/qa/aqua_rest/iso /tmp/tmpz3tvnV
DEBUG: _cmds(['/bin/mount', '-t', 'nfs', '-o', 'rw,sync,soft', 'multipass.eng.lab.tlv.redhat.com:/export/images/qa/aqua_rest/iso', '/tmp/tmpz3tvnV'])
DEBUG: returncode(0)
DEBUG: STDOUT()
DEBUG: STDERR()
ERROR: WindowsXP-sp2-vlk.iso exists on multipass.eng.lab.tlv.redhat.com.  Either remove it or supply the --force option to overwrite it.
DEBUG: /bin/umount -t nfs -f  /tmp/tmpz3tvnV
DEBUG: /bin/umount -t nfs -f  /tmp/tmpz3tvnV
DEBUG: _cmds(['/bin/umount', '-t', 'nfs', '-f', '/tmp/tmpz3tvnV'])
DEBUG: returncode(0)
DEBUG: STDOUT()
DEBUG: STDERR()


[root@aqua-rhel base_iso]# echo $?
3


[root@aqua-rhel base_iso]# rhevm-iso-uploader upload -v -i iso  WindowsXP-sp2-vlk.is2o 
Please provide the REST API password for the admin@internal RHEV-M user (CTRL+D to abort): 
DEBUG: API Vendor(ovirt.org)    API Version(3.1.0)
DEBUG: id=fb1c28e4-2c8b-4bb5-882a-0372d98c7733 address=multipass.eng.lab.tlv.redhat.com path=/export/images/qa/aqua_rest/iso
DEBUG: local NFS mount point is /tmp/tmpwcYCM8
DEBUG: NFS mount command (/bin/mount -t nfs -o rw,sync,soft multipass.eng.lab.tlv.redhat.com:/export/images/qa/aqua_rest/iso /tmp/tmpwcYCM8)
DEBUG: /bin/mount -t nfs -o rw,sync,soft multipass.eng.lab.tlv.redhat.com:/export/images/qa/aqua_rest/iso /tmp/tmpwcYCM8
DEBUG: _cmds(['/bin/mount', '-t', 'nfs', '-o', 'rw,sync,soft', 'multipass.eng.lab.tlv.redhat.com:/export/images/qa/aqua_rest/iso', '/tmp/tmpwcYCM8'])
DEBUG: returncode(0)
DEBUG: STDOUT()
DEBUG: STDERR()
ERROR: Unable to copy WindowsXP-sp2-vlk.is2o to ISO storage domain on iso.
ERROR: Error message is "[Errno 2] No such file or directory: 'WindowsXP-sp2-vlk.is2o'"
DEBUG: /bin/umount -t nfs -f  /tmp/tmpwcYCM8
DEBUG: /bin/umount -t nfs -f  /tmp/tmpwcYCM8
DEBUG: _cmds(['/bin/umount', '-t', 'nfs', '-f', '/tmp/tmpwcYCM8'])
DEBUG: returncode(0)
DEBUG: STDOUT()
DEBUG: STDERR()

[root@aqua-rhel base_iso]# echo $?
3

Comment 1 Oded Ramraz 2012-07-01 09:06:44 UTC
Maybe the problem is that the global return code is not printed .

Comment 2 Keith Robertson 2012-07-17 13:44:12 UTC
I'm not sure what you want me to fix here.  If you want me to fix the fact that a debug statement says "returncode(0)", then I'll say "no" for two reasons:

Reason 1: This is a debug statement intended for the eyes of someone familiar with the code.
Reason 2: The debug message "DEBUG: returncode(0)" is != to  the program's actual return code.  It is the returncode from forked process and I may need to see it; hence, I print it.

So what is the problem here?

Comment 3 Oded Ramraz 2012-07-17 19:22:25 UTC
Sorry for not being familiar with your code but I still find those prints as misleading . I'm running negative test case and still seeing only returncode(0) in the debug prints while the actual return code is 3 .

The following sentence in the command line helps to confuse me as well: 
Return values:
    0: The program ran to completion with no errors.


(In reply to comment #2)
> I'm not sure what you want me to fix here.  If you want me to fix the fact
> that a debug statement says "returncode(0)", then I'll say "no" for two
> reasons:
> 
> Reason 1: This is a debug statement intended for the eyes of someone
> familiar with the code.
> Reason 2: The debug message "DEBUG: returncode(0)" is != to  the program's
> actual return code.  It is the returncode from forked process and I may need
> to see it; hence, I print it.
> 
> So what is the problem here?

Comment 4 Keith Robertson 2012-07-17 19:43:43 UTC
(In reply to comment #3)
> Sorry for not being familiar with your code but I still find those prints as
> misleading . I'm running negative test case and still seeing only
> returncode(0) in the debug prints while the actual return code is 3 .
> 
So the debug line of "returncode(0)" is valid in the context of verbose output which you told the program to do with the "-v" option.  It is valid because it is telling you that the forked command [1] completed with a returncode of 0.

Do we really need to fix a debug statement that is valid, IMHO, in the context of debugging?   

[1]  /bin/mount -t nfs -o rw,sync,soft multipass.eng.lab.tlv.redhat.com:/export/images/qa/aqua_rest/iso /tmp/tmpwcYCM8





> The following sentence in the command line helps to confuse me as well: 
> Return values:
>     0: The program ran to completion with no errors.
> 
> 
> (In reply to comment #2)
> > I'm not sure what you want me to fix here.  If you want me to fix the fact
> > that a debug statement says "returncode(0)", then I'll say "no" for two
> > reasons:
> > 
> > Reason 1: This is a debug statement intended for the eyes of someone
> > familiar with the code.
> > Reason 2: The debug message "DEBUG: returncode(0)" is != to  the program's
> > actual return code.  It is the returncode from forked process and I may need
> > to see it; hence, I print it.
> > 
> > So what is the problem here?


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