]> git.proxmox.com Git - ceph.git/blob - ceph/src/spdk/scripts/rpc/nvme.py
update sources to ceph Nautilus 14.2.1
[ceph.git] / ceph / src / spdk / scripts / rpc / nvme.py
1
2
3 def send_nvme_cmd(client, name, cmd_type, data_direction, cmdbuf,
4 data=None, metadata=None,
5 data_len=None, metadata_len=None,
6 timeout_ms=None):
7 """Send one NVMe command
8
9 Args:
10 name: Name of the operating NVMe controller
11 cmd_type: Type of nvme cmd. Valid values are: admin, io
12 data_direction: Direction of data transfer. Valid values are: c2h, h2c
13 cmdbuf: NVMe command encoded by base64 urlsafe
14 data: Data transferring to controller from host, encoded by base64 urlsafe
15 metadata: metadata transferring to controller from host, encoded by base64 urlsafe
16 data_length: Data length required to transfer from controller to host
17 metadata_length: Metadata length required to transfer from controller to host
18 timeout-ms: Command execution timeout value, in milliseconds, if 0, don't track timeout
19
20 Returns:
21 NVMe completion queue entry, requested data and metadata, all are encoded by base64 urlsafe.
22 """
23 params = {'name': name,
24 'cmd_type': cmd_type,
25 'data_direction': data_direction,
26 'cmdbuf': cmdbuf}
27
28 if data:
29 params['data'] = data
30 if metadata:
31 params['metadata'] = metadata
32 if data_len:
33 params['data_len'] = data_len
34 if metadata_len:
35 params['metadata_len'] = metadata_len
36 if timeout_ms:
37 params['timeout_ms'] = timeout_ms
38
39 return client.call('send_nvme_cmd', params)
40
41
42 def get_nvme_controllers(client, name=None):
43 """Get information about NVMe controllers.
44
45 Args:
46 name: NVMe controller name to query (optional; if omitted, query all NVMe controllers)
47
48 Returns:
49 List of NVMe controller information objects.
50 """
51 params = {}
52 if name:
53 params['name'] = name
54 return client.call('get_nvme_controllers', params)