forked from ydb-platform/nbs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdisk_service.proto
180 lines (148 loc) · 5 KB
/
disk_service.proto
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
syntax = "proto3";
package cloud.disk_manager;
import "cloud/disk_manager/api/disk.proto";
import "cloud/disk_manager/api/operation.proto";
import "google/protobuf/empty.proto";
import "google/protobuf/timestamp.proto";
option go_package = "github.com/ydb-platform/nbs/cloud/disk_manager/api;disk_manager";
service DiskService {
// Returns operation with:
// metadata: CreateDiskMetadata
// response: google.protobuf.Empty
rpc Create(CreateDiskRequest) returns (Operation);
// Delete the disk without deleting its snapshots.
//
// Returns operation with:
// metadata: DeleteDiskMetadata
// response: google.protobuf.Empty
rpc Delete(DeleteDiskRequest) returns (Operation);
// Returns operation with:
// response: google.protobuf.Empty
rpc Resize(ResizeDiskRequest) returns (Operation);
// Returns operation with:
// response: google.protobuf.Empty
rpc Alter(AlterDiskRequest) returns (Operation);
// Should be called before starting the VM with proper token.
//
// Returns operation with:
// response: google.protobuf.Empty
rpc Assign(AssignDiskRequest) returns (Operation);
// Should be called after stopping the VM.
//
// Returns operation with:
// response: google.protobuf.Empty
rpc Unassign(UnassignDiskRequest) returns (Operation);
rpc DescribeModel(DescribeDiskModelRequest) returns (DiskModel) {}
rpc Stat(StatDiskRequest) returns (DiskStats) {}
// Creates a disk in the destination zone and starts replicating data to it from the source disk, and after replication is finished, replaces the source disk with the destination disk.
//
// In order to finish this operation, firstly FINISH_REPLICATION, and then FINISH_MIGRATION signals should be sent via |SendMigrationSignal|.
//
// Can be cancelled by performing |operations.Cancel| on returned operation, but only before FINISH_MIGRATION signal has been sent.
//
// Returns operation with:
// metadata: MigrateDiskMetadata
// response: google.protobuf.Empty
rpc Migrate(MigrateDiskRequest) returns (Operation);
// Sends a signal to the migration operation, advancing migration process forward.
rpc SendMigrationSignal(SendMigrationSignalRequest) returns (google.protobuf.Empty);
rpc Describe(DescribeDiskRequest) returns (DiskParams) {}
}
message CreateDiskRequest {
reserved 13, 14, 15, 16;
oneof src {
google.protobuf.Empty src_empty = 1;
// It's (generally) very fast to create disk from image, because it'll create a layered disk basing on some disk from image's pool
string src_image_id = 2;
// This is similar to creating from Image, except it performs full copy and so is very slow.
string src_snapshot_id = 3;
}
int64 size = 4;
DiskId disk_id = 5;
int64 block_size = 6;
DiskKind kind = 7;
string cloud_id = 8;
string folder_id = 9;
int64 tablet_version = 10;
string placement_group_id = 11;
// Prevents from creating layered (overlay) disk.
bool force_not_layered = 12;
string storage_pool_name = 17;
repeated string agent_ids = 18;
EncryptionDesc encryption_desc = 19;
uint32 placement_partition_index = 20;
}
message CreateDiskMetadata {
double progress = 1;
}
message DeleteDiskRequest {
reserved 2;
// `disk_id.zone_id` is optional.
DiskId disk_id = 1;
bool sync = 3;
}
message DeleteDiskMetadata {
DiskId disk_id = 1;
}
message ResizeDiskRequest {
DiskId disk_id = 1;
int64 size = 2;
}
message AlterDiskRequest {
DiskId disk_id = 1;
string cloud_id = 2;
string folder_id = 3;
}
message AssignDiskRequest {
DiskId disk_id = 1;
string instance_id = 2;
string host = 3;
// Empty token is not allowed.
string token = 4;
}
message UnassignDiskRequest {
DiskId disk_id = 1;
}
message DescribeDiskModelRequest {
string zone_id = 1;
int64 block_size = 2;
int64 size = 3;
DiskKind kind = 4;
int64 tablet_version = 5;
}
message StatDiskRequest {
DiskId disk_id = 1;
}
message MigrateDiskRequest {
DiskId disk_id = 1;
string dst_zone_id = 2;
string dst_placement_group_id = 3;
uint32 dst_placement_partition_index = 4;
}
message MigrateDiskMetadata {
enum Status {
STATUS_UNSPECIFIED = 0;
REPLICATING = 1;
FINISHING_REPLICATION = 2;
REPLICATION_FINISHED = 3;
FINISHING = 4;
}
Status status = 1;
double progress = 2;
int64 seconds_remaining = 3; // To copy the rest of the data.
google.protobuf.Timestamp updated_at = 4;
}
message SendMigrationSignalRequest {
enum Signal {
SIGNAL_UNSPECIFIED = 0;
// Signal to freeze source disk and finish data replication.
FINISH_REPLICATION = 1;
// Signal to delete source disk and replace it with destination disk. Can only be sent after FinishReplication signal.
FINISH_MIGRATION = 2;
}
string operation_id = 1;
Signal signal = 2;
}
message DescribeDiskRequest {
DiskId disk_id = 1;
}