| // Copyright 2022 The Fuchsia Authors. All rights reserved. |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| library fuchsia.virtualization; |
| using zx; |
| |
| type GuestStatus = strict enum { |
| NOT_STARTED = 1; |
| STARTED = 2; |
| }; |
| type GuestInfo = struct { |
| /// The current guest status. |
| guest_status GuestStatus; |
| }; |
| |
| @discoverable |
| protocol GuestManager { |
| /// Launch a new guest instance |
| /// |
| /// Returns ZX_ERR_ALREADY_EXISTS if the guest already launched |
| /// Returns ZX_ERR_INVALID_ARGS if failed to parse config from the guest package |
| LaunchGuest(resource struct { |
| guest_config GuestConfig; |
| controller server_end:Guest; |
| }) -> (struct {}) error zx.status; |
| |
| /// Connect to a currently running guest |
| ConnectToGuest(resource struct { |
| controller server_end:Guest; |
| }) -> (struct {}) error zx.status; |
| |
| /// Connect to the memory balloon of a currently running guest |
| ConnectToBalloon(resource struct { |
| controller server_end:BalloonController; |
| }); |
| |
| /// Returns an interface that can be used to access the host vsock endpoint. |
| GetHostVsockEndpoint(resource struct { |
| endpoint server_end:HostVsockEndpoint; |
| }); |
| |
| /// Query guest info |
| @transitional |
| GetGuestInfo() -> (resource struct { |
| guest_config GuestInfo; |
| }); |
| }; |
| |
| // TODO(fxbug.dev/100515): Reconsider the use of composition here |
| @discoverable |
| protocol ZirconGuestManager { |
| compose GuestManager; |
| }; |
| |
| @discoverable |
| protocol DebianGuestManager { |
| compose GuestManager; |
| }; |
| |
| @discoverable |
| protocol TerminaGuestManager { |
| compose GuestManager; |
| }; |