1// Copyright 2018 The Chromium OS Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5syntax = "proto3";
6option optimize_for = LITE_RUNTIME;
7
8// This file defines messages used for interacting directly with containers
9// running inside of a VM.
10package vm_tools.cicerone;
11option go_package = "vm_cicerone_proto";
12
13// Message sent to cicerone when a VM has started up. This is just for
14// tracking purposes by cicerone.
15message NotifyVmStartedRequest {
16  // Name of the VM.
17  string vm_name = 1;
18
19  // The owner of the VM.
20  string owner_id = 2;
21
22  // The virtual socket context id assigned to the VM.
23  uint32 cid = 3;
24
25  // The token to identify the VM, only used with plugin VMs that don't have
26  // containers.
27  string vm_token = 4;
28
29  // The pid of the main VM process.
30  uint32 pid = 5;
31}
32
33// Message sent to cicerone when concierge is about to stop a VM.
34// This is just for tracking purposes by cicerone. This may not be
35// sent if the VM stops unexpectedly.
36message NotifyVmStoppingRequest {
37  // Name of the VM.
38  string vm_name = 1;
39
40  // The owner of the VM.
41  string owner_id = 2;
42}
43
44// Message sent to cicerone when a VM stopped or failed to complete startup.
45// This is just for tracking purposes by cicerone.
46message NotifyVmStoppedRequest {
47  // Name of the VM.
48  string vm_name = 1;
49
50  // The owner of the VM.
51  string owner_id = 2;
52}
53
54// Message sent to cicerone when requesting a token for linking to a container
55// that is going to be started for a VM.
56message ContainerTokenRequest {
57  // Name of the VM.
58  string vm_name = 1;
59
60  // Name of the container within the VM.
61  string container_name = 2;
62
63  // The owner of the VM.
64  string owner_id = 3;
65}
66
67// Reply to the GetContainerToken method.
68message ContainerTokenResponse {
69  // A token that should be passed into the container to identify itself. This
70  // token will be the empty string if the request was invalid.
71  string container_token = 1;
72}
73
74// Message used in the signal for when tremplin has started.
75message TremplinStartedSignal {
76  // Name of the VM the container is in.
77  string vm_name = 1;
78
79  // The owner of the VM.
80  string owner_id = 2;
81}
82
83// Message used in the signal for when a container has started up.
84message ContainerStartedSignal {
85  // Name of the VM the container is in.
86  string vm_name = 1;
87
88  // Name of the container within the VM.
89  string container_name = 2;
90
91  // The owner of the VM and container.
92  string owner_id = 3;
93
94  // The username of uid 1000 in the container.
95  string container_username = 4;
96
97  // The home directory of uid 1000 in the container.
98  string container_homedir = 5;
99
100  // The IPv4 address of the container.
101  string ipv4_address = 6;
102}
103
104// Message used in the signal for when a container has shut down.
105message ContainerShutdownSignal {
106  // Name of the VM the container is in.
107  string vm_name = 1;
108
109  // Name of the container within the VM.
110  string container_name = 2;
111
112  // The owner of the VM and container.
113  string owner_id = 3;
114}
115
116// Request to launch on application in the specified VM/container. Used with the
117// LaunchContainerApplication D-Bus message into vm_concierge.
118message LaunchContainerApplicationRequest {
119  // Display scaling of the app windows.
120  enum DisplayScaling {
121    // Default scaling.
122    UNSCALED = 0;
123    // Windows scaled. Used to scale up older app windows that don't show well
124    // with HiDPI display otherwise.
125    SCALED = 1;
126  }
127
128  // Name of the VM to target.
129  string vm_name = 1;
130
131  // Name of the container within the VM to target, if empty the default
132  // container name will be used.
133  string container_name = 2;
134
135  // ID of the application to launch, should map to the desktop_file_id that
136  // is in the application list sent back from the container.
137  string desktop_file_id = 3;
138
139  // The owner of the vm and container.
140  string owner_id = 4;
141
142  // Files to pass as arguments when launching the application, if any, given
143  // as absolute paths within the container's filesystem.
144  repeated string files = 5;
145
146  // Display scaling requested.
147  DisplayScaling display_scaling = 6;
148}
149
150// Response sent back by vm_concierge when it receives a
151// LaunchContainerApplication D-Bus message.
152message LaunchContainerApplicationResponse {
153  // If true, the requested application launched successfully.
154  bool success = 1;
155
156  // The failure_reason if the requested application could not be started.
157  string failure_reason = 2;
158}
159
160// Request to get application icons in the specified VM/container. Used with the
161// GetContainerAppIcon D-Bus message into vm_concierge.
162message ContainerAppIconRequest {
163  // Name of the VM to target.
164  string vm_name = 1;
165
166  // Name of the container within the VM to target, if empty the default
167  // container name will be used.
168  string container_name = 2;
169
170  // IDs of the application to get icons for, should map to the desktop_file_id
171  // that is in the application list sent back from the container.
172  repeated string desktop_file_ids = 3;
173
174  // The icon size with both its height and width equal to this number.
175  int32 size = 4;
176
177  // The target scale of this icon. This is the scale factor at which this icon
178  // is designed to be used.
179  int32 scale = 5;
180
181  // The owner of the VM and container.
182  string owner_id = 6;
183}
184
185// One desktop file ID with its icon.
186message DesktopIcon {
187  string desktop_file_id = 1;
188  bytes icon = 2;
189}
190
191// Response sent back by vm_concierge when it receives a
192// GetContainerAppIcon D-Bus message.
193// Some desktop_file_id may not have an icon.
194message ContainerAppIconResponse {
195  repeated DesktopIcon icons = 1;
196}
197
198// Launch vshd request.
199message LaunchVshdRequest {
200  // Name of the VM to target.
201  string vm_name = 1;
202
203  // Name of the container within the VM to target.
204  string container_name = 2;
205
206  // The port for vshd to connect to.
207  uint32 port = 3;
208
209  // The owner of the VM and container.
210  string owner_id = 4;
211}
212
213// Response sent back by vm_cicerone when it receives a LaunchVshd
214// call.
215message LaunchVshdResponse {
216  // True if vshd was successfully spawned in the VM.
217  bool success = 1;
218
219  // The reason vshd could not be started, if |success| is false.
220  string failure_reason = 2;
221
222  // The cid the LaunchVshd request was sent to. Only valid if |success|
223  // is true.
224  uint32 cid = 3;
225}
226
227// Request to get information about a Linux package in the container.
228message LinuxPackageInfoRequest {
229  // Name of the VM to target.
230  string vm_name = 1;
231
232  // Name of the container within the VM to target.
233  string container_name = 2;
234
235  // The owner of the VM and container.
236  string owner_id = 3;
237
238  // Path to the package file (e.g. .deb) in the container's filesystem.
239  string file_path = 4;
240
241  // Name (not package_id) of package to look up. Used when |file_path| is
242  // empty.
243  string package_name = 5;
244}
245
246// Response sent back from a GetLinuxPackageInfo call.
247message LinuxPackageInfoResponse {
248  // True if the file was successfully parsed and the other fields are valid.
249  bool success = 1;
250
251  // Contains a textual reason for the failure in case success is false.
252  string failure_reason = 2;
253
254  // The package identifier is in the form of a semicolon delimited string of
255  // the format: name;version;arch;data
256  // name, version and arch are as expected. data is somewhat variant and refers
257  // to the state of the package as well as potentially remote repository
258  // information.
259  string package_id = 3;
260
261  // The license associated with the package. So far only the value of
262  // 'unknown' has been observed for this field.
263  string license = 4;
264
265  // The description of the package, can be a multi-line text string.
266  string description = 5;
267
268  // The URL for the homepage of the project.
269  string project_url = 6;
270
271  // Size of the package file in bytes.
272  uint64 size = 7;
273
274  // Usually more of a title for a package, but sometimes less descriptive
275  // than that.
276  string summary = 8;
277}
278
279// Request to install a Linux package in the container.
280message InstallLinuxPackageRequest {
281  // Name of the VM to target.
282  string vm_name = 1;
283
284  // Name of the container within the VM to target.
285  string container_name = 2;
286
287  // The owner of the VM and container.
288  string owner_id = 3;
289
290  // Path to the package file (e.g. .deb) in the container's filesystem.
291  string file_path = 4;
292
293  // Package ID to install in the form "package_name;version;arch;data". Used
294  // when |file_path| is empty.
295  string package_id = 5;
296
297  // Command identifier to track installation progress.
298  string command_uuid = 6;
299}
300
301// Response sent back from a InstallLinuxPackage call.
302message InstallLinuxPackageResponse {
303  enum Status {
304    // Install process was successfully started, all further updates will be
305    // sent via the InstallLinuxPackageProgress signal.
306    STARTED = 0;
307
308    // Failed to start up for a general reason, specific details are given in
309    // failure_reason.
310    FAILED = 1;
311
312    // Indicates another install is already in process, this one will not be
313    // started.
314    INSTALL_ALREADY_ACTIVE = 2;
315  }
316  Status status = 1;
317
318  // Contains a textual reason for the failure in case of a FAILED status.
319  string failure_reason = 2;
320}
321
322// Message used in a signal for updates on Linux package installations.
323message InstallLinuxPackageProgressSignal {
324  // Name of the VM the container is in.
325  string vm_name = 1;
326
327  // Name of the container within the VM.
328  string container_name = 2;
329
330  // The owner of the VM and container.
331  string owner_id = 3;
332
333  enum Status {
334    // Install has completed and was successful. No further signals will be
335    // sent after this one.
336    SUCCEEDED = 0;
337
338    // Install failed to complete, the specific reason will be in
339    // failure_details. No further signals will be sent after this one.
340    FAILED = 1;
341
342    // This is sent periodically while packages are being downloaded.
343    DOWNLOADING = 2;
344
345    // This is sent periodically during the general installation phase for
346    // package and dependency installation.
347    INSTALLING = 3;
348  }
349
350  // Current status of the installation progress.
351  Status status = 4;
352
353  // Overall percentage progress.
354  uint32 progress_percent = 5;
355
356  // Details relating to the failure state. This can be a multi-line string in
357  // some cases (that's how it comes out of PackageKit, for example in the case
358  // of an unsatisfiable dependency).
359  string failure_details = 6;
360
361  // Command identifier that is specified in |InstallLinuxPackageRequest| to
362  // track installation progress.
363  string command_uuid = 7;
364}
365
366// Request to uninstall the package owning the indicated file. Identifying the
367// package-to-be-uninstalled by desktop file name is safer than using
368// package_id; we don't watch for package upgrades so the package_id may be
369// stale.
370message UninstallPackageOwningFileRequest {
371  // Name of the VM to target.
372  string vm_name = 1;
373
374  // Name of the container within the VM to target.
375  string container_name = 2;
376
377  // The owner of the VM and container.
378  string owner_id = 3;
379
380  // The ID of the .desktop file inside the container. The container will find
381  // the owning package and remove it.
382  string desktop_file_id = 4;
383}
384
385// Response sent back from a UninstallPackageOwningFile call.
386message UninstallPackageOwningFileResponse {
387  enum Status {
388    // Uninstall process was successfully started, all further updates will be
389    // sent via the UninstallPackageProgress signal.
390    STARTED = 0;
391
392    // Failed to start up for a general reason, specific details are given in
393    // failure_reason.
394    FAILED = 1;
395
396    // Indicates another blocking operation (uninstall, install, etc) is already
397    // in progress, this one will not be started.
398    BLOCKING_OPERATION_IN_PROGRESS = 2;
399  }
400  Status status = 1;
401
402  // Contains a textual reason for the failure in case status is FAILED.
403  string failure_reason = 2;
404}
405
406// Message used in a signal for updates on UninstallPackageOwningFile calls.
407message UninstallPackageProgressSignal {
408  // Name of the VM the container is in.
409  string vm_name = 1;
410
411  // Name of the container within the VM.
412  string container_name = 2;
413
414  // The owner of the VM and container.
415  string owner_id = 3;
416
417  enum Status {
418    // Uninstall has completed and was successful. No further signals will be
419    // sent after this one.
420    SUCCEEDED = 0;
421
422    // Uninstall failed to complete, the specific reason will be in
423    // failure_details. No further signals will be sent after this one.
424    FAILED = 1;
425
426    // This is sent while the uninstall is in progress. progress_percent will be
427    // filled in.
428    UNINSTALLING = 2;
429  }
430
431  // Current status of the uninstallation progress.
432  Status status = 4;
433
434  // Overall percentage progress.
435  uint32 progress_percent = 5;
436
437  // Details relating to the failure state.
438  string failure_details = 6;
439}
440
441// Request for creating an LXD container.
442message CreateLxdContainerRequest {
443  // Name of the VM to target.
444  string vm_name = 1;
445
446  // Name of the container to start within the VM.
447  string container_name = 2;
448
449  // The owner of the VM and container.
450  string owner_id = 3;
451
452  // LXD image server URL. Only simplestreams is supported for now.
453  string image_server = 4;
454
455  // LXD image alias.
456  string image_alias = 5;
457
458  // rootfs path to create the container from.
459  string rootfs_path = 6;
460
461  // metadata path to create the container from.
462  string metadata_path = 7;
463}
464
465// Response for creating an LXD container.
466message CreateLxdContainerResponse {
467  enum Status {
468    // The status of creating the container is unknown.
469    UNKNOWN = 0;
470
471    // The container is now being created. An LxdContainerCreated signal will
472    // relay the final result.
473    CREATING = 1;
474
475    // A container with this name already exists.
476    EXISTS = 2;
477
478    // The container could not be created.
479    FAILED = 3;
480  }
481
482  // Container creation status.
483  Status status = 1;
484
485  // The failure_reason if the container could not be created.
486  string failure_reason = 2;
487}
488
489// Message used in the LxdContainerCreated signal for the outcome of an
490// LxdCreateContainer message.
491message LxdContainerCreatedSignal {
492  // Name of the VM the container is in.
493  string vm_name = 1;
494
495  // Name of the container within the VM.
496  string container_name = 2;
497
498  // The owner of the VM and container.
499  string owner_id = 3;
500
501  enum Status {
502    // The container creation status is unknown.
503    UNKNOWN = 0;
504
505    // The container was successfully created.
506    CREATED = 1;
507
508    // The container download timed out.
509    DOWNLOAD_TIMED_OUT = 2;
510
511    // The container creation was cancelled.
512    CANCELLED = 3;
513
514    // The container creation failed for an unspecified reason.
515    FAILED = 4;
516  }
517
518  // Container creation status.
519  Status status = 4;
520
521  // The failure_reason if the container was not successfully created.
522  string failure_reason = 5;
523}
524
525// Request for deleting an LXD container.
526message DeleteLxdContainerRequest {
527  // Name of the VM to target.
528  string vm_name = 1;
529
530  // Name of the container to start within the VM.
531  string container_name = 2;
532
533  // The owner of the VM and container.
534  string owner_id = 3;
535}
536
537// Response for deleting an LXD container.
538message DeleteLxdContainerResponse {
539  enum Status {
540    // The status of deleting the container is unknown
541    UNKNOWN = 0;
542
543    // The container is being deleted.
544    DELETING = 1;
545
546    // The named container doesn't exist.
547    DOES_NOT_EXIST = 2;
548
549    // The container could not be deleted.
550    FAILED = 3;
551  }
552
553  // Container creation status.
554  Status status = 1;
555
556  // The failure_reason if the container could not be created.
557  string failure_reason = 2;
558}
559
560// Message used in the LxdContainerDeleted signal for the outcome of an
561// LxdDeleteContainer message.
562message LxdContainerDeletedSignal {
563  enum Status {
564    // Deletion status is unknown.
565    UNKNOWN = 0;
566
567    // The container has been deleted.
568    DELETED = 1;
569
570    // The container deletion was cancelled.
571    CANCELLED = 2;
572
573    // One or more steps failed and the container could not be deleted.
574    FAILED = 3;
575  }
576
577  // Name of the VM the container is in.
578  string vm_name = 1;
579
580  // Name of the container within the VM.
581  string container_name = 2;
582
583  // The owner of the VM and container.
584  string owner_id = 3;
585
586  // Container deletion status.
587  Status status = 4;
588
589  // The failure_reason if the container was not successfully deleted.
590  string failure_reason = 5;
591}
592
593// Request to set timezone for all containers in all VMs known to cicerone.
594message SetTimezoneRequest {
595  // The timezone name to set, for example "America/Denver" or "Etc/UTC".
596  // See /usr/share/zoneinfo, 'timedatectl list-timezones', or the timezone-data
597  // package for other valid names.
598  //
599  // This name will also specify the zoneinfo file from which cicerone will
600  // parse a posix TZ string. That string will be used as a fallback in the
601  // case that the VM does not support zoneinfo files for timezones.
602  string timezone_name = 1;
603}
604
605// Response to setting timezone for all containers in all VMs known to cicerone.
606message SetTimezoneResponse {
607  // The number of containers for which the timezone was successfully set.
608  int32 successes = 1;
609
610  // The failure reason for each container for which the timezone could not be
611  // set.
612  repeated string failure_reasons = 2;
613}
614
615// Message used in the signal for when a container is downloading.
616message LxdContainerDownloadingSignal {
617  // Name of the VM the container is in.
618  string vm_name = 1;
619
620  // Name of the container within the VM.
621  string container_name = 2;
622
623  // The owner of the VM and container.
624  string owner_id = 3;
625
626  // Container download progress, as a percentage.
627  int32 download_progress = 4;
628}
629
630// Request for starting an LXD container.
631message StartLxdContainerRequest {
632  // Name of the VM to target.
633  string vm_name = 1;
634
635  // Name of the container to start within the VM.
636  string container_name = 2;
637
638  // The owner of the VM and container.
639  string owner_id = 3;
640
641  // Deprecated.  All calls are async.
642  bool async = 4 [deprecated = true];
643
644  // Full path where drivefs is mounted (/media/fuse/drivefs-<drivefs-hash>).
645  string drivefs_mount_path = 5;
646
647  // Represents the privilege level with which a container should be started. If
648  // the container is already running this should take effect on the next boot.
649  enum PrivilegeLevel {
650    // Don't change the privilege level of the container.
651    UNCHANGED = 0;
652
653    // Make the container unprivileged.
654    UNPRIVILEGED = 1;
655
656    // Make the container privileged.
657    PRIVILEGED = 2;
658  }
659
660  PrivilegeLevel privilege_level = 6;
661}
662
663// OsRelease encapsulates a subset of the os-release info as documented
664// at https://www.freedesktop.org/software/systemd/man/os-release.html.
665message OsRelease {
666  // A pretty operating system name in a format suitable for presentation to the
667  // user. May or may not contain a release code name or OS version of some
668  // kind, as suitable. (e.g. "Debian GNU/Linux 10 (buster)").
669  string pretty_name = 1;
670
671  // A string identifying the operating system, without a version component,
672  // and suitable for presentation to the user (e.g. "Debian GNU/Linux").
673  string name = 2;
674
675  // String identifying OS version possibly including release codename.
676  // (e.g. "10 (buster)").
677  string version = 3;
678
679  // Lower case string (mostly numeric) identifying OS version (e.g. "10").
680  string version_id = 4;
681
682  // Lower case string identifying the operating system (e.g. "debian").
683  string id = 5;
684}
685
686// Response for starting an LXD container.
687message StartLxdContainerResponse {
688  enum Status {
689    // The status of starting the container is unknown.
690    UNKNOWN = 0;
691
692    // The container has started. This is only valid if async was false in the
693    // request.
694    STARTED = 1;
695
696    // The container was already running.
697    RUNNING = 2;
698
699    // The container could not be started.
700    FAILED = 3;
701
702    // The container is starting. This is only valid if async was true in the
703    // request.
704    STARTING = 4;
705
706    // The container is remapping its rootfs uids/gids and will take longer than
707    // usual to start up. This is only valid if async was true in the request.
708    REMAPPING = 5;
709  }
710
711  // Container startup status.
712  Status status = 1;
713
714  // The failure_reason if the container could not be started.
715  string failure_reason = 2;
716
717  // OS strings found in the container's /etc/os-release, e.g. "stretch".
718  OsRelease os_release = 3;
719}
720
721// Message used in the signal for when a container is starting.
722message LxdContainerStartingSignal {
723  // Name of the VM the container is in.
724  string vm_name = 1;
725
726  // Name of the container within the VM.
727  string container_name = 2;
728
729  // The owner of the VM and container.
730  string owner_id = 3;
731
732  enum Status {
733    // Start status is unknown.
734    UNKNOWN = 0;
735
736    // The container has started. No more signals are expected.
737    STARTED = 1;
738
739    // The container start was cancelled. No more signals are expected.
740    CANCELLED = 2;
741
742    // One or more steps failed and the container could not be started. No
743    // more signals are expected.
744    FAILED = 3;
745  }
746
747  // The current status of starting the container.
748  Status status = 4;
749
750  // The failure_reason if the container was not successfully started.
751  string failure_reason = 5;
752
753  // OS strings found in the container's /etc/os-release, e.g. "stretch".
754  OsRelease os_release = 6;
755}
756
757// Request for getting the primary user for an LXD container.
758message GetLxdContainerUsernameRequest {
759  // Name of the VM to target.
760  string vm_name = 1;
761
762  // Name of the container to get the primary user for.
763  string container_name = 2;
764
765  // The owner of the VM and container.
766  string owner_id = 3;
767}
768
769// Response for getting the primary user for an LXD container.
770message GetLxdContainerUsernameResponse {
771  enum Status {
772    // The status is unknown.
773    UNKNOWN = 0;
774
775    // The primary username is stored in the username field.
776    SUCCESS = 1;
777
778    // A container with the specified name doesn't exist.
779    CONTAINER_NOT_FOUND = 2;
780
781    // The container is not running, so the username could not be found.
782    CONTAINER_NOT_RUNNING = 3;
783
784    // The primary user doesn't exist.
785    USER_NOT_FOUND = 4;
786
787    // Some part of the operation failed.
788    FAILED = 5;
789  }
790
791  // Status of getting the primary username.
792  Status status = 1;
793
794  // The primary username of the container, if successful.
795  string username = 2;
796
797  // The failure_reason if the username could not be retrieved.
798  string failure_reason = 3;
799
800  // The home directory of uid 1000 in the container.
801  string homedir = 4;
802}
803// Request for setting up the user for an LXD container.
804message SetUpLxdContainerUserRequest {
805  // Name of the VM to target.
806  string vm_name = 1;
807
808  // Name of the container to start within the VM.
809  string container_name = 2;
810
811  // The owner of the VM and container.
812  string owner_id = 3;
813
814  // Username for the first user in the container.
815  string container_username = 4;
816}
817
818// Response for setting up the user on an LXD container.
819message SetUpLxdContainerUserResponse {
820  enum Status {
821    // The status of setting up the user is unknown.
822    UNKNOWN = 0;
823
824    // The user has been set up sucessfully.
825    SUCCESS = 1;
826
827    // The user already exists.
828    EXISTS = 2;
829
830    // Setting up the user failed.
831    FAILED = 3;
832  }
833
834  // Status of setting up the user.
835  Status status = 1;
836
837  // The failure_reason if the user was not set up successfully.
838  string failure_reason = 2;
839
840  // The username of uid 1000 in the container.
841  string container_username = 3;
842}
843
844// Request for debug information about virtual machine and container state.
845message GetDebugInformationRequest {}
846
847// Response for debug information about virtual machine and container state.
848message GetDebugInformationResponse {
849  // Debug information about virtual machine and container state in arbitrary
850  // format.
851  string debug_information = 1;
852}
853
854message ExportLxdContainerRequest {
855  // Name of the VM the container is in.
856  string vm_name = 1;
857
858  // Name of the container exporting.
859  string container_name = 2;
860
861  // The owner of the VM and container.
862  string owner_id = 3;
863
864  // Path to write the exported container.  This path, or a parent
865  // must have already been shared using seneschal.  It is the path relative
866  // to the VM root mount point (/mnt/shared) as returned in seneschal
867  // SharePathResponse.path.  E.g.: "MyFiles/export".  If path is a directory,
868  // it must already exist, and the export will be named <fingerprint>.tar.gz
869  // otherwise this path must already exist as a file, or its parent directory
870  // must exist.
871  string export_path = 4;
872}
873
874message ExportLxdContainerResponse {
875  enum Status {
876    // The result is unknown.
877    UNKNOWN = 0;
878
879    // The container is exporting. Further updates will be delievered via
880    // ExportLxdContainerProgressSignal.
881    EXPORTING = 1;
882
883    // One or more steps failed and the container could not be exported.
884    FAILED = 2;
885  }
886
887  // Current container status.
888  Status status = 1;
889
890  // Details relating to the failure state.
891  string failure_reason = 2;
892}
893
894message CancelExportLxdContainerRequest {
895  // Name of the VM the container is in.
896  string vm_name = 1;
897
898  // The owner of the VM and container.
899  string owner_id = 2;
900
901  // The container name of the in-progress export.
902  string in_progress_container_name = 3;
903}
904
905message CancelExportLxdContainerResponse {
906  enum Status {
907    // The result is unknown.
908    UNKNOWN = 0;
909
910    // The cancel for the in-progress request has been queued.
911    // The in-progress request may yet complete before the cancel is processed.
912    CANCEL_QUEUED = 1;
913
914    // No in-progress request was found with that container name.
915    OPERATION_NOT_FOUND = 2;
916
917    // One or more steps failed and the cancel could not be scheduled.
918    FAILED = 3;
919  }
920
921  // The status of the cancellation.
922  Status status = 1;
923
924  // Details relating to the failure state.
925  string failure_reason = 2;
926}
927
928message ExportLxdContainerProgressSignal {
929  // Name of the VM the container is in.
930  string vm_name = 1;
931
932  // Name of the container exporting.
933  string container_name = 2;
934
935  // The owner of the VM and container.
936  string owner_id = 3;
937
938  enum Status {
939    // The result is unknown.
940    UNKNOWN = 0;
941
942    // Export is completed.
943    DONE = 1;
944
945    // One or more steps failed and the container could not be exported.
946    FAILED = 2;
947
948    // Deprecated. The container is exporting into a tar file.
949    EXPORTING_TAR = 3 [deprecated = true];
950
951    // Deprecated. The container tar file is being compressed into an image
952    // file.
953    EXPORTING_COMPRESS = 4 [deprecated = true];
954
955    // Deprecated. The exported image file is being downloaded.
956    EXPORTING_DOWNLOAD = 5 [deprecated = true];
957
958    // Deprecated. The exported image file is being packed. This is equivalent
959    // to tar/compress.
960    EXPORTING_PACK = 6 [deprecated = true];
961
962    // EXPORTING_PACK and EXPORTING_DOWNLOAD have been combined into
963    // EXPORTING_STREAMING. The exported image file is being tar'd, compressed'd
964    // and download'd out of the container.
965    EXPORTING_STREAMING = 7;
966
967    // The export was cancelled by a CancelExportLxdContainerRequest.
968    CANCELLED = 8;
969  }
970
971  // Container status.
972  Status status = 4;
973
974  // Deprecated. Percentage progress for the current stage given in status.
975  uint32 progress_percent = 5 [deprecated = true];
976
977  // Deprecated. Speed (bytes per second) for the current stage given in status.
978  uint64 progress_speed = 6 [deprecated = true];
979
980  // Details relating to the failure state.
981  string failure_reason = 7;
982
983  // Total number of files in the input container.
984  uint32 total_input_files = 8;
985
986  // Total size of the files in the input container.
987  uint64 total_input_bytes = 9;
988
989  // Number of files in the input container that have been downloaded.
990  uint32 input_files_streamed = 10;
991
992  // Size of the files in the input container that have been downloaded.
993  uint64 input_bytes_streamed = 11;
994
995  // Number of compressed bytes that have been exported.
996  uint64 bytes_exported = 12;
997}
998
999message ImportLxdContainerRequest {
1000  // Name of the VM the container is in.
1001  string vm_name = 1;
1002
1003  // Name of the container importing.
1004  string container_name = 2;
1005
1006  // The owner of the VM and container.
1007  string owner_id = 3;
1008
1009  // Path to read the imported container.  This is a file which
1010  // must have already been shared using seneschal.  It is the path relative
1011  // to the VM root mount point (/mnt/shared) as returned in seneschal
1012  // SharePathResponse.path.  E.g.: "MyFiles/export/backup.tar.gz".
1013  string import_path = 4;
1014}
1015
1016message ImportLxdContainerResponse {
1017  enum Status {
1018    // The result is unknown.
1019    UNKNOWN = 0;
1020
1021    // The container is importing. Further updates will be delievered via
1022    // ImportLxdContainerProgressSignal.
1023    IMPORTING = 1;
1024
1025    // One or more steps failed and the container could not be imported.
1026    FAILED = 2;
1027  }
1028
1029  // Current container status.
1030  Status status = 1;
1031
1032  // Details relating to the failure state.
1033  string failure_reason = 2;
1034}
1035
1036message CancelImportLxdContainerRequest {
1037  // Name of the VM the container is in.
1038  string vm_name = 1;
1039
1040  // The owner of the VM and container.
1041  string owner_id = 2;
1042
1043  // The container name of the in-progress import.
1044  string in_progress_container_name = 3;
1045}
1046
1047message CancelImportLxdContainerResponse {
1048  enum Status {
1049    // The result is unknown.
1050    UNKNOWN = 0;
1051
1052    // The cancel for the in-progress request has been queued.
1053    // The in-progress request may yet complete before the cancel is processed.
1054    CANCEL_QUEUED = 1;
1055
1056    // No in-progress request was found with that container name.
1057    OPERATION_NOT_FOUND = 2;
1058
1059    // One or more steps failed and the cancel could not be scheduled.
1060    FAILED = 3;
1061  }
1062
1063  // The status of the cancellation.
1064  Status status = 1;
1065
1066  // Details relating to the failure state.
1067  string failure_reason = 2;
1068}
1069
1070message ImportLxdContainerProgressSignal {
1071  // Name of the VM the container is in.
1072  string vm_name = 1;
1073
1074  // Name of the container importing.
1075  string container_name = 2;
1076
1077  // The owner of the VM and container.
1078  string owner_id = 3;
1079
1080  enum Status {
1081    // The result is unknown.
1082    UNKNOWN = 0;
1083
1084    // Import is completed.
1085    DONE = 1;
1086
1087    // One or more steps failed and the container could not be imported.
1088    FAILED = 2;
1089
1090    // The image is being uploaded.
1091    IMPORTING_UPLOAD = 3;
1092
1093    // The image is being unpacked to create a container.
1094    IMPORTING_UNPACK = 4;
1095
1096    // The container could not be imported due to mismatched architecture.
1097    FAILED_ARCHITECTURE = 5;
1098
1099    // The container could not be imported due to insufficient space.
1100    FAILED_SPACE = 6;
1101
1102    // The import was cancelled by a CancelImportLxdContainerRequest.
1103    CANCELLED = 7;
1104  }
1105
1106  // Container status.
1107  Status status = 4;
1108
1109  // Percentage progress for the current stage given in status.
1110  uint32 progress_percent = 5;
1111
1112  // Speed (bytes per second) for the current stage given in status.
1113  uint64 progress_speed = 6;
1114
1115  // Details relating to the failure state.
1116  string failure_reason = 7;
1117
1118  // Architecture of device.  Set when status is FAILED_ARCHITECTURE.
1119  string architecture_device = 8;
1120
1121  // Architecture of container which failed to import.
1122  // Set when status is FAILED_ARCHITECTURE.
1123  string architecture_container = 9;
1124
1125  // Available space for import.  Set when status is FAILED_SPACE.
1126  uint64 available_space = 10;
1127
1128  // Minimum required space for import.  Set when status is FAILED_SPACE.
1129  uint64 min_required_space = 11;
1130}
1131
1132message PendingAppListUpdatesSignal {
1133  // Name of the VM on which the app list updates will run.
1134  string vm_name = 1;
1135
1136  // Name of the container on which the app list updates will run.
1137  string container_name = 2;
1138
1139  // Number of currently scheduled app list updates for this container.
1140  uint32 count = 3;
1141}
1142
1143message ApplyAnsiblePlaybookRequest {
1144  // Name of the VM to target.
1145  string vm_name = 1;
1146
1147  // Name of the container within the VM to target.
1148  string container_name = 2;
1149
1150  // The owner of the VM and container.
1151  string owner_id = 3;
1152
1153  // Ansible playbook to be applied.
1154  string playbook = 4;
1155}
1156
1157message ApplyAnsiblePlaybookResponse {
1158  enum Status {
1159    // The status is unknown.
1160    UNKNOWN = 0;
1161
1162    // Application process was successfully started, all further updates will be
1163    // sent via the ApplyAnsiblePlaybookProgress signal.
1164    STARTED = 1;
1165
1166    // Failed to start up for a general reason, specific details are given in
1167    // failure_reason.
1168    FAILED = 2;
1169  }
1170  Status status = 1;
1171
1172  // Contains a textual reason for the failure in case of a FAILED status.
1173  string failure_reason = 2;
1174}
1175
1176message ApplyAnsiblePlaybookProgressSignal {
1177  // Name of the VM the container is in.
1178  string vm_name = 1;
1179
1180  // Name of the container within the VM.
1181  string container_name = 2;
1182
1183  // The owner of the VM and container.
1184  string owner_id = 3;
1185
1186  enum Status {
1187    // The signal has unknown status.
1188    UNKNOWN = 0;
1189
1190    // Application has completed and was successfull. No further signals will be
1191    // sent after this one.
1192    SUCCEEDED = 1;
1193
1194    // Application failed to complete, the specific reason will be in
1195    // failure_details. No further signals will be sent after this one.
1196    FAILED = 2;
1197
1198    // Ansible playbook is being currently applied.
1199    IN_PROGRESS = 3;
1200  }
1201
1202  // Current status of the application progress.
1203  Status status = 4;
1204
1205  // Contains a textual reason for the failure in case of a FAILED status.
1206  string failure_details = 5;
1207}
1208
1209message ConfigureForArcSideloadRequest {
1210  // Name of the VM to target.
1211  string vm_name = 1;
1212
1213  // Name of the container within the VM to target.
1214  string container_name = 2;
1215
1216  // The owner of the VM and container.
1217  string owner_id = 3;
1218}
1219
1220message ConfigureForArcSideloadResponse {
1221  enum Status {
1222    // The status is unknown.
1223    UNKNOWN = 0;
1224
1225    // The configuration succeeded.
1226    SUCCEEDED = 2;
1227
1228    // The configuration failed.
1229    FAILED = 3;
1230  }
1231
1232  // Status of the request.
1233  Status status = 1;
1234
1235  // If status is FAILED, contains the reason the request failed.
1236  string failure_reason = 2;
1237}
1238
1239// Request for a container to create a tunnel to a prepared port on the host.
1240message ConnectChunnelRequest {
1241  // Name of the VM to tunnel traffic to.
1242  string vm_name = 1;
1243
1244  // Name of the container within the VM to target.
1245  string container_name = 2;
1246
1247  // The owner of the VM and container.
1248  string owner_id = 3;
1249
1250  // Name of the container to tunnel traffic to.
1251  // Target vsock port to forward traffic from. This port must be listening
1252  // and ready to accept a connection from the chunnel client.
1253  uint32 chunneld_port = 4;
1254
1255  // Target TCPv4 port to forward traffic to. Chunnel in the guest will connect
1256  // to localhost:target_tcp4_port.
1257  uint32 target_tcp4_port = 5;
1258}
1259
1260// Response to ConnectChunnelRequest.
1261message ConnectChunnelResponse {
1262  enum Status {
1263    // The result is unknown.
1264    UNKNOWN = 0;
1265
1266    // Chunnel was successfully launched in the container.
1267    SUCCESS = 1;
1268
1269    // One or more steps failed and chunnel could not be connected.
1270    FAILED = 2;
1271  }
1272
1273  // Status of the request.
1274  Status status = 1;
1275
1276  // If status is FAILED, contains the reason the request failed.
1277  string failure_reason = 2;
1278}
1279
1280message UpgradeContainerRequest {
1281  // Name of the VM the container is in.
1282  string vm_name = 1;
1283
1284  // Name of the container to upgrade.
1285  string container_name = 2;
1286
1287  // The owner of the VM and container.
1288  string owner_id = 3;
1289
1290  enum Version {
1291    // Uknown OS version.
1292    UNKNOWN = 0;
1293
1294    // Debian 9 AKA Stretch.
1295    DEBIAN_STRETCH = 1;
1296
1297    // Debian 10 AKA Buster.
1298    DEBIAN_BUSTER = 2;
1299  }
1300  // Version from which the container will upgrade.
1301  Version source_version = 4;
1302
1303  // Version to which the container will be upgraded.
1304  Version target_version = 5;
1305}
1306
1307message UpgradeContainerResponse {
1308  enum Status {
1309    // The result is unknown.
1310    UNKNOWN = 0;
1311
1312    // Upgrade successfully started.
1313    STARTED = 1;
1314
1315    // An upgrade is already running.
1316    ALREADY_RUNNING = 2;
1317
1318    // Upgrade path not supported e.g. buster->stretch.
1319    NOT_SUPPORTED = 3;
1320
1321    // The container is already upgraded to the requested target_version.
1322    ALREADY_UPGRADED = 4;
1323
1324    // Failed to start the upgrade for some other reason.
1325    FAILED = 5;
1326  }
1327
1328  // Status of the request.
1329  Status status = 1;
1330
1331  // If status is FAILED, contains the reason the request failed.
1332  string failure_reason = 2;
1333}
1334
1335message CancelUpgradeContainerRequest {
1336  // Name of the VM the container is in.
1337  string vm_name = 1;
1338
1339  // Name of the container being upgraded.
1340  string container_name = 2;
1341
1342  // The owner of the VM and container.
1343  string owner_id = 3;
1344}
1345
1346message CancelUpgradeContainerResponse {
1347  enum Status {
1348    // The status is unknown.
1349    UNKNOWN = 0;
1350
1351    // Upgrade was not in progress, nothing to do.
1352    NOT_RUNNING = 1;
1353
1354    // Upgrade cancelled.
1355    CANCELLED = 2;
1356
1357    // Failed to cancel.
1358    FAILED = 3;
1359  }
1360
1361  // Status of the request.
1362  Status status = 1;
1363
1364  // If status is FAILED, contains the reason the request failed.
1365  string failure_reason = 2;
1366}
1367
1368message UpgradeContainerProgressSignal {
1369  // Name of the VM the container is in.
1370  string vm_name = 1;
1371
1372  // Name of the container to upgrade.
1373  string container_name = 2;
1374
1375  // The owner of the VM and container.
1376  string owner_id = 3;
1377
1378  enum Status {
1379    // The current status is unknown.
1380    UNKNOWN = 0;
1381
1382    // Still in progress.
1383    IN_PROGRESS = 1;
1384
1385    // Completed successfully.
1386    SUCCEEDED = 2;
1387
1388    // Failed to complete.
1389    FAILED = 3;
1390  }
1391
1392  // Status of the upgrade.
1393  Status status = 4;
1394
1395  // If status is FAILED, contains the reason the upgrade failed.
1396  string failure_reason = 5;
1397
1398  // Human readable upgrade progress.
1399  repeated string progress_messages = 6;
1400}
1401
1402message StartLxdRequest {
1403  // Name of the VM to start LXD in.
1404  string vm_name = 1;
1405
1406  // The owner of the VM.
1407  string owner_id = 2;
1408
1409  // If true, opt-in to resetting the LXD DB on launch. If false, use whatever
1410  // the default behaviour is.
1411  bool reset_lxd_db = 3;
1412}
1413
1414message StartLxdResponse {
1415  enum Status {
1416    // The status of creating the container is unknown.
1417    UNKNOWN = 0;
1418
1419    // LXD is starting.
1420    STARTING = 1;
1421
1422    // LXD is already running.
1423    ALREADY_RUNNING = 2;
1424
1425    // Could not launch LXD.
1426    FAILED = 3;
1427  }
1428
1429  // LXD launch status
1430  Status status = 1;
1431
1432  // The failure_reason if LXD could not be started.
1433  string failure_reason = 2;
1434}
1435
1436// Sent by tremplin to update the host on the start progress of starting LXD.
1437message StartLxdProgressSignal {
1438  enum Status {
1439    // The status of creating the container is unknown.
1440    UNKNOWN = 0;
1441
1442    // LXD is starting.
1443    STARTING = 1;
1444
1445    // Something went wrong, Tremplin is trying to recover LXD.
1446    // This is still an in-progress status.
1447    RECOVERING = 2;
1448
1449    // LXD is now running.
1450    STARTED = 3;
1451
1452    // Could not launch LXD.
1453    FAILED = 4;
1454  }
1455
1456  // Name of the VM to start LXD in.
1457  string vm_name = 1;
1458
1459  // The owner of the VM.
1460  string owner_id = 2;
1461
1462  // LXD launch status
1463  Status status = 3;
1464
1465  // The failure_reason if LXD could not be started.
1466  string failure_reason = 4;
1467}
1468
1469// Request to watch files and notify if there are changes. Used by FilesApp.
1470message AddFileWatchRequest {
1471  // Name of the VM the container is in.
1472  string vm_name = 1;
1473
1474  // Name of the container within the VM.
1475  string container_name = 2;
1476
1477  // The owner of the VM and container.
1478  string owner_id = 3;
1479
1480  // Directory in container relative to $HOME to watch.
1481  string path = 4;
1482}
1483
1484message AddFileWatchResponse {
1485  enum Status {
1486    // The current status is unknown.
1487    UNKNOWN = 0;
1488
1489    // Watch added successfully.
1490    SUCCEEDED = 2;
1491
1492    // Add watch failed.
1493    FAILED = 1;
1494  }
1495
1496  // Add watch status.
1497  Status status = 1;
1498
1499  // The failure_reason if the watcher could not be added.
1500  string failure_reason = 2;
1501}
1502
1503// Request to stop watching files.
1504message RemoveFileWatchRequest {
1505  // Name of the VM the container is in.
1506  string vm_name = 1;
1507
1508  // Name of the container within the VM.
1509  string container_name = 2;
1510
1511  // The owner of the VM and container.
1512  string owner_id = 3;
1513
1514  // Directory in container relative to $HOME to stop watching.
1515  string path = 4;
1516}
1517
1518message RemoveFileWatchResponse {
1519  enum Status {
1520    // The current status is unknown.
1521    UNKNOWN = 0;
1522
1523    // Watch removed successfully.
1524    SUCCEEDED = 2;
1525
1526    // Remove watch failed.
1527    FAILED = 1;
1528  }
1529
1530  // Remove watch status.
1531  Status status = 1;
1532
1533  // The failure_reason if the watcher could not be removed.
1534  string failure_reason = 2;
1535}
1536
1537// Sent by garcon to notify that a file in a watched directory has changed. Used
1538// by FilesApp.
1539message FileWatchTriggeredSignal {
1540  // Name of the VM the container is in.
1541  string vm_name = 1;
1542
1543  // Name of the container within the VM.
1544  string container_name = 2;
1545
1546  // The owner of the VM and container.
1547  string owner_id = 3;
1548
1549  // Path in container relative to $HOME that has changed.
1550  string path = 4;
1551}
1552
1553// Sent by vsh to register session information such as the container shell pid,
1554// keyed from the host vsh pid. Crostini terminal will look up this info for
1555// features such as starting new terminals in the same cwd.
1556message RegisterVshSessionRequest {
1557  // Name of the VM the container is in.
1558  string vm_name = 1;
1559
1560  // Name of the container within the VM.
1561  string container_name = 2;
1562
1563  // The owner of the VM and container.
1564  string owner_id = 3;
1565
1566  // Process ID of vsh running in host.
1567  int32 host_vsh_pid = 4;
1568
1569  // Process ID of shell spawned from vshd running in container. Set to 0 to
1570  // remove mapping.
1571  int32 container_shell_pid = 5;
1572}
1573
1574message RegisterVshSessionResponse {
1575  // True if pid mapping was completed.
1576  bool success = 1;
1577
1578  // The reason the pid mapping failed.
1579  string failure_reason = 2;
1580}
1581
1582// Sent by chrome to query the container shell pid associated with vsh.
1583message GetVshSessionRequest {
1584  // Name of the VM the container is in.
1585  string vm_name = 1;
1586
1587  // Name of the container within the VM.
1588  string container_name = 2;
1589
1590  // The owner of the VM and container.
1591  string owner_id = 3;
1592
1593  // Process ID of vsh running in host.
1594  int32 host_vsh_pid = 4;
1595}
1596
1597message GetVshSessionResponse {
1598  // True if container pid was found.
1599  bool success = 1;
1600
1601  // The reason the pid was not found.
1602  string failure_reason = 2;
1603
1604  // Process ID of shell spawned from vshd running in container.
1605  int32 container_shell_pid = 3;
1606}
1607