All of lore.kernel.org
 help / color / mirror / Atom feed
* Re: [SPDK] jsonrpc API
@ 2019-07-10 17:04 Khoussi, Siham
  0 siblings, 0 replies; 5+ messages in thread
From: Khoussi, Siham @ 2019-07-10 17:04 UTC (permalink / raw)
  To: spdk

[-- Attachment #1: Type: text/plain, Size: 5042 bytes --]

Thank you Tomek for your reply. Indeed, I was based on the rpc_get_methods example to write my client.

From your reply, I understand that in order to attach parameters to the request  I need to encode them using the spdk_json_write_*(). So in this case, I tried the following:

	w = spdk_jsonrpc_begin_request(request, 1, NULL);
	spdk_json_write_object_begin(w);
	spdk_json_write_named_string(w, "method", "construct_nvme_bdev");
	spdk_json_write_named_object_begin(w, "params");
	spdk_json_write_named_string(w, "trtype", "pcie");
	spdk_json_write_named_string(w, "name", "nvme01n1");
	spdk_json_write_named_string(w, "traddr", "0000:03:00.0");
	spdk_json_write_object_end(w);
	spdk_json_write_object_end(w);
	spdk_jsonrpc_end_request(request, w);
	int s = spdk_jsonrpc_client_send_request(client, request);

I'm getting an error [*ERROR*: jsonrpc parse request failed] which is due to [SPDK_JSON_PARSE_INCOMPLETE] in [int spdk_jsonrpc_parse_request()]. Did I encode the request right? Or do you think I need to include all the parameters with omitting some?

Thank you again,
Siham


-----Original Message-----
From: SPDK <spdk-bounces(a)lists.01.org> On Behalf Of Zawadzki, Tomasz
Sent: Wednesday, July 10, 2019 4:56 AM
To: Storage Performance Development Kit <spdk(a)lists.01.org>
Subject: Re: [SPDK] jsonrpc API

Hi Siham,

Description for steps you were able to work out, show that you are already familiar with rpc_client_test.c. This is our example of using jsonrpc client library.
At this point you are able to send the JSON request to SPDK and receive response. The creation of request is still up to the app that sends the jsonrpc.
Various modules do the reverse of what you are attempting - gets requests and sends a response. For examples of decoding JSON requests and sending responses see *_rpc.c files throughout SPDK.

In order to issue proper construct_nvme_bdev RPC, best pointer on expected fields would be docs https://gcc01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fspdk.io%2Fdoc%2Fjsonrpc.html%23rpc_construct_nvme_bdev&amp;data=02%7C01%7Csiham.khoussi%40nist.gov%7C272722a4241740002dd208d705148896%7C2ab5d82fd8fa4797a93e054655c61dec%7C1%7C1%7C636983458067397193&amp;sdata=Zzx46RosGFPSLhWmM3t3l678w4TsNmVt%2FEDd4WvY9ow%3D&amp;reserved=0 or directly in C code the rpc_construct_nvme_decoders structure in bdev_nvme_rpc.c.
Filling out of this structure would follow the same scheme you've already done for rpc_get_methods, but with additional spdk_json_write_*() between spdk_jsonrpc_begin_request() and spdk_jsonrpc_client_send_request(). The request sent in this manner will be processed on SPDK side by spdk_rpc_construct_nvme_bdev() in  bdev_nvme_rpc.c.

For decoding the response, expected fields are provided in the documentation as well. First spdk_json_object_decoder needs to be created, matching the expected fields. Response can be decoded then with spdk_json_decode_object() filling out all the structure. construct_nvme_bdev method in particular returns array of strings with created nvme bdev names.

Thanks,
Tomek

> -----Original Message-----
> From: SPDK [mailto:spdk-bounces(a)lists.01.org] On Behalf Of Khoussi, 
> Siham
> (IntlAssoc)
> Sent: Tuesday, July 9, 2019 9:41 PM
> To: Storage Performance Development Kit <spdk(a)lists.01.org>
> Subject: [SPDK] jsonrpc API
> 
> Hello all,
> 
> I'm looking to use the jsonrpc api to create a client in C rather than python.
> And so far I was able to create a client, send a request "rpc_get_methods"
> using [spdk_jsonrpc_begin_request(request, 1, "rpc_get_methods")], 
> receive a response using [spdk_jsonrpc_client_get_response(client)] 
> and decode the response with  [spdk_json_decode_array(result, 
> spdk_json_decode_string, resp->method_names, RPC_MAX_METHODS, 
> &resp->method_num, sizeof(char *))].
> 
> However, I was wondering if anyone could tell me how to create a 
> request with parameters using the same API (e.g construct_nvme_bdev -b
> nvme01n1 -t pcie -a 0000:03:00.0)? And how to decode it, maybe using 
> the spdk_json_object_decoder structure? Are there existing examples in C?
> 
> Thank you again,
> Siham
> _______________________________________________
> SPDK mailing list
> SPDK(a)lists.01.org
> https://gcc01.safelinks.protection.outlook.com/?url=https%3A%2F%2Flist
> s.01.org%2Fmailman%2Flistinfo%2Fspdk&amp;data=02%7C01%7Csiham.khoussi%
> 40nist.gov%7C272722a4241740002dd208d705148896%7C2ab5d82fd8fa4797a93e05
> 4655c61dec%7C1%7C1%7C636983458067397193&amp;sdata=RHDFAwizUbm0iyQpJ6YX
> HfNYBthp8orNayjDbPMcYgI%3D&amp;reserved=0
_______________________________________________
SPDK mailing list
SPDK(a)lists.01.org
https://gcc01.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.01.org%2Fmailman%2Flistinfo%2Fspdk&amp;data=02%7C01%7Csiham.khoussi%40nist.gov%7C272722a4241740002dd208d705148896%7C2ab5d82fd8fa4797a93e054655c61dec%7C1%7C1%7C636983458067397193&amp;sdata=RHDFAwizUbm0iyQpJ6YXHfNYBthp8orNayjDbPMcYgI%3D&amp;reserved=0

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [SPDK] jsonrpc API
@ 2019-07-11  7:39 Zawadzki, Tomasz
  0 siblings, 0 replies; 5+ messages in thread
From: Zawadzki, Tomasz @ 2019-07-11  7:39 UTC (permalink / raw)
  To: spdk

[-- Attachment #1: Type: text/plain, Size: 7934 bytes --]

Hi Siham,

Another thing that just occurred to me - we actually write out the JSONs as part of saving configuration ('save_config' RPC). Meaning that for creation of JSON objects this is perfect place to take a look at. For nvme bdev, please take a look at bdev_nvme_config_json().

Please note that the code can be even simpler by providing spdk_jsonrpc_begin_request() with method name. Begin and end request functions are already responsible for managing the top level part of JSON request, as you've noticed. 
	w = spdk_jsonrpc_begin_request(request, 1, "construct_nvme_bdev");
 	spdk_json_write_named_object_begin(w, "params");
 	spdk_json_write_named_string(w, "trtype", "pcie");
 	spdk_json_write_named_string(w, "name", "nvme01n1");
 	spdk_json_write_named_string(w, "traddr", "0000:03:00.0");
 	spdk_json_write_object_end(w);
 	spdk_jsonrpc_end_request(request, w);
 	int s = spdk_jsonrpc_client_send_request(client, request);

FYI construct_nvme_bdev exposes all namespaces attached to particular NVMe controller. Provided 'name' is name for controller, each bdev name will append the number of namespace to it ("Nvme0"->"Nvme0n1"). Putting name as "nvme01n1", will result in "nvme01n1n1" bdev name - which probably was not the intention.

Thanks,
Tomek

> -----Original Message-----
> From: SPDK [mailto:spdk-bounces(a)lists.01.org] On Behalf Of Khoussi, Siham
> (IntlAssoc)
> Sent: Wednesday, July 10, 2019 11:41 PM
> To: Storage Performance Development Kit <spdk(a)lists.01.org>
> Subject: Re: [SPDK] jsonrpc API
> 
> So it seems that I don't need to close the final json bracket as
> spdk_jsonrpc_end_request() already includes
> spdk_json_write_object_end(w).
> 
> Thank you again.
> Siham
> 
> 
> 
> -----Original Message-----
> From: SPDK <spdk-bounces(a)lists.01.org> On Behalf Of Khoussi, Siham
> (IntlAssoc) via SPDK
> Sent: Wednesday, July 10, 2019 1:04 PM
> To: Storage Performance Development Kit <spdk(a)lists.01.org>
> Cc: Khoussi, Siham (IntlAssoc) <siham.khoussi(a)nist.gov>
> Subject: Re: [SPDK] jsonrpc API
> 
> Thank you Tomek for your reply. Indeed, I was based on the
> rpc_get_methods example to write my client.
> 
> From your reply, I understand that in order to attach parameters to the
> request  I need to encode them using the spdk_json_write_*(). So in this
> case, I tried the following:
> 
> 	w = spdk_jsonrpc_begin_request(request, 1, NULL);
> 	spdk_json_write_object_begin(w);
> 	spdk_json_write_named_string(w, "method",
> "construct_nvme_bdev");
> 	spdk_json_write_named_object_begin(w, "params");
> 	spdk_json_write_named_string(w, "trtype", "pcie");
> 	spdk_json_write_named_string(w, "name", "nvme01n1");
> 	spdk_json_write_named_string(w, "traddr", "0000:03:00.0");
> 	spdk_json_write_object_end(w);
> 	spdk_json_write_object_end(w);
> 	spdk_jsonrpc_end_request(request, w);
> 	int s = spdk_jsonrpc_client_send_request(client, request);
> 
> I'm getting an error [*ERROR*: jsonrpc parse request failed] which is due to
> [SPDK_JSON_PARSE_INCOMPLETE] in [int spdk_jsonrpc_parse_request()].
> Did I encode the request right? Or do you think I need to include all the
> parameters with omitting some?
> 
> Thank you again,
> Siham
> 
> 
> -----Original Message-----
> From: SPDK <spdk-bounces(a)lists.01.org> On Behalf Of Zawadzki, Tomasz
> Sent: Wednesday, July 10, 2019 4:56 AM
> To: Storage Performance Development Kit <spdk(a)lists.01.org>
> Subject: Re: [SPDK] jsonrpc API
> 
> Hi Siham,
> 
> Description for steps you were able to work out, show that you are already
> familiar with rpc_client_test.c. This is our example of using jsonrpc client
> library.
> At this point you are able to send the JSON request to SPDK and receive
> response. The creation of request is still up to the app that sends the jsonrpc.
> Various modules do the reverse of what you are attempting - gets requests
> and sends a response. For examples of decoding JSON requests and sending
> responses see *_rpc.c files throughout SPDK.
> 
> In order to issue proper construct_nvme_bdev RPC, best pointer on
> expected fields would be docs
> https://gcc01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fspdk.i
> o%2Fdoc%2Fjsonrpc.html%23rpc_construct_nvme_bdev&amp;data=02%7C
> 01%7Csiham.khoussi%40nist.gov%7Ccf65c9cbbf2a47c95af808d70558ae7a%7C
> 2ab5d82fd8fa4797a93e054655c61dec%7C1%7C1%7C636983750746130491&a
> mp;sdata=I4rQIVgD%2FfskLCWFL6vPFlpYcX%2FmA1i%2BKpinUV%2FH4Mk%
> 3D&amp;reserved=0 or directly in C code the rpc_construct_nvme_decoders
> structure in bdev_nvme_rpc.c.
> Filling out of this structure would follow the same scheme you've already
> done for rpc_get_methods, but with additional spdk_json_write_*()
> between spdk_jsonrpc_begin_request() and
> spdk_jsonrpc_client_send_request(). The request sent in this manner will be
> processed on SPDK side by spdk_rpc_construct_nvme_bdev() in
> bdev_nvme_rpc.c.
> 
> For decoding the response, expected fields are provided in the
> documentation as well. First spdk_json_object_decoder needs to be
> created, matching the expected fields. Response can be decoded then with
> spdk_json_decode_object() filling out all the structure.
> construct_nvme_bdev method in particular returns array of strings with
> created nvme bdev names.
> 
> Thanks,
> Tomek
> 
> > -----Original Message-----
> > From: SPDK [mailto:spdk-bounces(a)lists.01.org] On Behalf Of Khoussi,
> > Siham
> > (IntlAssoc)
> > Sent: Tuesday, July 9, 2019 9:41 PM
> > To: Storage Performance Development Kit <spdk(a)lists.01.org>
> > Subject: [SPDK] jsonrpc API
> >
> > Hello all,
> >
> > I'm looking to use the jsonrpc api to create a client in C rather than python.
> > And so far I was able to create a client, send a request "rpc_get_methods"
> > using [spdk_jsonrpc_begin_request(request, 1, "rpc_get_methods")],
> > receive a response using [spdk_jsonrpc_client_get_response(client)]
> > and decode the response with  [spdk_json_decode_array(result,
> > spdk_json_decode_string, resp->method_names, RPC_MAX_METHODS,
> > &resp->method_num, sizeof(char *))].
> >
> > However, I was wondering if anyone could tell me how to create a
> > request with parameters using the same API (e.g construct_nvme_bdev -b
> > nvme01n1 -t pcie -a 0000:03:00.0)? And how to decode it, maybe using
> > the spdk_json_object_decoder structure? Are there existing examples in
> C?
> >
> > Thank you again,
> > Siham
> > _______________________________________________
> > SPDK mailing list
> > SPDK(a)lists.01.org
> > https://list
> >
> s.01.org%2Fmailman%2Flistinfo%2Fspdk&amp;data=02%7C01%7Csiham.kho
> ussi%
> >
> 40nist.gov%7C272722a4241740002dd208d705148896%7C2ab5d82fd8fa4797a9
> 3e05
> >
> 4655c61dec%7C1%7C1%7C636983458067397193&amp;sdata=RHDFAwizUbm0
> iyQpJ6YX
> > HfNYBthp8orNayjDbPMcYgI%3D&amp;reserved=0
> _______________________________________________
> SPDK mailing list
> SPDK(a)lists.01.org
> https://gcc01.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.0
> 1.org%2Fmailman%2Flistinfo%2Fspdk&amp;data=02%7C01%7Csiham.khoussi
> %40nist.gov%7Ccf65c9cbbf2a47c95af808d70558ae7a%7C2ab5d82fd8fa4797a9
> 3e054655c61dec%7C1%7C1%7C636983750746130491&amp;sdata=ngjNY3uSG
> QD7RHgyxeRx%2BfP4RRBAuVzYmoLeLHEX6fU%3D&amp;reserved=0
> _______________________________________________
> SPDK mailing list
> SPDK(a)lists.01.org
> https://gcc01.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.0
> 1.org%2Fmailman%2Flistinfo%2Fspdk&amp;data=02%7C01%7Csiham.khoussi
> %40nist.gov%7Ccf65c9cbbf2a47c95af808d70558ae7a%7C2ab5d82fd8fa4797a9
> 3e054655c61dec%7C1%7C1%7C636983750746130491&amp;sdata=ngjNY3uSG
> QD7RHgyxeRx%2BfP4RRBAuVzYmoLeLHEX6fU%3D&amp;reserved=0
> _______________________________________________
> SPDK mailing list
> SPDK(a)lists.01.org
> https://lists.01.org/mailman/listinfo/spdk

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [SPDK] jsonrpc API
@ 2019-07-10 21:40 Khoussi, Siham
  0 siblings, 0 replies; 5+ messages in thread
From: Khoussi, Siham @ 2019-07-10 21:40 UTC (permalink / raw)
  To: spdk

[-- Attachment #1: Type: text/plain, Size: 5897 bytes --]

So it seems that I don't need to close the final json bracket as  spdk_jsonrpc_end_request() already includes spdk_json_write_object_end(w).

Thank you again.
Siham 



-----Original Message-----
From: SPDK <spdk-bounces(a)lists.01.org> On Behalf Of Khoussi, Siham (IntlAssoc) via SPDK
Sent: Wednesday, July 10, 2019 1:04 PM
To: Storage Performance Development Kit <spdk(a)lists.01.org>
Cc: Khoussi, Siham (IntlAssoc) <siham.khoussi(a)nist.gov>
Subject: Re: [SPDK] jsonrpc API

Thank you Tomek for your reply. Indeed, I was based on the rpc_get_methods example to write my client.

From your reply, I understand that in order to attach parameters to the request  I need to encode them using the spdk_json_write_*(). So in this case, I tried the following:

	w = spdk_jsonrpc_begin_request(request, 1, NULL);
	spdk_json_write_object_begin(w);
	spdk_json_write_named_string(w, "method", "construct_nvme_bdev");
	spdk_json_write_named_object_begin(w, "params");
	spdk_json_write_named_string(w, "trtype", "pcie");
	spdk_json_write_named_string(w, "name", "nvme01n1");
	spdk_json_write_named_string(w, "traddr", "0000:03:00.0");
	spdk_json_write_object_end(w);
	spdk_json_write_object_end(w);
	spdk_jsonrpc_end_request(request, w);
	int s = spdk_jsonrpc_client_send_request(client, request);

I'm getting an error [*ERROR*: jsonrpc parse request failed] which is due to [SPDK_JSON_PARSE_INCOMPLETE] in [int spdk_jsonrpc_parse_request()]. Did I encode the request right? Or do you think I need to include all the parameters with omitting some?

Thank you again,
Siham


-----Original Message-----
From: SPDK <spdk-bounces(a)lists.01.org> On Behalf Of Zawadzki, Tomasz
Sent: Wednesday, July 10, 2019 4:56 AM
To: Storage Performance Development Kit <spdk(a)lists.01.org>
Subject: Re: [SPDK] jsonrpc API

Hi Siham,

Description for steps you were able to work out, show that you are already familiar with rpc_client_test.c. This is our example of using jsonrpc client library.
At this point you are able to send the JSON request to SPDK and receive response. The creation of request is still up to the app that sends the jsonrpc.
Various modules do the reverse of what you are attempting - gets requests and sends a response. For examples of decoding JSON requests and sending responses see *_rpc.c files throughout SPDK.

In order to issue proper construct_nvme_bdev RPC, best pointer on expected fields would be docs https://gcc01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fspdk.io%2Fdoc%2Fjsonrpc.html%23rpc_construct_nvme_bdev&amp;data=02%7C01%7Csiham.khoussi%40nist.gov%7Ccf65c9cbbf2a47c95af808d70558ae7a%7C2ab5d82fd8fa4797a93e054655c61dec%7C1%7C1%7C636983750746130491&amp;sdata=I4rQIVgD%2FfskLCWFL6vPFlpYcX%2FmA1i%2BKpinUV%2FH4Mk%3D&amp;reserved=0 or directly in C code the rpc_construct_nvme_decoders structure in bdev_nvme_rpc.c.
Filling out of this structure would follow the same scheme you've already done for rpc_get_methods, but with additional spdk_json_write_*() between spdk_jsonrpc_begin_request() and spdk_jsonrpc_client_send_request(). The request sent in this manner will be processed on SPDK side by spdk_rpc_construct_nvme_bdev() in  bdev_nvme_rpc.c.

For decoding the response, expected fields are provided in the documentation as well. First spdk_json_object_decoder needs to be created, matching the expected fields. Response can be decoded then with spdk_json_decode_object() filling out all the structure. construct_nvme_bdev method in particular returns array of strings with created nvme bdev names.

Thanks,
Tomek

> -----Original Message-----
> From: SPDK [mailto:spdk-bounces(a)lists.01.org] On Behalf Of Khoussi, 
> Siham
> (IntlAssoc)
> Sent: Tuesday, July 9, 2019 9:41 PM
> To: Storage Performance Development Kit <spdk(a)lists.01.org>
> Subject: [SPDK] jsonrpc API
> 
> Hello all,
> 
> I'm looking to use the jsonrpc api to create a client in C rather than python.
> And so far I was able to create a client, send a request "rpc_get_methods"
> using [spdk_jsonrpc_begin_request(request, 1, "rpc_get_methods")], 
> receive a response using [spdk_jsonrpc_client_get_response(client)]
> and decode the response with  [spdk_json_decode_array(result, 
> spdk_json_decode_string, resp->method_names, RPC_MAX_METHODS, 
> &resp->method_num, sizeof(char *))].
> 
> However, I was wondering if anyone could tell me how to create a 
> request with parameters using the same API (e.g construct_nvme_bdev -b
> nvme01n1 -t pcie -a 0000:03:00.0)? And how to decode it, maybe using 
> the spdk_json_object_decoder structure? Are there existing examples in C?
> 
> Thank you again,
> Siham
> _______________________________________________
> SPDK mailing list
> SPDK(a)lists.01.org
> https://list
> s.01.org%2Fmailman%2Flistinfo%2Fspdk&amp;data=02%7C01%7Csiham.khoussi%
> 40nist.gov%7C272722a4241740002dd208d705148896%7C2ab5d82fd8fa4797a93e05
> 4655c61dec%7C1%7C1%7C636983458067397193&amp;sdata=RHDFAwizUbm0iyQpJ6YX
> HfNYBthp8orNayjDbPMcYgI%3D&amp;reserved=0
_______________________________________________
SPDK mailing list
SPDK(a)lists.01.org
https://gcc01.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.01.org%2Fmailman%2Flistinfo%2Fspdk&amp;data=02%7C01%7Csiham.khoussi%40nist.gov%7Ccf65c9cbbf2a47c95af808d70558ae7a%7C2ab5d82fd8fa4797a93e054655c61dec%7C1%7C1%7C636983750746130491&amp;sdata=ngjNY3uSGQD7RHgyxeRx%2BfP4RRBAuVzYmoLeLHEX6fU%3D&amp;reserved=0
_______________________________________________
SPDK mailing list
SPDK(a)lists.01.org
https://gcc01.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.01.org%2Fmailman%2Flistinfo%2Fspdk&amp;data=02%7C01%7Csiham.khoussi%40nist.gov%7Ccf65c9cbbf2a47c95af808d70558ae7a%7C2ab5d82fd8fa4797a93e054655c61dec%7C1%7C1%7C636983750746130491&amp;sdata=ngjNY3uSGQD7RHgyxeRx%2BfP4RRBAuVzYmoLeLHEX6fU%3D&amp;reserved=0

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [SPDK] jsonrpc API
@ 2019-07-10  8:56 Zawadzki, Tomasz
  0 siblings, 0 replies; 5+ messages in thread
From: Zawadzki, Tomasz @ 2019-07-10  8:56 UTC (permalink / raw)
  To: spdk

[-- Attachment #1: Type: text/plain, Size: 2697 bytes --]

Hi Siham,

Description for steps you were able to work out, show that you are already familiar with rpc_client_test.c. This is our example of using jsonrpc client library.
At this point you are able to send the JSON request to SPDK and receive response. The creation of request is still up to the app that sends the jsonrpc.
Various modules do the reverse of what you are attempting - gets requests and sends a response. For examples of decoding JSON requests and sending responses see *_rpc.c files throughout SPDK.

In order to issue proper construct_nvme_bdev RPC, best pointer on expected fields would be docs https://spdk.io/doc/jsonrpc.html#rpc_construct_nvme_bdev or directly in C code the rpc_construct_nvme_decoders structure in bdev_nvme_rpc.c.
Filling out of this structure would follow the same scheme you've already done for rpc_get_methods, but with additional spdk_json_write_*() between spdk_jsonrpc_begin_request() and spdk_jsonrpc_client_send_request(). The request sent in this manner will be processed on SPDK side by spdk_rpc_construct_nvme_bdev() in  bdev_nvme_rpc.c.

For decoding the response, expected fields are provided in the documentation as well. First spdk_json_object_decoder needs to be created, matching the expected fields. Response can be decoded then with spdk_json_decode_object() filling out all the structure. construct_nvme_bdev method in particular returns array of strings with created nvme bdev names.

Thanks,
Tomek

> -----Original Message-----
> From: SPDK [mailto:spdk-bounces(a)lists.01.org] On Behalf Of Khoussi, Siham
> (IntlAssoc)
> Sent: Tuesday, July 9, 2019 9:41 PM
> To: Storage Performance Development Kit <spdk(a)lists.01.org>
> Subject: [SPDK] jsonrpc API
> 
> Hello all,
> 
> I'm looking to use the jsonrpc api to create a client in C rather than python.
> And so far I was able to create a client, send a request "rpc_get_methods"
> using [spdk_jsonrpc_begin_request(request, 1, "rpc_get_methods")],
> receive a response using [spdk_jsonrpc_client_get_response(client)] and
> decode the response with  [spdk_json_decode_array(result,
> spdk_json_decode_string, resp->method_names, RPC_MAX_METHODS,
> &resp->method_num, sizeof(char *))].
> 
> However, I was wondering if anyone could tell me how to create a request
> with parameters using the same API (e.g construct_nvme_bdev -b
> nvme01n1 -t pcie -a 0000:03:00.0)? And how to decode it, maybe using the
> spdk_json_object_decoder structure? Are there existing examples in C?
> 
> Thank you again,
> Siham
> _______________________________________________
> SPDK mailing list
> SPDK(a)lists.01.org
> https://lists.01.org/mailman/listinfo/spdk

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [SPDK] jsonrpc API
@ 2019-07-09 19:40 Khoussi, Siham
  0 siblings, 0 replies; 5+ messages in thread
From: Khoussi, Siham @ 2019-07-09 19:40 UTC (permalink / raw)
  To: spdk

[-- Attachment #1: Type: text/plain, Size: 775 bytes --]

Hello all,

I'm looking to use the jsonrpc api to create a client in C rather than python. And so far I was able to create a client, send a request "rpc_get_methods" using [spdk_jsonrpc_begin_request(request, 1, "rpc_get_methods")],  receive a response using [spdk_jsonrpc_client_get_response(client)] and decode the response with  [spdk_json_decode_array(result, spdk_json_decode_string, resp->method_names, RPC_MAX_METHODS, &resp->method_num, sizeof(char *))].

However, I was wondering if anyone could tell me how to create a request with parameters using the same API (e.g construct_nvme_bdev -b nvme01n1 -t pcie -a 0000:03:00.0)? And how to decode it, maybe using the spdk_json_object_decoder structure? Are there existing examples in C?

Thank you again,
Siham

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2019-07-11  7:39 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-10 17:04 [SPDK] jsonrpc API Khoussi, Siham
  -- strict thread matches above, loose matches on Subject: below --
2019-07-11  7:39 Zawadzki, Tomasz
2019-07-10 21:40 Khoussi, Siham
2019-07-10  8:56 Zawadzki, Tomasz
2019-07-09 19:40 Khoussi, Siham

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.