xref: /spdk/proto/sma.proto (revision 58549382d02320e5d13bd57a16e33c39dc648848)
1syntax = "proto3";
2
3import "nvme.proto";
4import "virtio_blk.proto";
5import "nvmf_tcp.proto";
6import "nvmf.proto";
7
8// This file provides the generic definitions for the Storage Management Agent
9// gRPC calls.  All of the methods are supposed to be idempotent.  Errors are
10// reported as standard gRPC status codes.
11
12package sma;
13
14option go_package = "spdk.io/sma";
15
16// Enumeration defining types of devices
17enum DeviceType {
18  DEVICE_TYPE_INVALID = 0;
19  DEVICE_TYPE_NVME = 1;
20  DEVICE_TYPE_VIRTIO_BLK = 2;
21  DEVICE_TYPE_NVMF_TCP = 3;
22}
23
24// Volume's crypto parameters
25message VolumeCryptoParameters {
26  // Key to be used for encryption
27  bytes key = 1;
28  // Second key (only required by some ciphers)
29  bytes key2 = 2;
30  enum Cipher {
31    AES_CBC = 0;
32    AES_XTS = 1;
33  }
34  // Cipher to use
35  Cipher cipher = 3;
36}
37
38// Parameters describing a volume
39message VolumeParameters {
40  // Volume GUID/UUID
41  bytes volume_id = 1;
42  oneof connection_params {
43    // NVMeoF volume
44    nvmf.VolumeConnectionParameters nvmf = 2;
45  }
46  // Crypto parameters (optional)
47  VolumeCryptoParameters crypto = 3;
48}
49
50// Create device request
51message CreateDeviceRequest {
52  // Volume to immediately attach to the created device.  This field may be
53  // optional for some device types (e.g. NVMe), while it may be required for
54  // others (e.g. virtio-blk).
55  VolumeParameters volume = 1;
56  // Device-specific parameters
57  oneof params {
58    // NVMe parameters
59    nvme.DeviceParameters nvme = 2;
60    // Virtio-blk parameters
61    virtio_blk.DeviceParameters virtio_blk = 3;
62    // NVMe/TCP parameters
63    nvmf_tcp.DeviceParameters nvmf_tcp = 4;
64  }
65}
66
67// Create device response
68message CreateDeviceResponse {
69  // Device handle that can uniquely identify a device within an instance of
70  // Storage Management Agent
71  string handle = 1;
72}
73
74// Delete device request
75message DeleteDeviceRequest {
76  // Device handle
77  string handle = 1;
78}
79
80// Delete device response
81message DeleteDeviceResponse {}
82
83// Attach volume request
84message AttachVolumeRequest {
85  // Volume parameters
86  VolumeParameters volume = 1;
87  // Device handle
88  string device_handle = 2;
89}
90
91// Attach volume response
92message AttachVolumeResponse {}
93
94// Detach volume request
95message DetachVolumeRequest {
96  // Volume GUID/UUID
97  bytes volume_id = 1;
98  // Device handle
99  string device_handle = 2;
100}
101
102// Detach volume response
103message DetachVolumeResponse {}
104
105// QoS limit values.  0 means unlimited, while UINT64_MAX means to leave the
106// current limit value unchanged.  If one of the limits isn't supported by a
107// given device/volume, it must be set to 0.
108message QosLimit {
109  // Read kIOPS
110  uint64 rd_iops = 1;
111  // Write kIOPS
112  uint64 wr_iops = 2;
113  // Read/write kIOPS
114  uint64 rw_iops = 3;
115  // Read bandwidth (MB/s)
116  uint64 rd_bandwidth = 4;
117  // Write bandwidth (MB/s)
118  uint64 wr_bandwidth = 5;
119  // Read/write bandwidth (MB/s)
120  uint64 rw_bandwidth = 6;
121}
122
123// SetQos request
124message SetQosRequest {
125  // Device handle
126  string device_handle = 1;
127  // GUID/UUID of a volume to configure QoS on.  If this parameter is omitted,
128  // the QoS will be set up on the whole device (all volumes attached to that
129  // device will share QoS settings).  Some device types might only support
130  // configuring QoS on per-device (volume_id must be empty) or per-volume level
131  // (volume_id cannot be empty).  This information can be obtained by sending a
132  // GetQosCapabilities request.
133  bytes volume_id = 2;
134  // Maximum allowed IOPS/bandwidth
135  QosLimit maximum = 3;
136}
137
138// SetQos response
139message SetQosResponse {}
140
141// Get QoS capabilities request
142message GetQosCapabilitiesRequest {
143  // Type of a device to query for QoS capabilities
144  DeviceType device_type = 1;
145}
146
147// Get QoS capabilities response
148message GetQosCapabilitiesResponse {
149  message QosCapabilities {
150    // Read IOPS
151    bool rd_iops = 1;
152    // Write IOPS
153    bool wr_iops = 2;
154    // Read/write IOPS
155    bool rw_iops = 3;
156    // Read bandwidth
157    bool rd_bandwidth = 4;
158    // Write bandwidth
159    bool wr_bandwidth = 5;
160    // Read/write bandwidth
161    bool rw_bandwidth = 6;
162  }
163  // Device level maximum QoS limits
164  QosCapabilities max_device_caps = 1;
165  // Volume level maximum QoS limits
166  QosCapabilities max_volume_caps = 2;
167};
168
169// Storage Management Agent gRPC service definition
170service StorageManagementAgent {
171  // Creates a new device.  A device is an entity that can be used to expose
172  // volumes (e.g. an NVMeoF subsystem).
173  rpc CreateDevice (CreateDeviceRequest)
174    returns (CreateDeviceResponse) {}
175  // Deletes a device.  It is only allowed to delete a device with volumes still
176  // attached if that device doesn't support attaching volumes through
177  // AttachVolume (e.g. virtio-blk).   In other cases, it is forbidden and
178  // FAILED_PRECONDITION status will be returned.
179  rpc DeleteDevice (DeleteDeviceRequest)
180    returns (DeleteDeviceResponse) {}
181  // Attaches a volume to a specified device making it available through that
182  // device (e.g. for NVMeoF this results in adding a namespace to an NVMeoF
183  // subsystem).  The type of volume doesn't need to match the type of device
184  // (e.g. it's perfectly fine to attach an NVMe/TCP volume to a virtio-blk
185  // device).
186  rpc AttachVolume (AttachVolumeRequest)
187    returns (AttachVolumeResponse) {}
188  // Detaches a volume from a device
189  rpc DetachVolume (DetachVolumeRequest)
190    returns (DetachVolumeResponse) {}
191  // Configures QoS on a device/volume
192  rpc SetQos (SetQosRequest)
193    returns (SetQosResponse) {}
194  // Returns QoS capabilities of a given device type
195  rpc GetQosCapabilities (GetQosCapabilitiesRequest)
196    returns (GetQosCapabilitiesResponse) {}
197}
198