sysfs-class-rnbd-client 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. What: /sys/class/rnbd-client
  2. Date: Feb 2020
  3. KernelVersion: 5.7
  4. Contact: Jack Wang <jinpu.wang@cloud.ionos.com> Danil Kipnis <danil.kipnis@cloud.ionos.com>
  5. Description: Provide information about RNBD-client.
  6. All sysfs files that are not read-only provide the usage information on read:
  7. Example::
  8. # cat /sys/class/rnbd-client/ctl/map_device
  9. > Usage: echo "sessname=<name of the rtrs session> path=<[srcaddr,]dstaddr>
  10. > [path=<[srcaddr,]dstaddr>] device_path=<full path on remote side>
  11. > [access_mode=<ro|rw|migration>] > map_device
  12. >
  13. > addr ::= [ ip:<ipv4> | ip:<ipv6> | gid:<gid> ]
  14. What: /sys/class/rnbd-client/ctl/map_device
  15. Date: Feb 2020
  16. KernelVersion: 5.7
  17. Contact: Jack Wang <jinpu.wang@cloud.ionos.com> Danil Kipnis <danil.kipnis@cloud.ionos.com>
  18. Description: Expected format is the following::
  19. sessname=<name of the rtrs session>
  20. path=<[srcaddr,]dstaddr> [path=<[srcaddr,]dstaddr> ...]
  21. device_path=<full path on remote side>
  22. [access_mode=<ro|rw|migration>]
  23. Where:
  24. sessname:
  25. accepts a string not bigger than 256 chars, which identifies
  26. a given session on the client and on the server.
  27. I.e. "clt_hostname-srv_hostname" could be a natural choice.
  28. path:
  29. describes a connection between the client and the server by
  30. specifying destination and, when required, the source address.
  31. The addresses are to be provided in the following format::
  32. ip:<IPv6>
  33. ip:<IPv4>
  34. gid:<GID>
  35. for example::
  36. path=ip:10.0.0.66
  37. The single addr is treated as the destination.
  38. The connection will be established to this server from any client IP address.
  39. ::
  40. path=ip:10.0.0.66,ip:10.0.1.66
  41. First addr is the source address and the second is the destination.
  42. If multiple "path=" options are specified multiple connection
  43. will be established and data will be sent according to
  44. the selected multipath policy (see RTRS mp_policy sysfs entry description).
  45. device_path:
  46. Path to the block device on the server side. Path is specified
  47. relative to the directory on server side configured in the
  48. 'dev_search_path' module parameter of the rnbd_server.
  49. The rnbd_server prepends the <device_path> received from client
  50. with <dev_search_path> and tries to open the
  51. <dev_search_path>/<device_path> block device. On success,
  52. a /dev/rnbd<N> device file, a /sys/block/rnbd_client/rnbd<N>/
  53. directory and an entry in /sys/class/rnbd-client/ctl/devices
  54. will be created.
  55. If 'dev_search_path' contains '%SESSNAME%', then each session can
  56. have different devices namespace, e.g. server was configured with
  57. the following parameter "dev_search_path=/run/rnbd-devs/%SESSNAME%",
  58. client has this string "sessname=blya device_path=sda", then server
  59. will try to open: /run/rnbd-devs/blya/sda.
  60. access_mode:
  61. the access_mode parameter specifies if the device is to be
  62. mapped as "ro" read-only or "rw" read-write. The server allows
  63. a device to be exported in rw mode only once. The "migration"
  64. access mode has to be specified if a second mapping in read-write
  65. mode is desired.
  66. By default "rw" is used.
  67. Exit Codes:
  68. If the device is already mapped it will fail with EEXIST. If the input
  69. has an invalid format it will return EINVAL. If the device path cannot
  70. be found on the server, it will fail with ENOENT.
  71. Finding device file after mapping
  72. ---------------------------------
  73. After mapping, the device file can be found by:
  74. o The symlink /sys/class/rnbd-client/ctl/devices/<device_id>
  75. points to /sys/block/<dev-name>. The last part of the symlink destination
  76. is the same as the device name. By extracting the last part of the
  77. path the path to the device /dev/<dev-name> can be build.
  78. * /dev/block/$(cat /sys/class/rnbd-client/ctl/devices/<device_id>/dev)
  79. How to find the <device_id> of the device is described on the next
  80. section.
  81. What: /sys/class/rnbd-client/ctl/devices/
  82. Date: Feb 2020
  83. KernelVersion: 5.7
  84. Contact: Jack Wang <jinpu.wang@cloud.ionos.com> Danil Kipnis <danil.kipnis@cloud.ionos.com>
  85. Description: For each device mapped on the client a new symbolic link is created as
  86. /sys/class/rnbd-client/ctl/devices/<device_id>, which points
  87. to the block device created by rnbd (/sys/block/rnbd<N>/).
  88. The <device_id> of each device is created as follows:
  89. - If the 'device_path' provided during mapping contains slashes ("/"),
  90. they are replaced by exclamation mark ("!") and used as as the
  91. <device_id>. Otherwise, the <device_id> will be the same as the
  92. "device_path" provided.