nbd/rpc: make get_nbd_disks nbd_device param optional

Change-Id: Ie56d5908af306eec75a360a7ce6078ba93bb2f4f
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/411746
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
This commit is contained in:
Daniel Verkamp 2018-05-18 09:49:10 -07:00
parent 75896c2510
commit e95f0bb756

View File

@ -245,7 +245,7 @@ free_rpc_get_nbd_disks(struct rpc_get_nbd_disks *r)
} }
static const struct spdk_json_object_decoder rpc_get_nbd_disks_decoders[] = { static const struct spdk_json_object_decoder rpc_get_nbd_disks_decoders[] = {
{"nbd_device", offsetof(struct rpc_get_nbd_disks, nbd_device), spdk_json_decode_string}, {"nbd_device", offsetof(struct rpc_get_nbd_disks, nbd_device), spdk_json_decode_string, true},
}; };
static void static void
@ -262,12 +262,9 @@ spdk_rpc_get_nbd_disks(struct spdk_jsonrpc_request *request,
&req)) { &req)) {
SPDK_ERRLOG("spdk_json_decode_object failed\n"); SPDK_ERRLOG("spdk_json_decode_object failed\n");
goto invalid; goto invalid;
} else { }
if (req.nbd_device == NULL) {
SPDK_ERRLOG("missing nbd_device param\n");
goto invalid;
}
if (req.nbd_device) {
nbd = spdk_nbd_disk_find_by_nbd_path(req.nbd_device); nbd = spdk_nbd_disk_find_by_nbd_path(req.nbd_device);
if (nbd == NULL) { if (nbd == NULL) {
SPDK_ERRLOG("nbd device '%s' does not exist\n", req.nbd_device); SPDK_ERRLOG("nbd device '%s' does not exist\n", req.nbd_device);