| 1 |
// Copyright 2019 Google Inc. All Rights Reserved. |
| 2 |
// |
| 3 |
// Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 |
// you may not use this file except in compliance with the License. |
| 5 |
// You may obtain a copy of the License at |
| 6 |
// |
| 7 |
// http://www.apache.org/licenses/LICENSE-2.0 |
| 8 |
// |
| 9 |
// Unless required by applicable law or agreed to in writing, software |
| 10 |
// distributed under the License is distributed on an "AS IS" BASIS, |
| 11 |
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 |
// See the License for the specific language governing permissions and |
| 13 |
// limitations under the License. |
| 14 |
|
| 15 |
syntax = "proto3"; |
| 16 |
|
| 17 |
package cloud.vmm; |
| 18 |
|
| 19 |
enum OperationType { |
| 20 |
NOT_SET = 0; |
| 21 |
PRE_SNAPSHOT = 1; |
| 22 |
POST_SNAPSHOT = 2; |
| 23 |
} |
| 24 |
|
| 25 |
enum SupportedFeatures { |
| 26 |
NONE = 0; |
| 27 |
SNAPSHOTS = 1; |
| 28 |
} |
| 29 |
|
| 30 |
message SnapshotRequest { |
| 31 |
// The operation id of the snapshot. |
| 32 |
int32 operation_id = 1; |
| 33 |
|
| 34 |
// A list of comma separated target/lun values, e.g "1/2,3/4". |
| 35 |
string disk_list = 2; |
| 36 |
|
| 37 |
// The operation type. |
| 38 |
OperationType type = 3; |
| 39 |
} |
| 40 |
|
| 41 |
message ServerInfo { |
| 42 |
repeated SupportedFeatures supported_features = 1; |
| 43 |
} |
| 44 |
|
| 45 |
enum AgentErrorCode { |
| 46 |
NO_ERROR = 0; |
| 47 |
|
| 48 |
// The snapshot config was improper in some way. |
| 49 |
INVALID_CONFIG = 1; |
| 50 |
|
| 51 |
// The pre or post snapshot script was not found on disk. |
| 52 |
SCRIPT_NOT_FOUND = 2; |
| 53 |
|
| 54 |
// The pre or post snapshot script timed out. |
| 55 |
SCRIPT_TIMED_OUT = 3; |
| 56 |
|
| 57 |
// The pre or post snapshot script returned an error, but the "continue on |
| 58 |
// error" flag was not set. |
| 59 |
UNHANDLED_SCRIPT_ERROR = 4; |
| 60 |
} |
| 61 |
|
| 62 |
message SnapshotResponse { |
| 63 |
// The operation id of the snapshot. |
| 64 |
int32 operation_id = 1; |
| 65 |
|
| 66 |
// The return code of the scripts run by the guest. If this is non-zero, then |
| 67 |
// agent_return_code should be UNHANDLED_SCRIPT_ERROR. |
| 68 |
int32 scripts_return_code = 2; |
| 69 |
|
| 70 |
// The agent return code. |
| 71 |
AgentErrorCode agent_return_code = 3; |
| 72 |
|
| 73 |
// The operation type. |
| 74 |
OperationType type = 4; |
| 75 |
} |
| 76 |
|
| 77 |
message GuestReady { |
| 78 |
bool request_server_info = 1; |
| 79 |
} |
| 80 |
|
| 81 |
message GuestMessage { |
| 82 |
oneof msg { |
| 83 |
SnapshotRequest snapshot_request = 1; |
| 84 |
ServerInfo server_info = 2; |
| 85 |
} |
| 86 |
} |
| 87 |
|
| 88 |
message ServerAck {} |
| 89 |
|
| 90 |
// Service to handle pre and post snapshot requests from vanadium. |
| 91 |
service SnapshotService { |
| 92 |
// The client is expected to first send a "GuestReady" message, indicating |
| 93 |
// they are available and establishing the connection that vanadium writes |
| 94 |
// requests to the agent on. |
| 95 |
rpc CreateConnection(GuestReady) returns (stream GuestMessage) {} |
| 96 |
|
| 97 |
// Handles the agent's responses to the above requests. |
| 98 |
rpc HandleResponsesFromGuest(SnapshotResponse) returns (ServerAck) {} |
| 99 |
} |