[SPDK] Re: How to get transport ID from spdk_bdev

Harris, James R <james.r.harris at intel.com>
Newsgroups dev.linux.lists.spdk
Message-ID <[email protected]>
Hi Niu,

You can use spdk_bdev_dump_json_info() to get module-specific information related to a given bdev.  If the bdev is an NVMe namespace, this will include the transport ID.

I've prepared a patch that shows how to use this API: https://review.spdk.io/gerrit/c/spdk/spdk/+/4881

In the callback, you can try manually parsing the string data to extract the "pci_address" value.  There is also the spdk_json_parse() API which is probably a lot more code.

-Jim


On 10/26/20, 9:41 AM, "Andrey Kuzmin" <andrey.v.kuzmin(a)gmail.com> wrote:

    There's no readily available way to get transoprt id for nvme, but
    respective call may be added to nvme_ctrlr.c. One could the call it with
    bdev_nvme provided controller as an argument.

    Regards,
    Andrey

    On Mon, Oct 26, 2020, 19:04 Luse, Paul E <paul.e.luse(a)intel.com> wrote:

    > Hi Yawei,
    >
    > Generically the bdev layer won’t have anything like this but each bdev
    > module supports its own set of RPCs that are specific to the bdev.  Take a
    > look a the nvme bdev RPC rpc_dump_nvme_controller_info() and see if it has
    > what you need.  New RPC’s can also be added as makes sense for various use
    > cases (depending on what your inputs are desired outputs are)
    >
    > Hope that helps….
    >
    > Thx
    > Paul
    >
    > From: Niu, Yawei <yawei.niu(a)intel.com>
    > Date: Monday, October 26, 2020 at 12:09 AM
    > To: Storage Performance Development Kit <spdk(a)lists.01.org>
    > Subject: [SPDK] How to get transport ID from spdk_bdev
    > Hi,
    >
    > Is there any way to get transport ID (and ns id) of an existing spdk_bdev?
    > I think that could be useful for the applications built upon bdev layer and
    > want to know the transport ID and namespace ID where the bdev is located,
    > but I failed to find such kind of exported interfaces.
    > I’m wondering if this controller information is deliberately being hidden
    > behind bdev layer? In our use case, we just want to get the association of
    > bdev and ctrlr/ns for configuration management purpose.
    >
    > Thanks
    > -Niu
    > _______________________________________________
    > 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
    >
    _______________________________________________
    SPDK mailing list -- spdk(a)lists.01.org
    To unsubscribe send an email to spdk-leave(a)lists.01.org
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.