aboutsummaryrefslogtreecommitdiff
path: root/dbus/vm_concierge/service.proto
blob: 9606aafa99787d83db130d264402becdc0f3fa9d (plain)
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
181
182
183
184
// Copyright 2017 The Chromium OS Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

syntax = "proto3";

// This file defines messages used for starting, stopping, and managing VMs.
package vm_tools.concierge;

// Specification of the key components of a VM.
message VirtualMachineSpec {
  // Path to the kernel that should be used for the VM.
  string kernel = 1;

  // Path to the disk image that should be used as the root file system for
  // the VM.
  string rootfs = 2;
}

// The type of disk image.
enum DiskImageType {
  // A raw file.
  DISK_IMAGE_RAW = 0;

  // A qcow2-compatible disk image.
  DISK_IMAGE_QCOW2 = 1;
}

// Describes any additional disk images that should be mounted inside the VM.
message DiskImage {
  // Path to the disk image on the host.
  string path = 1;

  // Path where this disk image will be mounted inside the VM.
  string mount_point = 2;

  // The file system type for this disk image.
  string fstype = 3;

  // Any special flags to be used when mounting the file system.  Specified the
  // same way as in mount(2).
  uint64 flags = 4;

  // Any additional data associated with the mount.
  string data = 5;

  // If true, the disk image will be mounted writable.
  bool writable = 6;

  // If true, the disk image will be mounted.
  bool do_mount = 7;

  // Image type of the disk.
  DiskImageType image_type = 8;
}

// Information about a particular VM.
message VmInfo {
  // The IPv4 address assigned to the VM, in network byte order.
  fixed32 ipv4_address = 1;

  // The process ID of the main crosvm process for the VM.
  int32 pid = 2;

  // The virtual socket context id assigned to the VM.
  int64 cid = 3;
}

// Information that must be included with every StartVm dbus message.
message StartVmRequest {
  // The VM that should be started. This is ignored if starting a termina VM,
  // which will always use the latest component from imageloader.
  VirtualMachineSpec vm = 1;

  // Any additional disks that should be mounted inside the VM.
  repeated DiskImage disks = 2;

  // Path to a shared directory that will be mounted via NFS inside the VM.
  string shared_directory = 3;

  // The human-readable name to be assigned to this VM.
  string name = 4;

  // If true, concierge should also perform termina-specific setup.
  bool start_termina = 5;
}

// Information sent back by vm_concierge in response to a StartVm dbus message.
message StartVmResponse {
  // If true, the VM was started successfully.  |vm_info| will have non-default
  // values only if this is true.
  bool success = 1;

  // If the VM failed to start, the reason for the failure.
  string failure_reason = 2;

  // Information about the VM that was started, if successful.
  VmInfo vm_info = 3;
}

// Information that must be included with every StopVm dbus message.
message StopVmRequest {
  // The name of the VM to be stopped.
  string name = 1;
}

// Response sent back by vm_concierge when it receives a StopVm dbus message.
message StopVmResponse {
  // If true, the requested VM was stopped.
  bool success = 1;

  // The failure_reason if the requested VM could not be stopped.
  string failure_reason = 2;
}

// Request for information about the VM.
message GetVmInfoRequest {
  // The name of the VM to query.
  string name = 1;
}

// Response sent back by vm_concierge for a GetVmInfo dbus message.
message GetVmInfoResponse {
  // If true, the requested VM exists and info was returned.
  bool success = 1;

  // Information about the VM that was requested.
  VmInfo vm_info = 2;
}

// The type of storage location for a disk image.
enum StorageLocation {
  // Subdirectory under /home/root/<id>/crosvm.
  STORAGE_CRYPTOHOME_ROOT = 0;

  // The user's Downloads directory, under /home/user/<id>/Downloads.
  STORAGE_CRYPTOHOME_DOWNLOADS = 1;
}

enum DiskImageStatus {
  // Unknown status.
  DISK_STATUS_UNKNOWN = 0;

  // The disk image was created.
  DISK_STATUS_CREATED = 1;

  // The disk already existed.
  DISK_STATUS_EXISTS = 2;

  // Unable to create the disk image.
  DISK_STATUS_FAILED = 3;
}

// Request to concierge to create a disk image.
message CreateDiskImageRequest {
  // The cryptohome id for the user's encrypted storage.
  string cryptohome_id = 1;

  // The path to the disk image. This must be a relative path, and any
  // directories must already exist.
  string disk_path = 2;

  // The logical size of the new disk image, in bytes.
  uint64 disk_size = 3;

  // The type of disk image to be created.
  DiskImageType image_type = 4;

  // The storage location for the disk image.
  StorageLocation storage_location = 5;
}

// Response to a CreateDiskImageRequest.
message CreateDiskImageResponse {
  // If true, the disk image has been successfully created.
  DiskImageStatus status = 1;

  // The absolute path to the created disk image, if it was successfully
  // created or already existed.
  string disk_path = 2;

  // The failure reason if the disk image could not be created or doesn't exist.
  string failure_reason = 3;
}