ceph / ceph-iscsi

Ceph iSCSI tools
GNU General Public License v3.0
62 stars 59 forks source link

gwcli return code is always 0 when invocation includes a command to run #232

Open anmayes opened 3 years ago

anmayes commented 3 years ago

A non-zero sys.exit should be reported when a command fails.

Command below should fail and report the rbd image already exists.

# gwcli /disks/ create pool=rbd image=iscsi-test-image size=100G
# echo $?
0
#
2021-03-10 21:37:14,373 DEBUG    [ceph.py:33:__init__()] Adding ceph cluster 'ceph' to the UI
2021-03-10 21:37:14,711 DEBUG    [ceph.py:241:populate()] Fetching ceph osd information
2021-03-10 21:37:14,783 DEBUG    [ceph.py:150:update_state()] Querying ceph for state information
2021-03-10 21:37:14,994 DEBUG    [storage.py:105:refresh()] Refreshing disk information from the config object
2021-03-10 21:37:14,994 DEBUG    [storage.py:109:refresh()] - Scanning will use 8 scan threads
2021-03-10 21:37:15,121 DEBUG    [storage.py:135:refresh()] - rbd image scan complete: 1s
2021-03-10 21:37:15,123 DEBUG    [gateway.py:378:refresh()] Refreshing gateway & client information
2021-03-10 21:37:15,431 DEBUG    [gateway.py:935:refresh()] - checking iSCSI/API ports on esg4bel40.mastercard.int
2021-03-10 21:37:15,699 DEBUG    [gateway.py:935:refresh()] - checking iSCSI/API ports on esg4bel38.mastercard.int
2021-03-10 21:37:16,245 DEBUG    [ceph.py:150:update_state()] Querying ceph for state information
2021-03-10 21:37:16,308 DEBUG    [ceph.py:261:refresh()] Gathering pool stats for cluster 'ceph'
2021-03-10 21:37:16,364 DEBUG    [storage.py:262:ui_command_create()] CMD: /disks/ create pool=rbd image=iscsi-test-image size=100G count=1
2021-03-10 21:37:16,365 DEBUG    [storage.py:281:_valid_pool()] pool 'rbd' is ok to use
2021-03-10 21:37:16,365 DEBUG    [storage.py:304:create_disk()] Creating/mapping disk rbd/iscsi-test-image
2021-03-10 21:37:16,365 DEBUG    [storage.py:317:create_disk()] Issuing disk create request
2021-03-10 21:37:16,522 ERROR    [storage.py:369:create_disk()] Failed : at least one rbd image(s) with that name/prefix is already defined

For reference: https://github.com/ceph/ceph-iscsi/blob/b5355b8e61e58f3c4c1231f6a6f93dfc1bf1a156/gwcli.py#L120