SNAP实操
重启以后,我们手动设置snap服务,
snap_rpc.py subsystem_nvme_create Mellanox_NVMe_SNAP "Mellanox NVMe SNAP Controller"
>> {
>> "nqn": "nqn.2021-06.mlnx.snap:8b82f658f138ceaf83e3bfc261a7fb14:0",
>> "subsys_id": 0
>> }
snap_rpc.py controller_nvme_create mlx5_0 --subsys_id 0 --pf_id 0
>> {
>> "name": "NvmeEmu0pf0",
>> "cntlid": 0,
>> "version": "1.3.0",
>> "offload": false,
>> "mempool": false,
>> "max_nsid": 1024,
>> "max_namespaces": 1024
>> }
spdk_rpc.py bdev_nvme_attach_controller -b Nvme0 -t rdma -a 192.168.99.21 -f ipv4 -s 4420 -n testnqn
>> Nvme0n1
snap_rpc.py controller_nvme_namespace_attach -c NvmeEmu0pf0 spdk Nvme0n1 1
snap_rpc.py emulation_device_attach --num_msix 8 mlx5_0 virtio_blk
>> {
>> "emulation_manager": "mlx5_0",
>> "emulation_type": "virtio_blk",
>> "pci_type": "physical function",
>> "pci_index": 0
>> }
snap_rpc.py controller_virtio_blk_create mlx5_0 --bdev_type spdk --bdev Nvme0n1 --pf_id 0 --num_queues 7
>> VblkEmu0pf0
#配置好了,我们检查一下状态
#check status
snap_rpc.py controller_nvme_namespace_list -n nqn.2021-06.mlnx.snap:8b82f658f138ceaf83e3bfc261a7fb14:0 -i 0
>> {
>> "name": "NvmeEmu0pf0",
>> "cntlid": 0,
>> "Namespaces":[
>> {
>> "nsid": 1,
>> "bdev": "Nvme0n1",
>> "bdev_type": "spdk",
>> "qn": "",
>> "protocol": "",
>> "snap-direct": true
>> }
>> ]
>> }
snap_rpc.py emulation_managers_list
>> [
>> {
>> "emulation_manager": "mlx5_0",
>> "hotplug_support": true,
>> "supported_types": [
>> "nvme",
>> "virtio_blk",
>> "virtio_net"
>> ]
>> }
>> ]
spdk_rpc.py bdev_nvme_get_controllers
>> [
>> {
>> "name": "Nvme0",
>> "trid": {
>> "trtype": "RDMA",
>> "adrfam": "IPv4",
>> "traddr": "192.168.99.21",
>> "trsvcid": "4420",
>> "subnqn": "testnqn"
>> }
>> }
>> ]
snap_rpc.py controller_list
>> [
>> {
>> "mempool": false,
>> "name": "VblkEmu0pf0",
>> "emulation_manager": "mlx5_0",
>> "type": "virtio_blk",
>> "pci_index": 0,
>> "pci_bdf": "07:00.0"
>> },
>> {
>> "subnqn": "nqn.2021-06.mlnx.snap:8b82f658f138ceaf83e3bfc261a7fb14:0",
>> "cntlid": 0,
>> "version": "1.3.0",
>> "offload": false,
>> "mempool": false,
>> "max_nsid": 1024,
>> "max_namespaces": 1024,
>> "name": "NvmeEmu0pf0",
>> "emulation_manager": "mlx5_0",
>> "type": "nvme",
>> "pci_index": 0,
>> "pci_bdf": "06:00.2"
>> }
>> ]