Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gateway CLI reports Created bdev ceph<n>: True for non existing rbd image in ceph rbd pool #84

Closed
rahullepakshi opened this issue Mar 13, 2023 · 2 comments

Comments

@rahullepakshi
Copy link
Contributor

rahullepakshi commented Mar 13, 2023

When tried to create a bdev with no prior rbd image existence,
[1]gateway server reports below -
INFO:control.grpc:Received request to create bdev ceph16 from rbd/image15 with block size 4096 [2023-03-13 06:12:42.616407] bdev_rbd.c: 323:bdev_rbd_init_context: *ERROR*: Failed to open specified rbd device [2023-03-13 06:12:42.616938] bdev_rbd.c: 360:bdev_rbd_init: *ERROR*: Cannot init rbd context for rbd=0x396a1a0 [2023-03-13 06:12:42.617006] bdev_rbd.c:1253:bdev_rbd_create: *NOTICE*: Add ceph16 rbd disk to lun INFO:control.grpc:create_bdev: ceph16 DEBUG:control.state:omap_key generated: bdev_ceph16

whereas,
[2]Gateway CLI reports as,
`# python3 -m control.cli create_bdev -i image15 -p rbd -b ceph16

INFO:main:Created bdev ceph16: True
`

Ceph rbd pool
[ceph: root@ceph-rlepaksh-nvmeof-luwu0r-node1-installer /]# rbd ls rbd
image10
image11
image12
image13
image14
test_image1
test_image2
test_image3
test_image4
test_image5
test_image6
test_image7
test_image8
test_image9

Gateway CLi should report False status on bdev creation for non exisitng rbd image and omap key should not be generated?

@trociny
Copy link
Contributor

trociny commented Mar 19, 2023

I believe it is fixed in newer versions of spdk to properly return an error in this case. Here is an output when trying this on wip-spdk-23.01 branch from #79:

adonis:~/ceph/ceph-nvmeof.upstream% python3 -m control.cli create_bdev -i test -p rbd -b Ceph0 
INFO:__main__:Created bdev Ceph0: True
adonis:~/ceph/ceph-nvmeof.upstream% python3 -m control.cli create_bdev -i test1 -p rbd -b Ceph1
ERROR:__main__:Failed to create bdev: 
 <_InactiveRpcError of RPC that terminated with:
        status = StatusCode.INTERNAL
        details = "request:
{
  "pool_name": "rbd",
  "rbd_name": "test1",
  "block_size": 4096,
  "name": "Ceph1",
  "method": "bdev_rbd_create",
  "req_id": 3
}
Got JSON-RPC error response
response:
{
  "code": -1,
  "message": "Operation not permitted"
}"
        debug_error_string = "UNKNOWN:Error received from peer ipv4:127.0.0.1:5500 {grpc_message:"request:\n{\n  \"pool_name\": \"rbd\",\n  \"rbd_name\": \"test1\",\n  \"block_size\": 4096,\n  \"name\": \"Ceph1\",\n  \"method\": \"bdev_rbd_create\",\n  \"req_id\": 3\n}\nGot JSON-RPC error response\nresponse:\n{\n  \"code\": -1,\n  \"message\": \"Operation not permitted\"\n}", grpc_status:13, created_time:"2023-03-19T09:30:27.573848644+00:00"}"

I am not happy though that the spdk return "code -1 Operation not permitted", which is misleading. I would expect EINVAL or ENOENT. I suspect there is a bug there: a function always returns -1 in the case of any error and one needs to check errno for the error code instead of using the return value of the function.

@rahullepakshi
Copy link
Contributor Author

rahullepakshi commented Apr 21, 2023

This is fixed in newer version of SPDK

# python3 -m control.cli create_bdev -i image101 -p rbd_test -b ceph101
ERROR:__main__:Failed to create bdev:
 <_InactiveRpcError of RPC that terminated with:
        status = StatusCode.INTERNAL
        details = "request:
{
  "pool_name": "rbd_test",
  "rbd_name": "image101",
  "block_size": 4096,
  "name": "ceph101",
  "method": "bdev_rbd_create",
  "req_id": 209
}
Got JSON-RPC error response
response:
{
  "code": -1,
  "message": "Operation not permitted"
}"
        debug_error_string = "UNKNOWN:Error received from peer ipv4:10.0.210.249:5500 {created_time:"2023-04-21T02:08:25.811851555-04:00", grpc_status:13, grpc_message:"request:\n{\n  \"pool_name\": \"rbd_test\",\n  \"rbd_name\": \"image101\",\n  \"block_size\": 4096,\n  \"name\": \"ceph101\",\n  \"method\": \"bdev_rbd_create\",\n  \"req_id\": 209\n}\nGot JSON-RPC error response\nresponse:\n{\n  \"code\": -1,\n  \"message\": \"Operation not permitted\"\n}"}"

@epuertat epuertat added this to NVMe-oF May 21, 2023
@github-project-automation github-project-automation bot moved this to 🆕 New in NVMe-oF May 21, 2023
@epuertat epuertat moved this from 🆕 New to ✅ Done in NVMe-oF May 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

No branches or pull requests

2 participants