| // 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"; |
| option optimize_for = LITE_RUNTIME; |
| |
| // This file defines messages used for starting, stopping, and managing VMs. |
| package vm_tools.concierge; |
| option go_package = "vm_concierge_proto"; |
| |
| // 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; |
| |
| // Automatically choose a disk image type. |
| DISK_IMAGE_AUTO = 2; |
| } |
| |
| // 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; |
| |
| // The handle to a 9p server managed by the seneschal system service. Use |
| // this handle when making requests to that service to manage the files shared |
| // with this VM. |
| uint64 seneschal_server_handle = 4; |
| } |
| |
| // 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. Also ignored |
| // if |allow_untrusted| is set to false. |
| 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. |
| // DEPRECATED: The server never did anything with this field. Instead callers |
| // should use the |shared_dir_handle| field of the VmInfo message to get a |
| // server handle that can be used in requests to the seneschal system service. |
| string shared_directory = 3 [deprecated = true]; |
| |
| // 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; |
| |
| // If true, a file descriptor must be passed along with the message and that |
| // file descriptor will be used for storage. |
| // Ignored unless |start_termina| is true. |
| bool use_fd_for_storage = 6; |
| |
| // The owner of the vm. |
| string owner_id = 7; |
| |
| // Enable GPU in the started Vm. |
| bool enable_gpu = 8; |
| |
| // Provide a software-based virtual Trusted Platform Module to the VM. The TPM |
| // is backed by libtpm2's TPM simulator and does not interact with any |
| // physical TPM on the host device. TPM state does not persist across VM |
| // launches. In order for the VM to see the virtual TPM, the guest kernel must |
| // contain a virtio TPM driver. |
| bool software_tpm = 9; |
| |
| // Allow untrusted VMs to be started. |
| bool allow_untrusted = 10; |
| } |
| |
| // Information that must be included with every StartPluginVm request. |
| message StartPluginVmRequest { |
| // An identifier for this VM. |
| string name = 1; |
| |
| // The cryptohome id of the owner of this VM. |
| string owner_id = 2; |
| |
| // The number of CPUs to give to the VM. Cannot be larger than the number of |
| // CPUs on the device and cannot be 0. |
| uint32 cpus = 3; |
| |
| // Parameters to pass to the plugin process. |
| repeated string params = 4; |
| |
| // The IPv4 address to assign to the VM in network-byte order. Must be in the |
| // 100.115.92.128/28 subnet and must not be already assigned to another VM. |
| fixed32 guest_ipv4_address = 5; |
| |
| // The EUI-48 MAC address to assign to the host side of the ethernet interface |
| // to the VM. Must be exactly 6 bytes and must not be in use by another VM. |
| // Must have the locally administered bit (0x02) set and the multicast bit |
| // (0x01) unset. |
| bytes host_mac_address = 6; |
| } |
| |
| // Information that must be included with every StartArcVm request. |
| message StartArcVmRequest { |
| // The VM that should be started. |
| VirtualMachineSpec vm = 1; |
| |
| // Any additional disks that should be mounted inside the VM. |
| repeated DiskImage disks = 2; |
| |
| // An identifier for this VM. |
| string name = 3; |
| |
| // The cryptohome id of the owner of this VM. |
| string owner_id = 4; |
| |
| // Parameters to pass to the ARCVM's init process. |
| repeated string params = 5; |
| |
| // Path to Android fstab. |
| string fstab = 6; |
| } |
| |
| enum VmStatus { |
| // Unknown status. |
| VM_STATUS_UNKNOWN = 0; |
| |
| // The VM is already running. |
| VM_STATUS_RUNNING = 1; |
| |
| // The VM is currently starting up. |
| VM_STATUS_STARTING = 2; |
| |
| // The VM failed to startup. |
| VM_STATUS_FAILURE = 3; |
| } |
| |
| // 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; |
| |
| // Status of the VM. If VM_STATUS_RUNNING, it is not necessary to wait for a |
| // TremplinStartedSignal before starting a container in the VM. |
| VmStatus status = 4; |
| } |
| |
| // Message used in the signal for when a VM has started. |
| message VmStartedSignal { |
| // The name of the VM which has started. |
| string name = 1; |
| |
| // The owner of the vm. |
| string owner_id = 2; |
| |
| // Information about the VM that was started, if successful. |
| VmInfo vm_info = 3; |
| |
| // Status of the VM. If VM_STATUS_RUNNING, it is not necessary to wait for a |
| // TremplinStartedSignal before starting a container in the VM. |
| VmStatus status = 4; |
| } |
| |
| // Information that must be included with every StopVm dbus message. |
| message StopVmRequest { |
| // The name of the VM to be stopped. |
| string name = 1; |
| |
| // The owner of the vm. |
| string owner_id = 2; |
| } |
| |
| // 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; |
| } |
| |
| // Message used in the signal for when a VM has stopped. |
| message VmStoppedSignal { |
| // The name of the VM which has stopped. |
| string name = 1; |
| |
| // The owner of the vm. |
| string owner_id = 2; |
| } |
| |
| // Response to a SyncTimes RPC. |
| message SyncVmTimesResponse { |
| // The total number of VMs we attempted to update. |
| uint32 requests = 1; |
| // Number of failed requests. |
| uint32 failures = 2; |
| // Reasons for failures, if any. |
| repeated string failure_reason = 3; |
| } |
| |
| // Request for information about the VM. |
| message GetVmInfoRequest { |
| // The name of the VM to query. |
| string name = 1; |
| |
| // The owner of the vm. |
| string owner_id = 2; |
| } |
| |
| // 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; |
| } |
| |
| // Request for information about the VM that is specific to |
| // enterprise reporting. |
| message GetVmEnterpriseReportingInfoRequest { |
| // The name of the VM. |
| string vm_name = 1; |
| |
| // The owner of the VM (cryptohome id). |
| string owner_id = 2; |
| } |
| |
| // Response sent back by vm_concierge after it receives a GetEnterpriseReportingInfo |
| // call. Right now this only returns the kernel version of the Termina VM. |
| // The VM must be running in order for the call to deliver the kernel version. |
| message GetVmEnterpriseReportingInfoResponse { |
| bool success = 1; |
| string failure_reason = 2; |
| |
| string vm_kernel_version = 3; |
| } |
| |
| // The type of storage location for a disk image. |
| enum StorageLocation { |
| // Subdirectory under /home/root/<id>/crosvm. |
| STORAGE_CRYPTOHOME_ROOT = 0; |
| |
| // Subdirectory under /home/root/<id>/pvm. |
| STORAGE_CRYPTOHOME_PLUGINVM = 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; |
| |
| // Specified Disk does not exist. |
| DISK_STATUS_DOES_NOT_EXIST = 4; |
| |
| // The specified disk was destroyed. |
| DISK_STATUS_DESTROYED = 5; |
| |
| // The command is executing. |
| DISK_STATUS_IN_PROGRESS = 6; |
| } |
| |
| // 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. |
| // If unspecified or 0, a size will be chosen automatically. |
| 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; |
| |
| // Size of the source media associated with this image. |
| uint64 source_size = 6; |
| |
| // Parameters to pass to Plugin VM helper to facilitate creating |
| // new image. |
| repeated string params = 7; |
| } |
| |
| // 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; |
| |
| // Command identifier if status is DISK_STATUS_IN_PROGRESS. |
| string command_uuid = 4; |
| } |
| |
| // Request to concierge to destroy a disk image. |
| message DestroyDiskImageRequest { |
| // 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. |
| string disk_path = 2; |
| } |
| |
| // Response to a DestroyDiskImageRequest. |
| message DestroyDiskImageResponse { |
| // If DISK_STATUS_DESTROYED, the disk image has been successfully destroyed. |
| // If DISK_STATUS_DOES_NOT_EXIST, the disk image had already been removed. |
| DiskImageStatus status = 1; |
| |
| // The failure reason if the disk image could not be destroyed or doesn't exist. |
| string failure_reason = 3; |
| } |
| |
| // Request to concierge to export a disk image. |
| // Must be accompanied by an FD. The contents of `disk_path` will be written to |
| // the passed FD. |
| message ExportDiskImageRequest { |
| // 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. |
| string disk_path = 2; |
| } |
| |
| // Response to a ExportDiskImageRequest. |
| message ExportDiskImageResponse { |
| // If DISK_STATUS_CREATED, the disk image has been successfully exported. |
| DiskImageStatus status = 1; |
| |
| // The failure reason if the disk image could not be exported. |
| string failure_reason = 2; |
| |
| // Command identifier if status is DISK_STATUS_IN_PROGRESS. |
| string command_uuid = 3; |
| } |
| |
| // Request to concierge to import a disk image. |
| // Must be accompanied by an FD. The contents will be written at `disk_path` |
| // location. |
| message ImportDiskImageRequest { |
| // The cryptohome id for the user's encrypted storage. |
| string cryptohome_id = 1; |
| |
| // The path to the resulting disk image. This must be a relative path. |
| string disk_path = 2; |
| |
| // The storage location for the disk image. |
| StorageLocation storage_location = 3; |
| |
| // Size of the source image (corresponding to the passed FD). |
| // Used to calculate progress of the import operation. |
| uint64 source_size = 4; |
| } |
| |
| // Response to a ImportDiskImageRequest. |
| message ImportDiskImageResponse { |
| // If DISK_STATUS_CREATED, the disk image has been successfully imported. |
| DiskImageStatus status = 1; |
| |
| // The failure reason if the disk image could not be imported. |
| string failure_reason = 2; |
| |
| // Command identifier if status is DISK_STATUS_IN_PROGRESS. |
| string command_uuid = 3; |
| } |
| |
| // Request about status of image import or export command. |
| message DiskImageStatusRequest { |
| // Command identifier. |
| string command_uuid = 1; |
| } |
| |
| // Response to DiskImageStatusRequest. Also being sent as a signal. |
| message DiskImageStatusResponse { |
| // Command identifier. |
| string command_uuid = 1; |
| |
| // Status of the command. |
| DiskImageStatus status = 2; |
| |
| // The failure reason if the command could not be completed. |
| string failure_reason = 3; |
| |
| // Progress from 0 to 100. |
| uint32 progress = 4; |
| } |
| |
| // Request to cancel image import or export command that is being |
| // executed. |
| message CancelDiskImageRequest { |
| // Command identifier. |
| string command_uuid = 1; |
| } |
| |
| // Response to CancelDiskImageRequest. |
| message CancelDiskImageResponse { |
| // If true, the request was successfully canceled. The request will |
| // fail if it is unknown, or if it has already completed (successfully |
| // or unsuccessfully). |
| bool success = 1; |
| |
| // The failure reason if the command could not be completed. |
| string failure_reason = 2; |
| } |
| |
| // Request to list all VM disk images in the given storage area. |
| message ListVmDisksRequest { |
| // The cryptohome id for the user's encrypted storage. |
| string cryptohome_id = 1; |
| |
| // The storage location to check. |
| StorageLocation storage_location = 2; |
| |
| // Requester may set this field to 'true' to retrieve data about |
| // images in all known locations, in which case data in storage_location |
| // field will be ignored. |
| bool all_locations = 3; |
| |
| // Tells concierge to only return data about specified VM with matching |
| // name. When empty, information about all VMs will be returned. |
| string vm_name = 4; |
| } |
| |
| // Information about VM image. |
| message VmDiskInfo { |
| // Name of the image. |
| string name = 1; |
| |
| // Location of the image. |
| StorageLocation storage_location = 2; |
| |
| // The size of the image in bytes. |
| uint64 size = 3; |
| } |
| |
| // Response to ListVmDisks { |
| message ListVmDisksResponse { |
| // If true, the images array is valid. |
| bool success = 1; |
| |
| // List of disk images. |
| repeated VmDiskInfo images = 2; |
| |
| // The failure reason if the disks could not be listed. |
| string failure_reason = 3; |
| |
| // The total size in bytes on disk of the disk images in the response. |
| uint64 total_size = 4; |
| } |
| |
| // Message used in the signal for when a container has failed to start up. |
| message ContainerStartedSignal { |
| // Name of the VM the container is in. |
| string vm_name = 1; |
| |
| // Name of the container within the VM. |
| string container_name = 2; |
| |
| // The owner of the vm and container. |
| string owner_id = 3; |
| } |
| |
| // Request to start a specified container image within a VM. If the container |
| // does not exist in the VM it will be created. Used with the StartContainer |
| // D-Bus message into vm_concierge. |
| // This method is deprecated and no longer implemented in vm_concierge. |
| // Requests to start a container should be handled through tremplin instead. |
| message StartContainerRequest { |
| option deprecated = true; |
| |
| // Name of the VM to start the container in. |
| string vm_name = 1; |
| |
| // Name of the container to start within the VM. If empty, the default |
| // container name will be used. |
| string container_name = 2; |
| |
| // Username for the default user in the container. This is only used if the |
| // container has not been created yet. |
| string container_username = 3; |
| |
| // Async mode is always used now. |
| bool async = 4 [deprecated=true]; |
| |
| // The cryptohome id for the user's encrypted storage. This is used for SSH |
| // key storage. |
| string cryptohome_id = 5; |
| } |
| |
| enum ContainerStatus { |
| // Unknown status. |
| CONTAINER_STATUS_UNKNOWN = 0; |
| |
| // The container is already running. |
| CONTAINER_STATUS_RUNNING = 1; |
| |
| // The container is currently starting up. |
| CONTAINER_STATUS_STARTING = 2; |
| |
| // The container failed to startup. |
| CONTAINER_STATUS_FAILURE = 3; |
| } |
| |
| // Response sent back by vm_concierge when it receives a StartContaienr D-Bus |
| // message. |
| message StartContainerResponse { |
| // Use the status field instead. |
| bool success = 1 [deprecated=true]; |
| |
| // The failure_reason if the status is CONTAINER_STATUS_FAILURE. |
| string failure_reason = 2; |
| |
| // The status of the container as a result of the StartContainer call. If the |
| // status is CONTAINER_STATUS_STARTING then a D-Bus signal will be sent to |
| // indicate whether success or failure occurred. The signal should be |
| // registered for before the StartContainer call is made because it may be |
| // sent before the call returns. |
| ContainerStatus status = 3; |
| } |
| |
| // Request to get the SSH keys associated with the host and a specific |
| // container for the GetContainerSshKeys call. These keys will be generated |
| // when StartContainer is called the first time for a container, so this should |
| // not be called until after that call is invoked. |
| message ContainerSshKeysRequest { |
| // Name of the VM to target. |
| string vm_name = 1; |
| |
| // Name of the container within the VM to target, if empty the default |
| // container name will be used. |
| string container_name = 2; |
| |
| // The cryptohome id for the user's encrypted storage. |
| string cryptohome_id = 3; |
| } |
| |
| // Response sent back by vm_concierge when it receives a GetContainerSshKeys |
| // call. If either of the keys do not exist, the empty string will be set for |
| // that value. |
| message ContainerSshKeysResponse { |
| // Public key of the container for verification of it as a known host. This |
| // will be a single line string equivalent to the contents in the ssh-keygen |
| // generated file. |
| string container_public_key = 1; |
| |
| // Private key for the host, counterpart to the public key which is stored in |
| // the container as an authorized host. This will be a multiline string that |
| // is equivalent to the contents in the ssh-keygen generated file. This will |
| // be the same for all VMs/containers. |
| string host_private_key = 2; |
| |
| // The hostname of the container. |
| string hostname = 3; |
| |
| // Public key of the host for verification of it as a known host. This |
| // will be a single line string equivalent to the contents in the ssh-keygen |
| // generated file. |
| string host_public_key = 4; |
| |
| // Private key for the container, counterpart to the public key which is |
| // stored in the container. This will be a multiline string that |
| // is equivalent to the contents in the ssh-keygen generated file. This is |
| // unique for each container. |
| string container_private_key = 5; |
| } |
| |
| // Request to vm_concierge to attach a USB device to a VM. |
| message AttachUsbDeviceRequest { |
| // Name of the VM to attach the USB device to. |
| string vm_name = 1; |
| |
| // The owner of the VM. |
| string owner_id = 2; |
| |
| // The USB bus the USB device is connected to. This value should fit |
| // in a uint8_t. |
| uint32 bus_number = 3; |
| |
| // The port number of the USB device on the bus. This value should |
| // fit in a uint8_t. |
| uint32 port_number = 4; |
| |
| // Vendor ID of the USB device. This value should fit in a uint16_t. |
| uint32 vendor_id = 5; |
| |
| // Produce ID of the USB device. This value should fit in a |
| // uint16_t. |
| uint32 product_id = 6; |
| } |
| |
| // Response sent back by vm_concierge after it receives an |
| // AttachUsbDeviceRequest call. |
| message AttachUsbDeviceResponse { |
| // Was the USB device successfully attached? |
| bool success = 1; |
| |
| // The USB port number that was allocated to the USB device on the guest. |
| uint32 guest_port = 2; |
| |
| // The reason for the failure, if there was one. |
| string reason = 3; |
| } |
| |
| // Request sent to remove a USB device from a VM. |
| message DetachUsbDeviceRequest { |
| // The name of the VM. |
| string vm_name = 1; |
| |
| // The owner of the VM. |
| string owner_id = 2; |
| |
| // The USB port the device is attached to on the guest. This value |
| // should fit in a uint8_t. |
| uint32 guest_port = 3; |
| } |
| |
| // Response sent back by vm_concierge after it receives a |
| // DetachUsbDeviceRequest call. |
| message DetachUsbDeviceResponse { |
| // Was the USB device successfully detached? |
| bool success = 1; |
| |
| // The reason for the failure, if there was one. |
| string reason = 2; |
| } |
| |
| // Request sent to get a list of all USB devices attached to a guest VM. |
| message ListUsbDeviceRequest { |
| // The name of the VM. |
| string vm_name = 1; |
| |
| // The owner of the VM. |
| string owner_id = 2; |
| } |
| |
| // A description of a single USB device. |
| message UsbDeviceMessage { |
| // The port it's attached to. |
| uint32 guest_port = 1; |
| |
| // The vendor ID of the device. |
| uint32 vendor_id = 2; |
| |
| // The product ID of the device. |
| uint32 product_id = 3; |
| |
| // The name of the device. |
| string device_name = 4; |
| } |
| |
| // Response sent back by vm_concierge after it receives a |
| // ListUsbDeviceRequest call. |
| message ListUsbDeviceResponse { |
| // Did the request succeed? |
| bool success = 1; |
| |
| // List of USB device descriptors, one for each attached USB device. |
| repeated UsbDeviceMessage usb_devices = 2; |
| } |
| |
| // Response sent back by vm_concierge after it receives a GetDnsSettings call. |
| // Also being broadcast via DnsSettingsChanged signal. |
| message DnsSettings { |
| // List of DNS servers. |
| repeated string nameservers = 1; |
| |
| // List of search domains. |
| repeated string search_domains = 2; |
| } |
| |
| enum CpuCgroup { |
| // The CPU cgroup for all Termina VM processes. |
| CPU_CGROUP_TERMINA = 0; |
| // The CPU cgroup for all Plugin VM processes. |
| CPU_CGROUP_PLUGINVM = 1; |
| // The CPU cgroup for all ARCVM processes. |
| CPU_CGROUP_ARCVM = 2; |
| } |
| |
| enum CpuRestrictionState { |
| // The CPU usage is relaxed. |
| CPU_RESTRICTION_FOREGROUND = 0; |
| // The CPU usage is tightly restricted. |
| CPU_RESTRICTION_BACKGROUND = 1; |
| } |
| |
| // Information that must be included with every SetVmCpuRestriction dbus |
| // message. |
| message SetVmCpuRestrictionRequest { |
| // The CPU cpu cgroup to change. |
| CpuCgroup cpu_cgroup = 1; |
| // The CPU restriction state to apply. |
| CpuRestrictionState cpu_restriction_state = 2; |
| } |
| |
| // Response sent back by vm_concierge after it receives a SetVmCpuRestriction |
| // call. |
| message SetVmCpuRestrictionResponse { |
| // Did the request succeed? |
| bool success = 1; |
| } |