Bug #2862
closedCLI: rbd create command throws inappropriate error messages
0%
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.