{"action":"created","issue":{"url":"https://api.github.com/repos/spdk/spdk/issues/389","repository_url":"https://api.github.com/repos/spdk/spdk","labels_url":"https://api.github.com/repos/spdk/spdk/issues/389/labels{/name}","comments_url":"https://api.github.com/repos/spdk/spdk/issues/389/comments","events_url":"https://api.github.com/repos/spdk/spdk/issues/389/events","html_url":"https://github.com/spdk/spdk/issues/389","id":346873131,"node_id":"MDU6SXNzdWUzNDY4NzMxMzE=","number":389,"title":"Can't use nvme bdev's name to delete the bdev","user":{"login":"ChenWang01","id":28883265,"node_id":"MDQ6VXNlcjI4ODgzMjY1","avatar_url":"https://avatars1.githubusercontent.com/u/28883265?v=4","gravatar_id":"","url":"https://api.github.com/users/ChenWang01","html_url":"https://github.com/ChenWang01","followers_url":"https://api.github.com/users/ChenWang01/followers","following_url":"https://api.github.com/users/ChenWang01/following{/other_user}","gists_url":"https://api.github.com/users/ChenWang01/gists{/gist_id}","starred_url":"https://api.github.com/users/ChenWang01/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ChenWang01/subscriptions","organizations_url":"https://api.github.com/users/ChenWang01/orgs","repos_url":"https://api.github.com/users/ChenWang01/repos","events_url":"https://api.github.com/users/ChenWang01/events{/privacy}","received_events_url":"https://api.github.com/users/ChenWang01/received_events","type":"User","site_admin":false},"labels":[{"id":235898962,"node_id":"MDU6TGFiZWwyMzU4OTg5NjI=","url":"https://api.github.com/repos/spdk/spdk/labels/bug","name":"bug","color":"fc2929","default":true}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2018-08-02T06:13:00Z","updated_at":"2018-08-02T07:07:42Z","closed_at":null,"author_association":"CONTRIBUTOR","body":"Can't use the nvme bdev's name to delete the bdev.\r\nCan use nvme conttroller's name to delete the bdev.\r\n\r\n## Expected Behavior\r\nCan use the nvme bdev's name to delete the bdev.\r\n\r\n## Current Behavior\r\n```\r\n/bdevs/nvme> delete nvme0n1\r\nGot JSON-RPC error response\r\nrequest:\r\n{\r\n  \"params\": {\r\n    \"name\": \"nvme0n1\"\r\n  },\r\n  \"jsonrpc\": \"2.0\",\r\n  \"method\": \"delete_nvme_controller\",\r\n  \"id\": 1\r\n}\r\nresponse:\r\n{\r\n  \"message\": \"No such device\",\r\n  \"code\": -32602\r\n}\r\n\r\n./rpc.py delete_nvme_controller nvme0n1\r\nGot JSON-RPC error response\r\nrequest:\r\n{\r\n  \"params\": {\r\n    \"name\": \"nvme0n1\"\r\n  },\r\n  \"jsonrpc\": \"2.0\",\r\n  \"method\": \"delete_nvme_controller\",\r\n  \"id\": 1\r\n}\r\nresponse:\r\n{\r\n  \"message\": \"No such device\",\r\n  \"code\": -32602\r\n}\r\n```\r\n\r\n## Possible Solution\r\n```\r\n--- a/lib/bdev/nvme/bdev_nvme.c\r\n+++ b/lib/bdev/nvme/bdev_nvme.c\r\n@@ -782,7 +782,7 @@ nvme_ctrlr_get_by_name(const char *name)\r\n        }\r\n\r\n        TAILQ_FOREACH(nvme_ctrlr, &g_nvme_ctrlrs, tailq) {\r\n-               if (strcmp(name, nvme_ctrlr->name) == 0) {\r\n+               if (strcmp(name, nvme_ctrlr->name) == 0 || strcmp(name, nvme_ctrlr->bdevs->disk.name) == 0) {\r\n                        return nvme_ctrlr;\r\n                }\r\n        }\r\n\r\n```\r\n## Steps to Reproduce\r\n<!--- Provide a link to a live example, or an unambiguous set of steps to -->\r\n<!--- reproduce this bug. Include code to reproduce, if relevant -->\r\n```\r\n1. ./app/spdk_tgt/spdk_tgt\r\n2. ./scripts/spdkcli.py\r\n3. cd bdevs/nvme\r\n4. create name=nvme0 trtype=PCIe traddr=0000.03.00.0\r\n5. delete nvme0n1\r\n```\r\n\r\n## Context (Environment including OS version, SPDK version, etc.)\r\nOS: Fedora release 27 (Twenty Seven)\r\nLinux version: 4.17.3-100.fc27.x86_64\r\ngcc version: 7.3.1 20180303 (Red Hat 7.3.1-5) (GCC)\r\nSPDK: master (commit id: c9e5777ede291cc8a5e9166e6c1979174b545c96)\r\n"},"comment":{"url":"https://api.github.com/repos/spdk/spdk/issues/comments/409828434","html_url":"https://github.com/spdk/spdk/issues/389#issuecomment-409828434","issue_url":"https://api.github.com/repos/spdk/spdk/issues/389","id":409828434,"node_id":"MDEyOklzc3VlQ29tbWVudDQwOTgyODQzNA==","user":{"login":"Maciej-Szwed","id":28860873,"node_id":"MDQ6VXNlcjI4ODYwODcz","avatar_url":"https://avatars3.githubusercontent.com/u/28860873?v=4","gravatar_id":"","url":"https://api.github.com/users/Maciej-Szwed","html_url":"https://github.com/Maciej-Szwed","followers_url":"https://api.github.com/users/Maciej-Szwed/followers","following_url":"https://api.github.com/users/Maciej-Szwed/following{/other_user}","gists_url":"https://api.github.com/users/Maciej-Szwed/gists{/gist_id}","starred_url":"https://api.github.com/users/Maciej-Szwed/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Maciej-Szwed/subscriptions","organizations_url":"https://api.github.com/users/Maciej-Szwed/orgs","repos_url":"https://api.github.com/users/Maciej-Szwed/repos","events_url":"https://api.github.com/users/Maciej-Szwed/events{/privacy}","received_events_url":"https://api.github.com/users/Maciej-Szwed/received_events","type":"User","site_admin":false},"created_at":"2018-08-02T07:07:42Z","updated_at":"2018-08-02T07:07:42Z","author_association":"CONTRIBUTOR","body":"The idea behind \"delete\" command in SPDK-CLI and delete_nvme_controller command is to detach NVMe device from SPDK. I don't see any point in removing one of the controller's bdev, but leaving other bdev from this controller and controller itself still available in SPDK. That's way we decide to do the deletion using controllers name instead of one of its bdev. \r\nYou can also look at this from another point:\r\nIf you remove all the bdevs within particular controller you won't be able to create those bdevs again as the controller still exists and you cannot use construct_nvme_bdev command to restore the bdevs. In current implementation, after deleting controller, you can restore it with all its bdevs using construct_nvme_bdev command."}}
{"actor":{"display_login":"Maciej-Szwed"}}