All of lore.kernel.org
 help / color / mirror / Atom feed
* [SPDK] Re: RPC commands to get log data from NVMe bdevs?
@ 2019-12-03 15:57 Harris, James R
  0 siblings, 0 replies; 2+ messages in thread
From: Harris, James R @ 2019-12-03 15:57 UTC (permalink / raw)
  To: spdk

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

Hi Marjorie,

Would it be possible to use the existing bdev_nvme_send_cmd RPC?  And then have a separate Python script (for example, nvme_log_page.py) that:

1) translates the user's command line options to bdev_nvme_send_cmd RPC, and
2) decodes the response into human readable format (or even JSON format) based on the log page requested

My main concern with adding these RPCs to upstream is that it would encourage extending the RPC interface for other types of NVMe commands and other types of NVMe log pages.  My preference has been to try to keep the SPDK JSON-RPC minimal, and build customizations into the client applications instead.

I do understand that some of this may be implemented more easily in C and through an explicit RPC for each log page, since the C data structure for each log page is already defined.  I haven't looked at what it might look like to decode the base64 string into the individual log page fields.  But if we had that infrastructure in place, then this could be extended to new command types and new log page types with "only" some Python code and no changes to the SPDK application itself. 

-Jim


On 12/2/19, 4:57 PM, "Krueger, Marjorie" <marjorie.krueger(a)hpe.com> wrote:

    A few weeks back there was some discussion of a desire to be able to fetch log data from NVMe bdevs, specifically the SMART log page. I have code for a few RPCs ready to push to gerrithub that address that need, just wondering if this is something the SPDK community would like to see?
    
    Here's the json.md text for the RPCs I have working now:
    
    ## bdev_nvme_log_get {#rpc_bdev_nvme_log_get}
    
    Retrieve NVMe bdev log page.
    
    
    ### Parameters
    
    Name                    | Optional | Type        | Description
    ----------------------- | -------- | ----------- | -----------
    bdev_name               | Required | string      | Bdev name
    log_identifier          | Required | number      | NVMe log page identifier
    log_length              | Required | number      | length of log page data to return
    namespace_id            | Optional | number      | Namespace identifier. If not supplied NSID 0xffffffff is used
    
    ### Result
    
    Log page result is BASE64 encoded string to be parsed by requester.
    
    ### Example
    
    Example request:
    
    ~~~
    {
      "jsonrpc": "2.0",
      "method": "bdev_nvme_log_get",
      "id": 1,
      "params": {
        "bdev_name": "Nvme1",
        "log_identifier": 2,
        "log_length": 100
      },
    }
    ~~~
    
    Example response:
    
    ~~~
    {
      "jsonrpc": "2.0",
      "id": 1,
      "result": [
        {
          "log_page_data": "ACwBZAoAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwSwAAAAAAAAAAAAAAAAAAA0YCAAAAAAAAAAAAAAAAAGbuBgAAAAAAAAAAAAAAAAA79g0AAAAAAAAAAAAAAAAAAAAAAA=="
        }
      ]
    }
    ~~~
    ## bdev_nvme_smart_log_get {#rpc_bdev_nvme_smart_log_get}
    
    Retrieve NVMe bdev SMART log page.
    
    ### Parameters
    
    Name                    | Optional | Type        | Description
    ----------------------- | -------- | ----------- | -----------
    bdev_name               | Required | string      | Bdev name
    namespace_id            | Optional | number      | Namespace identifier. If not supplied NSID 0xffffffff is used.
    
    ### Result
    
    Log page result.
    
    ### Example
    
    Example request:
    
    ~~~
    {
      "jsonrpc": "2.0",
      "method": "bdev_nvme_smart_log_get",
      "id": 1,
      "params": {
        "bdev_name": "Nvme1"
      },
    }
    ~~~
    
    Example response:
    
    ~~~
    {
      "jsonrpc": "2.0",
      "id": 1,
      "result": [
        {
            "critical_warning" : 0,
            "temperature" : 299,
            "avail_spare" : 100,
            "spare_thresh" : 10,
            "percent_used" : 0,
            "data_units_read" : 59692,
            "data_units_written" : 1,
            "host_read_commands" : 7402715,
            "host_write_commands" : 4,
            "controller_busy_time" : 0,
            "power_cycles" : 59,
            "power_on_hours" : 821,
            "unsafe_shutdowns" : 33,
            "media_errors" : 0,
            "num_err_log_entries" : 0,
            "warning_temp_time" : 0,
            "critical_comp_time" : 0,
            "temperature_sensor_1" : 299,
            "temperature_sensor_2" : 299,
            "temperature_sensor_3" : 293,
            "thm_temp1_trans_count" : 0,
            "thm_temp2_trans_count" : 0,
            "thm_temp1_total_time" : 0,
            "thm_temp2_total_time" : 0
        }
      ]
    }
    
    
    Regards,
    Marjorie
    
    _______________________________________________
    SPDK mailing list -- spdk(a)lists.01.org
    To unsubscribe send an email to spdk-leave(a)lists.01.org
    


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

* [SPDK] Re: RPC commands to get log data from NVMe bdevs?
@ 2019-12-05 22:56 Krueger, Marjorie
  0 siblings, 0 replies; 2+ messages in thread
From: Krueger, Marjorie @ 2019-12-05 22:56 UTC (permalink / raw)
  To: spdk

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

Hi Jim,
Thanks for the feedback, I'll think more about your suggested approach. As you surmised, I was going for the quickest/easiest approach and since the structs for NVMe log pages are already in a c header file, the fastest path was to add a generic "log_get" RPC, then reuse that for specific log pages by casting the response to the log struct.

As far as adding this type of feature as a new .py script - log page read functionality is pretty much already available in nvme-cli  - but the formatting is not super user-friendly, or JSON, or accessible via remote application.  My motivation was more along the lines of an RPC status interface to the nvmf target, but I can completely understand your architectural direction to avoid that kind of RPC bloat.

- Marjorie

-----Original Message-----
From: Harris, James R [mailto:james.r.harris(a)intel.com] 
Sent: Tuesday, December 3, 2019 7:57 AM
To: Storage Performance Development Kit <spdk(a)lists.01.org>
Subject: [SPDK] Re: RPC commands to get log data from NVMe bdevs?

Hi Marjorie,

Would it be possible to use the existing bdev_nvme_send_cmd RPC?  And then have a separate Python script (for example, nvme_log_page.py) that:

1) translates the user's command line options to bdev_nvme_send_cmd RPC, and
2) decodes the response into human readable format (or even JSON format) based on the log page requested

My main concern with adding these RPCs to upstream is that it would encourage extending the RPC interface for other types of NVMe commands and other types of NVMe log pages.  My preference has been to try to keep the SPDK JSON-RPC minimal, and build customizations into the client applications instead.

I do understand that some of this may be implemented more easily in C and through an explicit RPC for each log page, since the C data structure for each log page is already defined.  I haven't looked at what it might look like to decode the base64 string into the individual log page fields.  But if we had that infrastructure in place, then this could be extended to new command types and new log page types with "only" some Python code and no changes to the SPDK application itself. 

-Jim


On 12/2/19, 4:57 PM, "Krueger, Marjorie" <marjorie.krueger(a)hpe.com> wrote:

    A few weeks back there was some discussion of a desire to be able to fetch log data from NVMe bdevs, specifically the SMART log page. I have code for a few RPCs ready to push to gerrithub that address that need, just wondering if this is something the SPDK community would like to see?
    
    Here's the json.md text for the RPCs I have working now:
    
    ## bdev_nvme_log_get {#rpc_bdev_nvme_log_get}
    
    Retrieve NVMe bdev log page.
    
    
    ### Parameters
    
    Name                    | Optional | Type        | Description
    ----------------------- | -------- | ----------- | -----------
    bdev_name               | Required | string      | Bdev name
    log_identifier          | Required | number      | NVMe log page identifier
    log_length              | Required | number      | length of log page data to return
    namespace_id            | Optional | number      | Namespace identifier. If not supplied NSID 0xffffffff is used
    
    ### Result
    
    Log page result is BASE64 encoded string to be parsed by requester.
    
    ### Example
    
    Example request:
    
    ~~~
    {
      "jsonrpc": "2.0",
      "method": "bdev_nvme_log_get",
      "id": 1,
      "params": {
        "bdev_name": "Nvme1",
        "log_identifier": 2,
        "log_length": 100
      },
    }
    ~~~
    
    Example response:
    
    ~~~
    {
      "jsonrpc": "2.0",
      "id": 1,
      "result": [
        {
          "log_page_data": "ACwBZAoAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwSwAAAAAAAAAAAAAAAAAAA0YCAAAAAAAAAAAAAAAAAGbuBgAAAAAAAAAAAAAAAAA79g0AAAAAAAAAAAAAAAAAAAAAAA=="
        }
      ]
    }
    ~~~
    ## bdev_nvme_smart_log_get {#rpc_bdev_nvme_smart_log_get}
    
    Retrieve NVMe bdev SMART log page.
    
    ### Parameters
    
    Name                    | Optional | Type        | Description
    ----------------------- | -------- | ----------- | -----------
    bdev_name               | Required | string      | Bdev name
    namespace_id            | Optional | number      | Namespace identifier. If not supplied NSID 0xffffffff is used.
    
    ### Result
    
    Log page result.
    
    ### Example
    
    Example request:
    
    ~~~
    {
      "jsonrpc": "2.0",
      "method": "bdev_nvme_smart_log_get",
      "id": 1,
      "params": {
        "bdev_name": "Nvme1"
      },
    }
    ~~~
    
    Example response:
    
    ~~~
    {
      "jsonrpc": "2.0",
      "id": 1,
      "result": [
        {
            "critical_warning" : 0,
            "temperature" : 299,
            "avail_spare" : 100,
            "spare_thresh" : 10,
            "percent_used" : 0,
            "data_units_read" : 59692,
            "data_units_written" : 1,
            "host_read_commands" : 7402715,
            "host_write_commands" : 4,
            "controller_busy_time" : 0,
            "power_cycles" : 59,
            "power_on_hours" : 821,
            "unsafe_shutdowns" : 33,
            "media_errors" : 0,
            "num_err_log_entries" : 0,
            "warning_temp_time" : 0,
            "critical_comp_time" : 0,
            "temperature_sensor_1" : 299,
            "temperature_sensor_2" : 299,
            "temperature_sensor_3" : 293,
            "thm_temp1_trans_count" : 0,
            "thm_temp2_trans_count" : 0,
            "thm_temp1_total_time" : 0,
            "thm_temp2_total_time" : 0
        }
      ]
    }
    
    
    Regards,
    Marjorie
    
    _______________________________________________
    SPDK mailing list -- spdk(a)lists.01.org
    To unsubscribe send an email to spdk-leave(a)lists.01.org
    

_______________________________________________
SPDK mailing list -- spdk(a)lists.01.org
To unsubscribe send an email to spdk-leave(a)lists.01.org

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

end of thread, other threads:[~2019-12-05 22:56 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-03 15:57 [SPDK] Re: RPC commands to get log data from NVMe bdevs? Harris, James R
2019-12-05 22:56 Krueger, Marjorie

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.