This service will be undergoing maintenance at 00:00 UTC, 2016-08-01. It is expected to last about 1 hours
Bug 858968 - rhevm-image-uploader: Error message are not clear to common user and help message is shown even if tool failed with error that is not related to parameters parsing [TEXT]
rhevm-image-uploader: Error message are not clear to common user and help mes...
Status: CLOSED CURRENTRELEASE
Product: Red Hat Enterprise Virtualization Manager
Classification: Red Hat
Component: ovirt-image-uploader (Show other bugs)
3.0.5
Unspecified Unspecified
medium Severity medium
: ---
: 3.1.0
Assigned To: Keith Robertson
Ilanit Stein
integration
: Improvement
: 858970 (view as bug list)
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2012-09-20 04:34 EDT by Ilia Meerovich
Modified: 2016-07-04 20:07 EDT (History)
8 users (show)

See Also:
Fixed In Version:
Doc Type: Enhancement
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2012-12-04 14:59:53 EST
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:


Attachments (Terms of Use)

  None (edit)
Description Ilia Meerovich 2012-09-20 04:34:21 EDT
Product version:
rhevm-image-uploader-3.0.4-0.el6_2.noarch

Please read this and look on console output below:
1. Error messages could be missed by user since help is always printed.
2. Error like:
   <urlopen error [Errno 8] _ssl.c:490: EOF occurred in violation of protocol> 
    should be masked from user and user friendly message that common user (not    
    programmer) can understand should be printed.
   <urlopen error [Errno 113] No route to host>: is not correct message since it 
    is actually socket error (ip is ok, but port is not OK)
   Generally: it is not so useful for common user to get print with errors as 
   they defined in errno.h - he/she will not understand them, mapping of these 
   errors to user friendly messages will be much more helpful
3. If tool succeeded to do its job - it should print success message, User shouldn't print $ in order to understand if tool succeeded.

Please take a look:

[root@dhcp-3-187 c53d1c87-5ce9-4134-b6a9-4b9d590840cb]# rhevm-image-uploader -u admin@internal  -r leonid_rhevm.qa.lab.tlv.redhat.com:8080 -e test_one upload /home/art_template.ovf 
Please provide the REST API password for the admin@internal RHEV-M user (CTRL+D to abort): 
ERROR: <urlopen error [Errno 8] _ssl.c:490: EOF occurred in violation of protocol>
INFO: Use the -h option to see usage.
Usage: rhevm-image-uploader [options] list 
       rhevm-image-uploader [options] upload [file]

The image uploader can be used to list export storage domains and upload OVF files to
export storage domains. This tool only supports OVF files created by RHEV.  OVF archives should have the 
following characteristics: 
1. The OVF archive must be created with gzip compression.
2. The archive must have the following internal layout:
    |-- images
    |   |-- <Image Group UUID>
    |        |--- <Image UUID (this is the disk image)>
    |        |--- <Image UUID (this is the disk image)>.meta
    |-- master
    |   |---vms
    |       |--- <UUID>
    |             |--- <UUID>.ovf


Options:
  -h, --help            show this help message and exit
  --quiet               intended to be used with "upload" operations to reduce
                        console output. (default=False)
  --log-file=PATH       path to log file (default=/var/log/rhevm/rhevm-image-
                        uploader.log)
  --conf-file=PATH      path to configuration file
                        (default=/etc/rhevm/imageuploader.conf)
  -v, --verbose         
  -f, --force           replace like named files on the target file server
                        (default=off)

  RHEV-M Configuration:
    The options in the RHEV-M group are used by the tool to gain
    authorization to the RHEV-M REST API. The options in this group are
    available for both list and upload commands.

    -u user@rhevm.example.com, --user=user@rhevm.example.com
                        username to use with the RHEV-M REST API.  This should
                        be in UPN format.
    -r rhevm.example.com, --rhevm=rhevm.example.com
                        hostname or IP address of the RHEV-M
                        (default=localhost:8443).

  Export Storage Domain Configuration:
    The options in the upload configuration group should be provided to
    specify the export storage domain to which OVF files should be
    uploaded.

    -e EXPORT_STORAGE_DOMAIN, --export-domain=EXPORT_STORAGE_DOMAIN
                        the export storage domain to which the file(s) should
                        be uploaded
    -n NFSSERVER, --nfs-server=NFSSERVER
                        the NFS server to which the file(s) should be
                        uploaded. This option is an alternative to export-
                        domain and should not be combined with export-domain.
                        Use this when you want to upload files to a specific
                        NFS server (e.g.--nfs-
                        server=example.com:/path/to/some/dir)
    -i, --ovf-id        use this option if you do not want to update the UUID
                        of the image.  By default, the tool will generate a
                        new UUID for the image.  This ensures that there is no
                        conflict between the id of the incoming image and
                        those already in RHEV-M.
    -d, --disk-instance-id
                        use this option if do not you want to rename the
                        instance ID for each disk (i.e. InstanceId) in the
                        image. By default, this tool will generate new UUIDs
                        for disks within the image to be imported.  This
                        ensures that there are no conflicts between the disks
                        on the imported image and those within RHEV-M.
    -m, --mac-address   use this option if do not you want to remove the
                        network components from the image that will be
                        imported.  By default, this tool will remove any
                        network interface cards from the image to prevent
                        conflicts with NICs on other VMs within the RHEV-M.
                        Once the image has been imported, simply use the
                        RHEV-M to add NICs back and the RHEV-M will ensure
                        that there are no MAC address conflicts.
    -N NEW_IMAGE_NAME, --name=NEW_IMAGE_NAME
                        supply this option if you want to rename the image

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 export domains.
    3: The program encountered a problem uploading to an export domain.
    4: The program encountered a problem un-mounting and removing the temporary directory.
[root@dhcp-3-187 c53d1c87-5ce9-4134-b6a9-4b9d590840cb]# rhevm-image-uploader -u admin@internal  -r leonid_rhevm.qa.lab.tlv.redhat.com:443 -e test_one upload /home/art_template.ovf 
Please provide the REST API password for the admin@internal RHEV-M user (CTRL+D to abort): 
ERROR: <urlopen error [Errno 113] No route to host>
INFO: Use the -h option to see usage.
Usage: rhevm-image-uploader [options] list 
       rhevm-image-uploader [options] upload [file]

The image uploader can be used to list export storage domains and upload OVF files to
export storage domains. This tool only supports OVF files created by RHEV.  OVF archives should have the 
following characteristics: 
1. The OVF archive must be created with gzip compression.
2. The archive must have the following internal layout:
    |-- images
    |   |-- <Image Group UUID>
    |        |--- <Image UUID (this is the disk image)>
    |        |--- <Image UUID (this is the disk image)>.meta
    |-- master
    |   |---vms
    |       |--- <UUID>
    |             |--- <UUID>.ovf


Options:
  -h, --help            show this help message and exit
  --quiet               intended to be used with "upload" operations to reduce
                        console output. (default=False)
  --log-file=PATH       path to log file (default=/var/log/rhevm/rhevm-image-
                        uploader.log)
  --conf-file=PATH      path to configuration file
                        (default=/etc/rhevm/imageuploader.conf)
  -v, --verbose         
  -f, --force           replace like named files on the target file server
                        (default=off)

  RHEV-M Configuration:
    The options in the RHEV-M group are used by the tool to gain
    authorization to the RHEV-M REST API. The options in this group are
    available for both list and upload commands.

    -u user@rhevm.example.com, --user=user@rhevm.example.com
                        username to use with the RHEV-M REST API.  This should
                        be in UPN format.
    -r rhevm.example.com, --rhevm=rhevm.example.com
                        hostname or IP address of the RHEV-M
                        (default=localhost:8443).

  Export Storage Domain Configuration:
    The options in the upload configuration group should be provided to
    specify the export storage domain to which OVF files should be
    uploaded.

    -e EXPORT_STORAGE_DOMAIN, --export-domain=EXPORT_STORAGE_DOMAIN
                        the export storage domain to which the file(s) should
                        be uploaded
    -n NFSSERVER, --nfs-server=NFSSERVER
                        the NFS server to which the file(s) should be
                        uploaded. This option is an alternative to export-
                        domain and should not be combined with export-domain.
                        Use this when you want to upload files to a specific
                        NFS server (e.g.--nfs-
                        server=example.com:/path/to/some/dir)
    -i, --ovf-id        use this option if you do not want to update the UUID
                        of the image.  By default, the tool will generate a
                        new UUID for the image.  This ensures that there is no
                        conflict between the id of the incoming image and
                        those already in RHEV-M.
    -d, --disk-instance-id
                        use this option if do not you want to rename the
                        instance ID for each disk (i.e. InstanceId) in the
                        image. By default, this tool will generate new UUIDs
                        for disks within the image to be imported.  This
                        ensures that there are no conflicts between the disks
                        on the imported image and those within RHEV-M.
    -m, --mac-address   use this option if do not you want to remove the
                        network components from the image that will be
                        imported.  By default, this tool will remove any
                        network interface cards from the image to prevent
                        conflicts with NICs on other VMs within the RHEV-M.
                        Once the image has been imported, simply use the
                        RHEV-M to add NICs back and the RHEV-M will ensure
                        that there are no MAC address conflicts.
    -N NEW_IMAGE_NAME, --name=NEW_IMAGE_NAME
                        supply this option if you want to rename the image

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 export domains.
    3: The program encountered a problem uploading to an export domain.
    4: The program encountered a problem un-mounting and removing the temporary directory.
[root@dhcp-3-187 c53d1c87-5ce9-4134-b6a9-4b9d590840cb]# rhevm-image-uploader -u admin@internal  -r leonid_rhevm.qa.lab.tlv.redhat.com:8443 -e test_one upload /home/art_template.ovf 
Please provide the REST API password for the admin@internal RHEV-M user (CTRL+D to abort): 
[root@dhcp-3-187 c53d1c87-5ce9-4134-b6a9-4b9d590840cb]# $?
bash: 0: command not found
Comment 1 Keith Robertson 2012-09-20 09:51:23 EDT
http://gerrit.ovirt.org/8090
Comment 3 Keith Robertson 2012-09-20 09:59:52 EDT
This should be fixed in 3.1.x not the 3.0.x stream.
Comment 5 Keith Robertson 2012-09-28 14:17:35 EDT
*** Bug 858970 has been marked as a duplicate of this bug. ***
Comment 7 Ilanit Stein 2012-11-13 07:46:20 EST
1. Running rhevm-image-uploader with empty ovf file, indeed give a clear error,
without giving help menu, and this is OK:
log: 
[root@lilach-rhel tmp]# rhevm-image-uploader -u admin@internal  -r lilach-rhel.qa.lab.tlv.redhat.com:443 -e export_domain upload template.ovf 
Please provide the REST API password for the admin@internal RHEV-M user (CTRL+D to abort): 
ERROR: This archive does not contain an OVF XML file.

But, this requires a fix:

2.Running rhevm-image-uploader with CORRECT syntax and wrong port results: 
a. Error which is not clear to user (ERROR: 'NoneType' object is not iterable).
b. Give info on how to run help (INFO: Use the -h option to see usage.)

log:

[root@lilach-rhel tmp]# rhevm-image-uploader -u admin@internal  -r lilach-rhel.qa.lab.tlv.redhat.com:8080 -e export_domain upload /home/art_template.ovf 
Please provide the REST API password for the admin@internal RHEV-M user (CTRL+D to abort): 
ERROR: Problem connecting to the REST API.  Is the service available and does the CA certificate exist?
ERROR: 'NoneType' object is not iterable
INFO: Use the -h option to see usage.
Comment 8 Keith Robertson 2012-11-13 10:51:36 EST
(In reply to comment #7)
> 1. Running rhevm-image-uploader with empty ovf file, indeed give a clear
> error,
> without giving help menu, and this is OK:
> log: 
> [root@lilach-rhel tmp]# rhevm-image-uploader -u admin@internal  -r
> lilach-rhel.qa.lab.tlv.redhat.com:443 -e export_domain upload template.ovf 
> Please provide the REST API password for the admin@internal RHEV-M user
> (CTRL+D to abort): 
> ERROR: This archive does not contain an OVF XML file.
> 
> But, this requires a fix:
> 
> 2.Running rhevm-image-uploader with CORRECT syntax and wrong port results: 
> a. Error which is not clear to user (ERROR: 'NoneType' object is not
> iterable).
> b. Give info on how to run help (INFO: Use the -h option to see usage.)
> 
> log:
> 
> [root@lilach-rhel tmp]# rhevm-image-uploader -u admin@internal  -r
> lilach-rhel.qa.lab.tlv.redhat.com:8080 -e export_domain upload
> /home/art_template.ovf 
> Please provide the REST API password for the admin@internal RHEV-M user
> (CTRL+D to abort): 
> ERROR: Problem connecting to the REST API.  Is the service available and
> does the CA certificate exist?
> ERROR: 'NoneType' object is not iterable
> INFO: Use the -h option to see usage.


You are now running into a completely different problem and, I would prefer a different BZ to solve it.  I think that the original issue was solved patch in comment 2.

The new problem you are encountering is the following:

- The system upon which you are running the rhevm-image-uploader most likely does *not* have a valid CA certificate for lilach-rhel.qa.lab.tlv.redhat.com or you typed the PW wrong. The tool prints an appropriate error message [1]; however, there is a small bug that prints [2].  [2] isn't related to this original BZ (it looks the same) but it is a different problem.  The root cause for [2] is that the code is expecting a 3 tuple but is receiving 'None' from the API creation code.

[1] ERROR: Problem connecting to the REST API.  Is the service available and does the CA certificate exist?
[2] ERROR: 'NoneType' object is not iterable
Comment 9 Moran Goldboim 2012-11-14 03:32:29 EST
Ilanit, I'm moving this bug to ON_QA please verify this specific issue and open an additional bug on the issue you are having.
Comment 10 Ilanit Stein 2012-11-14 08:09:43 EST
Verified on SI24.1: help menu and error that appeared originally no longer appear.
Opened a new bug following comment 8 - Bug 876554.

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