Project

General

Profile

Bug #2862

CLI: rbd create command throws inappropriate error messages

Added by Tamilarasi muthamizhan over 11 years ago. Updated almost 9 years ago.

Status:
Resolved
Priority:
Normal
Assignee:
-
Target version:
-
% Done:

0%

Source:
Q/A
Tags:
Backport:
Regression:
No
Severity:
Reviewed:
Affected Versions:
ceph-qa-suite:
Pull request ID:
Crash signature (v1):
Crash signature (v2):

Description

Ceph Version: 0.48

When tried a few negative test cases using "rbd create command", found that the command displayed inappropriate error messages.

1. Creating a RBD image with size=-1 creates RBD image with size 15 EB.

ubuntu@burnupi64:~$ rbd create rbd/rbd_img1 --size -1
ubuntu@burnupi64:~$ rbd info rbd_img1
rbd image 'rbd_img1':
size 15 EB in 4398046511103 objects
order 22 (4096 KB objects)
block_name_prefix: rb.0.6
parent: (pool -1)

Expected output: Error message "invalid value for size" should be displayed

2. Create RBD image with order=0 creates a RBD image with default order 22.

ubuntu@burnupi64:~$ rbd create rbd/rbd_img3 --size 10 --order 0
ubuntu@burnupi64:~$ rbd info rbd_img3
rbd image 'rbd_img3':
size 10240 KB in 2 objects
order 22 (4096 KB objects)
block_name_prefix: rb.0.8
parent: (pool -1)

Expected Output: Error message should be displayed "order must be between 12 (4 KB) and 25 (32 MB)"

3. Creating a RBD image with no value for size followed by image name throws inappropriate error message

ubuntu@burnupi64:~$ rbd create --size --image rbd_10
strict_strtoll: expected integer, got: '--image'

Expected Output: Error message displayed should be "Option --size requires an argument".

NOTE: Please note that this error message is displayed only when the order of the parameters is changed. The following command returns expected output.

ubuntu@burnupi64:~$ rbd create --image rbd_img4 --size
Option --size requires an argument.

4. Creating a rbd image with invalid values for "size" parameter throws inappropriate error message.

ubuntu@burnupi64:~$ rbd create rbd/img_abc --size 10g
strict_strtoll: garbage at end of string. got: '10g'
ubuntu@burnupi64:~$ rbd create rbd/img_abc --size 10.12
strict_strtoll: garbage at end of string. got: '10.12'
ubuntu@burnupi64:~$ rbd create rbd/img_abc --size 10#@#
strict_strtoll: garbage at end of string. got: '10#
@#'

Expected Output: Error message displayed should be "Invalid value for option size"

5. Create RBD image with a huge value for size reports error as mentioned below,
ubuntu@burnupi64:~$ rbd create rbd/rbd_img2 --size 10240000000000000000
strict_strtoll: integer underflow or overflow parsing '10240000000000000000'

Expected output: Error message displayed should be appropriate.

Associated revisions

Revision b0172d87 (diff)
Added by Rajesh Nambiar almost 9 years ago

rbd: create command throws inappropriate error messages

Fixes: #2862

Changes related to rbd file

Changes to rbd.cc
-----------------

Change 1: line# 2744 to 2747

If the option is --order then do the check of its value if its less
than 12 or greaterthan 25 then throw error. Correct value of --order
is 12 to 25.

Change 2: Removal of validation from line# 3205 to 3209

Since the check for correct value of --order is done before hence the
check here is not needed.

Signed-off-by: Rajesh Nambiar <>

History

#1 Updated by Sage Weil almost 11 years ago

  • Project changed from Ceph to rbd

#2 Updated by Sage Weil over 10 years ago

  • Assignee set to Tamilarasi muthamizhan

#3 Updated by Tamilarasi muthamizhan over 10 years ago

  • Assignee changed from Tamilarasi muthamizhan to Josh Durgin

all the test cases mentioned in the bug except the first one still behaves in the same manner, when tested on dumpling [v0.69]

assigining back to Josh to fix these issues

#4 Updated by Josh Durgin almost 9 years ago

  • Assignee deleted (Josh Durgin)

#5 Updated by Josh Durgin almost 9 years ago

  • Status changed from New to Resolved

Also available in: Atom PDF