1// Copyright 2017 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 starting, stopping, and managing VMs. 9package vm_tools.concierge; 10 11// Specification of the key components of a VM. 12message VirtualMachineSpec { 13 // Path to the kernel that should be used for the VM. 14 string kernel = 1; 15 16 // Path to the disk image that should be used as the root file system for 17 // the VM. 18 string rootfs = 2; 19} 20 21// The type of disk image. 22enum DiskImageType { 23 // A raw file. 24 DISK_IMAGE_RAW = 0; 25 26 // A qcow2-compatible disk image. 27 DISK_IMAGE_QCOW2 = 1; 28} 29 30// Describes any additional disk images that should be mounted inside the VM. 31message DiskImage { 32 // Path to the disk image on the host. 33 string path = 1; 34 35 // Path where this disk image will be mounted inside the VM. 36 string mount_point = 2; 37 38 // The file system type for this disk image. 39 string fstype = 3; 40 41 // Any special flags to be used when mounting the file system. Specified the 42 // same way as in mount(2). 43 uint64 flags = 4; 44 45 // Any additional data associated with the mount. 46 string data = 5; 47 48 // If true, the disk image will be mounted writable. 49 bool writable = 6; 50 51 // If true, the disk image will be mounted. 52 bool do_mount = 7; 53 54 // Image type of the disk. 55 DiskImageType image_type = 8; 56} 57 58// Information about a particular VM. 59message VmInfo { 60 // The IPv4 address assigned to the VM, in network byte order. 61 fixed32 ipv4_address = 1; 62 63 // The process ID of the main crosvm process for the VM. 64 int32 pid = 2; 65 66 // The virtual socket context id assigned to the VM. 67 int64 cid = 3; 68} 69 70// Information that must be included with every StartVm dbus message. 71message StartVmRequest { 72 // The VM that should be started. This is ignored if starting a termina VM, 73 // which will always use the latest component from imageloader. 74 VirtualMachineSpec vm = 1; 75 76 // Any additional disks that should be mounted inside the VM. 77 repeated DiskImage disks = 2; 78 79 // Path to a shared directory that will be mounted via NFS inside the VM. 80 string shared_directory = 3; 81 82 // The human-readable name to be assigned to this VM. 83 string name = 4; 84 85 // If true, concierge should also perform termina-specific setup. 86 bool start_termina = 5; 87} 88 89// Information sent back by vm_concierge in response to a StartVm dbus message. 90message StartVmResponse { 91 // If true, the VM was started successfully. |vm_info| will have non-default 92 // values only if this is true. 93 bool success = 1; 94 95 // If the VM failed to start, the reason for the failure. 96 string failure_reason = 2; 97 98 // Information about the VM that was started, if successful. 99 VmInfo vm_info = 3; 100} 101 102// Information that must be included with every StopVm dbus message. 103message StopVmRequest { 104 // The name of the VM to be stopped. 105 string name = 1; 106} 107 108// Response sent back by vm_concierge when it receives a StopVm dbus message. 109message StopVmResponse { 110 // If true, the requested VM was stopped. 111 bool success = 1; 112 113 // The failure_reason if the requested VM could not be stopped. 114 string failure_reason = 2; 115} 116 117// Request for information about the VM. 118message GetVmInfoRequest { 119 // The name of the VM to query. 120 string name = 1; 121} 122 123// Response sent back by vm_concierge for a GetVmInfo dbus message. 124message GetVmInfoResponse { 125 // If true, the requested VM exists and info was returned. 126 bool success = 1; 127 128 // Information about the VM that was requested. 129 VmInfo vm_info = 2; 130} 131 132// The type of storage location for a disk image. 133enum StorageLocation { 134 // Subdirectory under /home/root/<id>/crosvm. 135 STORAGE_CRYPTOHOME_ROOT = 0; 136 137 // The user's Downloads directory, under /home/user/<id>/Downloads. 138 STORAGE_CRYPTOHOME_DOWNLOADS = 1; 139} 140 141enum DiskImageStatus { 142 // Unknown status. 143 DISK_STATUS_UNKNOWN = 0; 144 145 // The disk image was created. 146 DISK_STATUS_CREATED = 1; 147 148 // The disk already existed. 149 DISK_STATUS_EXISTS = 2; 150 151 // Unable to create the disk image. 152 DISK_STATUS_FAILED = 3; 153 154 // Specified Disk does not exist. 155 DISK_STATUS_DOES_NOT_EXIST = 4; 156 157 // The specified disk was destroyed. 158 DISK_STATUS_DESTROYED = 5; 159} 160 161// Request to concierge to create a disk image. 162message CreateDiskImageRequest { 163 // The cryptohome id for the user's encrypted storage. 164 string cryptohome_id = 1; 165 166 // The path to the disk image. This must be a relative path, and any 167 // directories must already exist. 168 string disk_path = 2; 169 170 // The logical size of the new disk image, in bytes. 171 uint64 disk_size = 3; 172 173 // The type of disk image to be created. 174 DiskImageType image_type = 4; 175 176 // The storage location for the disk image. 177 StorageLocation storage_location = 5; 178} 179 180// Response to a CreateDiskImageRequest. 181message CreateDiskImageResponse { 182 // If true, the disk image has been successfully created. 183 DiskImageStatus status = 1; 184 185 // The absolute path to the created disk image, if it was successfully 186 // created or already existed. 187 string disk_path = 2; 188 189 // The failure reason if the disk image could not be created or doesn't exist. 190 string failure_reason = 3; 191} 192 193// Request to concierge to destroy a disk image. 194message DestroyDiskImageRequest { 195 // The cryptohome id for the user's encrypted storage. 196 string cryptohome_id = 1; 197 198 // The path to the disk image. This must be a relative path. 199 string disk_path = 2; 200 201 // The storage location for the disk image. 202 StorageLocation storage_location = 3; 203} 204 205// Response to a DestroyDiskImageRequest. 206message DestroyDiskImageResponse { 207 // If DISK_STATUS_DESTROYED, the disk image has been successfully destroyed. 208 // If DISK_STATUS_DOES_NOT_EXIST, the disk image had already been removed. 209 DiskImageStatus status = 1; 210 211 // The failure reason if the disk image could not be destroyed or doesn't exist. 212 string failure_reason = 3; 213} 214