diff --git a/.clang-format b/.clang-format new file mode 100644 index 0000000000..25274707e6 --- /dev/null +++ b/.clang-format @@ -0,0 +1,8 @@ +Language: Proto +BasedOnStyle: Microsoft +AlignConsecutiveAssignments: Consecutive +BreakBeforeBraces: Attach +IndentWidth: 4 +InsertNewlineAtEOF: true +KeepEmptyLines: + AtEndOfFile: true diff --git a/Cargo.lock b/Cargo.lock index 0145935e22..143071b278 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -6093,6 +6093,7 @@ dependencies = [ "mesh_rpc", "prost", "prost-build", + "prost-types", ] [[package]] diff --git a/openvmm/openvmm_ttrpc_vmservice/Cargo.toml b/openvmm/openvmm_ttrpc_vmservice/Cargo.toml index 93239ee429..bf99c4493c 100644 --- a/openvmm/openvmm_ttrpc_vmservice/Cargo.toml +++ b/openvmm/openvmm_ttrpc_vmservice/Cargo.toml @@ -11,6 +11,7 @@ mesh.workspace = true mesh_rpc.workspace = true prost.workspace = true +prost-types.workspace = true [build-dependencies] mesh_build.workspace = true diff --git a/openvmm/openvmm_ttrpc_vmservice/build.rs b/openvmm/openvmm_ttrpc_vmservice/build.rs index 136db3722f..5fe5bc7ad2 100644 --- a/openvmm/openvmm_ttrpc_vmservice/build.rs +++ b/openvmm/openvmm_ttrpc_vmservice/build.rs @@ -11,5 +11,14 @@ fn main() { .compile_protos(&["src/vmservice.proto"], &["src"]) .unwrap(); - println!("cargo:rerun-if-changed=src/vmservice.proto"); + // TODO: std::fs::read_dir to (recursively) enumerate all `src/**/*.proto` files + // Tell cargo to recompile if any of these proto files are changed + let _ = [ + "src/vmservice.proto", + "src/vmservice.events.proto", + "src/vmservice.resource.proto", + "src/vmservice.scsi.proto", + "src/vmservice.state.proto", + ] + .map(|f| println!("cargo:rerun-if-changed={f}")); } diff --git a/openvmm/openvmm_ttrpc_vmservice/src/lib.rs b/openvmm/openvmm_ttrpc_vmservice/src/lib.rs index 771323424a..006e7c4a6c 100644 --- a/openvmm/openvmm_ttrpc_vmservice/src/lib.rs +++ b/openvmm/openvmm_ttrpc_vmservice/src/lib.rs @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -//! Rust binadings to the `vmservice.proto` TTRPC API +//! Rust bindings to the `vmservice.proto` TTRPC API #![expect(missing_docs)] #![forbid(unsafe_code)] @@ -12,5 +12,6 @@ // automated tools do not remove them. use mesh_rpc as _; use prost as _; +use prost_types as _; include!(concat!(env!("OUT_DIR"), "/vmservice.rs")); diff --git a/openvmm/openvmm_ttrpc_vmservice/src/vmservice.events.proto b/openvmm/openvmm_ttrpc_vmservice/src/vmservice.events.proto new file mode 100644 index 0000000000..4e0fcf562a --- /dev/null +++ b/openvmm/openvmm_ttrpc_vmservice/src/vmservice.events.proto @@ -0,0 +1,97 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +syntax = 'proto3'; + +package vmservice; +option go_package = "vmservice"; + +import "google/protobuf/any.proto"; +import "google/protobuf/timestamp.proto"; + +import "vmservice.resource.proto"; +import "vmservice.state.proto"; + +// Subscribe to the events from the specified VM. +message SubscribeVmEventsRequest { + // Event ID to start the stream on. + // Leave empty to subscribe to only the latest events. + optional uint64 event_id = 1; + + // Include events for general VM errors. + optional bool include_error_events = 2; + // Include events for VM service operations. + optional bool include_service_events = 3; + // Include events for VM resource operations. + optional bool include_resource_event = 4; + // Include events for VM requests. + optional bool include_request_events = 5; +} + +enum VmEventInitiator { + VM_EVENT_INITIATOR_UNSPECIFIED = 0; + VM_EVENT_INITIATOR_SERVICE = 1; + VM_EVENT_INITIATOR_GUEST = 2; +} + +message StackTrace { + google.protobuf.Timestamp timestamp = 1; + string source = 2; + string message = 3; + repeated google.protobuf.Any data = 4; +} + +// VmErrorEvent describes an error that occurred in the VM or service. +message VmErrorEvent { + // error code (e.g., an HRESULT or exit status), if applicable + optional uint64 error_code = 1; + // an error string, if applicable + optional string error_message = 2; + repeated StackTrace stack_trace = 3; +} + +// VmServiceEvent describes an event associated with the VM service. +message VmServiceEvent { + enum VmServiceEventType { + VM_SERVICE_EVENT_TYPE_UNSPECIFIED = 0; + // Host initiated VM service quit. + VM_SERVICE_EVENT_TYPE_QUIT = 1; + // Unrecoverable error in VM server or worker process. + // Should be preceded by a VmErrorEvent. + VM_SERVICE_EVENT_TYPE_CRASH = 2; + } + + VmServiceEventType type = 1; +} + +// VmStateEvent describes a VM state change. +message VmStateEvent { + VmState state = 1; + VmEventInitiator initiator = 2; +} + +// VmResourceEvent describes an event assoicated with a particular VM resource. +message VmResourceEvent { + VmEventInitiator initiator = 1; + VmResourceOperationType operation = 2; + VmResourceType resource = 3; + google.protobuf.Any settings = 4; +} + +message VmEvent { + // ID of the event sent on the stream. + // Stable across VmEvent streams. + uint64 event_id = 1; + google.protobuf.Timestamp timestamp = 2; + + string log_id = 3; + + // payload contains the event data. + // The payload type may match the EventType field, or could be an Error. + oneof payload { + VmErrorEvent error = 4; + VmServiceEvent service = 5; + VmStateEvent power_state = 6; + VmResourceEvent resource = 7; + } +} diff --git a/openvmm/openvmm_ttrpc_vmservice/src/vmservice.proto b/openvmm/openvmm_ttrpc_vmservice/src/vmservice.proto index 08f2bdbe83..b5f9b08872 100644 --- a/openvmm/openvmm_ttrpc_vmservice/src/vmservice.proto +++ b/openvmm/openvmm_ttrpc_vmservice/src/vmservice.proto @@ -1,6 +1,13 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. +// TODO: +// Rename VM, PCIE, SCSI, VPMEM, etc., to snake case (Vm, Pcie, Scsi, Vpmem, ...): +// +// > In all cases, treat abbreviations as though they are single words +// +// https://protobuf.dev/programming-guides/style/#identifier + syntax = 'proto3'; package vmservice; @@ -8,51 +15,95 @@ option go_package = "vmservice"; import "google/protobuf/empty.proto"; import "google/protobuf/struct.proto"; +import "google/protobuf/timestamp.proto"; -service VM { - // CreateVM will create the virtual machine with the configuration in the - // CreateVMRequest. The virtual machine will be in a paused state power wise - // after CreateVM. ResumeVM can be called to transition the VM into a running state. - rpc CreateVM(CreateVMRequest) returns (google.protobuf.Empty); - - // TeardownVM will release all associated resources from the VM and unblock the WaitVM call. - rpc TeardownVM(google.protobuf.Empty) returns (google.protobuf.Empty); +import "vmservice.events.proto"; +import "vmservice.resource.proto"; +import "vmservice.scsi.proto"; +import "vmservice.state.proto"; - // PauseVM will, if the virtual machine power state is in a running state, transition - // the state to paused. This is the same state power wise that the VM should be in after - // an initial CreateVM call. - rpc PauseVM(google.protobuf.Empty) returns (google.protobuf.Empty); - - // ResumeVM is used to transition a vm to a running state. This can be used to resume a VM that - // has had PauseVM called on it, or to start a VM that was created with CreateVM. - rpc ResumeVM(google.protobuf.Empty) returns (google.protobuf.Empty); - - // WaitVM will block until the VM is either in a halted state or has had all of it's resources freed - // via TeardownVM. - rpc WaitVM(google.protobuf.Empty) returns (google.protobuf.Empty); +service VM { + // + // Service management + // - // CapabilitiesVM will return what capabilities the virtstack supports. This includes + // ServiceCapabilities will return what capabilities the virtstack supports. This includes // what guest operating systems are supported, what resources are supported, and if hot // add/hot remove of a resource is supported. - rpc CapabilitiesVM(google.protobuf.Empty) returns (CapabilitiesVMResponse); - - // PropertiesVM will take in a list of properties that the virtstack will return + rpc ServiceCapabilities(google.protobuf.Empty) returns (ServiceCapabilitiesResponse); + + // Quit will shutdown the process hosting the VM server. + rpc QuitService(google.protobuf.Empty) returns (google.protobuf.Empty); + + // + // VM lifecycle & management + // + + // CreateVm will create the virtual machine with the configuration in the CreateVmRequest. + // The virtual machine will be in a paused state, power wise, after CreateVm. + // ResumeVm can be called to transition the VM into a running state. + // + // Additionally, the server will send a VM_STATE_PAUSED VmEvent on the SubscribeVmEvents + // stream to indicate completion of VM creation. + rpc CreateVm(CreateVmRequest) returns (google.protobuf.Empty); + + // TeardownVm will release all associated resources from the VM, and close the event stream + // created via a SubscribeVmEvents call. + rpc TeardownVm(google.protobuf.Empty) returns (google.protobuf.Empty); + + // Pause will, if the virtual machine power state is in a running state, transition + // the state to paused. + // This is the same state, power wise, that the VM should be in after an initial Create call. + rpc PauseVm(google.protobuf.Empty) returns (google.protobuf.Empty); + + // Resume is used to transition a VM to a running state. + // This can be used to resume a VM that has had Pause called on it, + // or to start a VM that was created with Create. + // + // The call returns once the VM starts running. + // The SubscribeVmEvents should be monitored for changes to VM state. + rpc ResumeVm(google.protobuf.Empty) returns (google.protobuf.Empty); + + // SubscribeVMEvents will block until the VM is has its all of it's resources freed via TeardownVm, + // returning a stream events describing VM state transitions and other changes. + rpc SubscribeVmEvents(SubscribeVmEventsRequest) returns (stream VmEvent); + + // VmProperties will take in a list of properties that the virtstack will return // statistics for (memory, processors). - rpc PropertiesVM(PropertiesVMRequest) returns (PropertiesVMResponse); + rpc VmProperties(VmPropertiesRequest) returns (VmPropertiesResponse); - // ModifyResource is a generic call to modify (add/remove/update) resources for a VM. + // ModifyVmResource is a generic call to modify (add/remove/update) resources for a VM. // This includes things such as block devices, network adapters, and pci devices. - rpc ModifyResource(ModifyResourceRequest) returns (google.protobuf.Empty); + rpc ModifyVmResource(ModifyVmResourceRequest) returns (google.protobuf.Empty); - // AddPcieDevice hot-adds a PCIe device behind a named port (a root port or + // AddVmPcieDevice hot-adds a PCIe device behind a named port (a root port or // switch downstream port declared in the topology). - rpc AddPcieDevice(AddPcieDeviceRequest) returns (google.protobuf.Empty); + rpc AddVmPcieDevice(AddVmPcieDeviceRequest) returns (google.protobuf.Empty); + + // RemoveVmPcieDevice hot-removes the PCIe device behind the named port. + rpc RemoveVmPcieDevice(RemoveVmPcieDeviceRequest) returns (google.protobuf.Empty); +} + +// +// Service management +// + +enum GuestOs { + GUEST_OS_UNSPECIFIED = 0; + GUEST_OS_WINDOWS = 1; + GUEST_OS_LINUX = 2; +} - // RemovePcieDevice hot-removes the PCIe device behind the named port. - rpc RemovePcieDevice(RemovePcieDeviceRequest) returns (google.protobuf.Empty); +message ServiceCapabilitiesResponse { + message SupportedResource { + bool Add = 1; + bool Remove = 2; + bool Update = 3; + VmResourceType resource = 4; + } - // Quit will shutdown the process hosting the ttrpc server. - rpc Quit(google.protobuf.Empty) returns (google.protobuf.Empty); + repeated SupportedResource supported_resources = 1; + repeated GuestOs supported_guest_os = 2; } // Note: VTL assignment is not modeled yet; all devices are assumed to be VTL0. @@ -60,9 +111,10 @@ service VM { // // VM lifecycle request/response // + message DirectBoot { - string kernel_path = 1; - string initrd_path = 2; + string kernel_path = 1; + string initrd_path = 2; string kernel_cmdline = 3; } @@ -103,33 +155,35 @@ message UEFI { } message MemoryConfig { - uint64 memory_mb = 1; - bool allow_overcommit = 2; - bool deferred_commit = 3; - bool hot_hint = 4; - bool cold_hint = 5; - bool cold_discard_hint = 6; - uint64 low_mmio_gap_in_mb = 7; + uint64 memory_mb = 1; + bool allow_overcommit = 2; + bool deferred_commit = 3; + bool hot_hint = 4; + bool cold_hint = 5; + bool cold_discard_hint = 6; + uint64 low_mmio_gap_in_mb = 7; uint64 high_mmio_base_in_mb = 8; - uint64 high_mmio_gap_in_mb = 9; + uint64 high_mmio_gap_in_mb = 9; } message ProcessorConfig { - uint32 processor_count = 1; + uint32 processor_count = 1; uint32 processor_weight = 2; - uint32 processor_limit = 3; + uint32 processor_limit = 3; } message DevicesConfig { - repeated SCSIDisk scsi_disks = 1; - repeated VPMEMDisk vpmem_disks = 2; - repeated NICConfig nic_config = 3; + // SCSI disks, mapped by the SCSI controller GUID to add them under. + // An empty string will denote a default GUID controller (e.g., ba6163d9-04a1-4d29-b605-72e2ffb1dc7f). + map scsi_disks = 1; + repeated VPMEMDisk vpmem_disks = 2; + repeated NICConfig nic_config = 3; // When we know what information we need to assign a pci device on Linux, // have a oneof here named PCIDevice with WindowsPCIDevice and LinuxPCIDevice // housed. repeated WindowsPCIDevice windows_device = 4; - repeated VirtioFSConfig virtiofs_config = 5; - VirtioConsoleConfig virtio_console = 6; + repeated VirtioFSConfig virtiofs_config = 5; + VirtioConsoleConfig virtio_console = 6; } // An endpoint PCIe device function. Attached behind a port in the topology @@ -139,9 +193,9 @@ message PcieDeviceKind { // A virtio device function. VirtioDevice virtio = 1; // An NVMe controller. - NvmeConfig nvme = 2; + NvmeConfig nvme = 2; // A host PCI device assigned to the guest via VFIO. - VfioDevice vfio = 3; + VfioDevice vfio = 3; } } @@ -151,18 +205,18 @@ message PcieDeviceKind { message VirtioDevice { oneof kind { // virtio-blk block device. - VirtioBlk blk = 1; + VirtioBlk blk = 1; // virtio-net network device. - VirtioNet net = 2; + VirtioNet net = 2; // virtio-rng entropy device. - VirtioRng rng = 3; + VirtioRng rng = 3; // virtio-vsock socket device. - VirtioVsock vsock = 4; + VirtioVsock vsock = 4; // virtio-console serial device. - VirtioConsole console = 5; + VirtioConsole console = 5; // A virtio device whose datapath is backed by an external vhost-user // process (e.g. vhost-user-blk / vhost-user-fs). - VhostUser vhost_user = 6; + VhostUser vhost_user = 6; } } @@ -206,7 +260,7 @@ message FileDisk { // Path to the backing file. string path = 1; // Bypass the OS page cache (O_DIRECT). - bool direct = 2; + bool direct = 2; } // virtio-blk block device configuration. @@ -233,9 +287,9 @@ message VirtioNet { message NicBackend { oneof kind { // DirectIO backend bound to a host switch/port. - DioBackend dio = 1; + DioBackend dio = 1; // Host TAP device backend. - TapBackend tap = 2; + TapBackend tap = 2; // Built-in user-mode (consomme) network backend. ConsommeBackend consomme = 3; } @@ -253,9 +307,9 @@ message VhostUser { message VhostUserDevice { oneof kind { // vhost-user-blk block device. - VhostUserBlk blk = 1; + VhostUserBlk blk = 1; // vhost-user-fs filesystem device. - VhostUserFs fs = 2; + VhostUserFs fs = 2; // A generic vhost-user device identified by numeric virtio device ID. VhostUserGeneric other = 3; } @@ -345,7 +399,7 @@ message VfioBarAddress { // Virtual NUMA topology. message NumaConfig { // NUMA nodes. A node's index in this list is its node ID. - repeated NumaNode nodes = 1; + repeated NumaNode nodes = 1; // Inter-node distances for the ACPI SLIT. Missing pairs default to // 10 (local) / 20 (cross-node). repeated NumaDistance distances = 2; @@ -378,14 +432,14 @@ message NodeMemoryConfig { // Host physical NUMA node to bind to (Linux mbind). Absent => OS default. optional uint32 host_numa_node = 2; // Pre-populate (prefetch) the backing memory. - bool prefetch = 3; + bool prefetch = 3; // Use private anonymous memory instead of shared file-backed memory. - bool private_memory = 4; + bool private_memory = 4; // Mark this node's RAM as transparent-hugepage eligible. Unset => enabled // by default. Set to false to opt out. optional bool transparent_hugepages = 5; // Allocate from explicit hugetlb pages. - bool hugepages = 6; + bool hugepages = 6; // Hugetlb page size in bytes (requires hugepages). Absent => default. optional uint64 hugepage_size_bytes = 7; } @@ -428,23 +482,23 @@ message PcieGenericInitiator { // A PCIe root complex. message PcieRootComplex { // Root complex name (used to reference it). - string name = 1; + string name = 1; // PCI segment number (u16). - uint32 segment = 2; + uint32 segment = 2; // Lowest valid bus number (u8). uint32 start_bus = 3; // Highest valid bus number (u8). - uint32 end_bus = 4; + uint32 end_bus = 4; // Low (32-bit) MMIO window size, in bytes. - uint64 low_mmio = 5; + uint64 low_mmio = 5; // High (64-bit) MMIO window size, in bytes. uint64 high_mmio = 6; // Pin the low MMIO window base address. Absent => auto-assigned. - optional uint64 low_mmio_base = 7; + optional uint64 low_mmio_base = 7; // Pin the high MMIO window base address. Absent => auto-assigned. optional uint64 high_mmio_base = 8; // Keep assigned BARs pinned at their addresses. - bool preserve_bars = 9; + bool preserve_bars = 9; // NUMA node this root complex is associated with. Absent => none. optional uint32 node = 10; // Root ports on this complex. @@ -457,7 +511,7 @@ message PciePort { // Port name, used to target runtime hot-add (AddPcieDevice). string name = 1; // Allow runtime hot-plug into this port. - bool hotplug = 2; + bool hotplug = 2; // What is attached behind this port. Absent => empty port (available for // hotplug if `hotplug` is set). PcieAttachment attached = 3; @@ -483,7 +537,7 @@ message PcieAttachment { // An endpoint device. PcieDeviceKind device = 1; // A nested PCIe switch. - PcieSwitch switch = 2; + PcieSwitch switch = 2; } } @@ -510,13 +564,13 @@ message VMConfig { GuestPowerAction watchdog = 4; } - MemoryConfig memory_config = 1; + MemoryConfig memory_config = 1; ProcessorConfig processor_config = 2; - DevicesConfig devices_config = 3; - SerialConfig serial_config = 4; + DevicesConfig devices_config = 3; + SerialConfig serial_config = 4; oneof BootConfig { DirectBoot direct_boot = 5; - UEFI uefi = 6; + UEFI uefi = 6; } WindowsOptions windows_options = 7; // Field 8 was previously map extra_data. @@ -555,120 +609,73 @@ message HVSocketConfig { string path = 1; } -message CreateVMRequest { +message CreateVmRequest { VMConfig config = 1; // Optional ID to be used by the VM service in log messages. It's up to the // server/virtstack to make use of this field. Useful for debugging to be able to // correlate events in the virtstack for a given vm that the client launched. - string log_id = 2; + optional string log_id = 2; } message MemoryStats { uint64 working_set_bytes = 1; - uint64 available_memory = 2; - uint64 reserved_memory = 3; - uint64 assigned_memory = 4; + uint64 available_memory = 2; + uint64 reserved_memory = 3; + uint64 assigned_memory = 4; } message ProcessorStats { uint64 total_runtime_ns = 1; } -message PropertiesVMRequest { +message VmPropertiesRequest { enum PropertiesType { - Memory = 0; - Processor = 1; + VM_PROPERTIES_TYPE_UNSPECIFIED = 0; + VM_PROPERTIES_TYPE_MEMORY = 1; + VM_PROPERTIES_TYPE_PROCESSOR = 2; } repeated PropertiesType types = 1; } -enum VmState { - Uninitialized = 0; - Paused = 1; - Running = 2; - Halted = 3; -} - -message PropertiesVMResponse { - MemoryStats memory_stats = 1; +message VmPropertiesResponse { + MemoryStats memory_stats = 1; ProcessorStats processor_stats = 2; - VmState state = 3; + VmState state = 3; // Set when state is Halted. optional string halt_reason = 4; } -message CapabilitiesVMResponse { - enum Resource { - Vpmem = 0; - Scsi = 1; - Vpci = 2; - Plan9 = 3; - VMNic = 4; - Memory = 5; - Processor = 6; - } - - message SupportedResource { - bool Add = 1; - bool Remove = 2; - bool Update = 3; - Resource resource = 4; - } - - enum SupportedGuestOS { - Windows = 0; - Linux = 1; - } - repeated SupportedResource supported_resources = 1; - repeated SupportedGuestOS supported_guest_os = 2; -} - // // Modify existing VM request/response // -enum ModifyType { - ADD = 0; - REMOVE = 1; - UPDATE = 2; -} - -enum DiskType { - SCSI_DISK_TYPE_VHD1 = 0; - SCSI_DISK_TYPE_VHDX = 1; - SCSI_DISK_TYPE_PHYSICAL = 2; -} -message SCSIDisk { - uint32 controller = 1; - uint32 lun = 2; - string host_path = 3; - DiskType type = 4; - bool read_only = 5; +enum VpmemDiskType { + VPMEM_DISK_UNSPECIFIED = 0; } message VPMEMDisk { - string host_path = 1; - DiskType type = 2; - bool read_only = 3; + string host_path = 1; + VpmemDiskType type = 2; + bool read_only = 3; } message NICConfig { - string nic_id = 1; // GUID - string mac_address = 3; // 12-34-56-78-9A-BC + string nic_id = 1; // GUID + string mac_address = 3; // 12-34-56-78-9A-BC string legacy_switch_id = 4; // GUID, used only with legacy_port_id below // Optional friendly name for the adapter. Might be useful to show up in logs. string nic_name = 5; oneof backend { - string legacy_port_id = 2; // legacy, GUID, Windows only - DioBackend dio = 6; - TapBackend tap = 7; + string legacy_port_id = 2; // legacy, GUID, Windows only + DioBackend dio = 6; + TapBackend tap = 7; ConsommeBackend consomme = 8; } } message DioBackend { - string switch_id = 1; // GUID - string port_id = 2; // GUID + string switch_id = 1; // GUID + string port_id = 2; // GUID } message TapBackend { @@ -710,7 +717,7 @@ message WindowsPCIDevice { } message VirtioFSConfig { - string tag = 1; + string tag = 1; string root_path = 2; } @@ -734,19 +741,25 @@ message ModifyProcessorRequest { message ModifyProcessorConfigRequest { uint32 processor_weight = 1; - uint32 processor_limit = 2; + uint32 processor_limit = 2; +} + +message ModifyScsiDiskRequest { + // GUID of the SCSI controller device + string controller = 1; + ScsiDisk disk = 2; } -message ModifyResourceRequest { - ModifyType type = 1; +message ModifyVmResourceRequest { + VmResourceOperationType type = 1; oneof resource { - ModifyProcessorRequest processor = 2; + ModifyProcessorRequest processor = 2; ModifyProcessorConfigRequest processor_config = 3; - ModifyMemoryRequest memory = 4; - SCSIDisk scsi_disk = 5; - VPMEMDisk vpmem_disk = 6; - NICConfig nic_config = 7; - WindowsPCIDevice windows_device = 8; + ModifyMemoryRequest memory = 4; + ModifyScsiDiskRequest scsi_disk = 5; + VPMEMDisk vpmem_disk = 6; + NICConfig nic_config = 7; + WindowsPCIDevice windows_device = 8; } } @@ -754,7 +767,7 @@ message ModifyResourceRequest { // PCIe device hot add/remove request/response // // Request to hot-add a PCIe device behind an existing port. -message AddPcieDeviceRequest { +message AddVmPcieDeviceRequest { // Name of the PCIe port to plug the device into: a root port or switch // downstream port declared in the topology. string port_name = 1; @@ -763,7 +776,7 @@ message AddPcieDeviceRequest { } // Request to hot-remove the PCIe device behind a port. -message RemovePcieDeviceRequest { +message RemoveVmPcieDeviceRequest { // Name of the PCIe port whose device should be removed. string port_name = 1; } diff --git a/openvmm/openvmm_ttrpc_vmservice/src/vmservice.resource.proto b/openvmm/openvmm_ttrpc_vmservice/src/vmservice.resource.proto new file mode 100644 index 0000000000..8910e39dc8 --- /dev/null +++ b/openvmm/openvmm_ttrpc_vmservice/src/vmservice.resource.proto @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +syntax = 'proto3'; + +package vmservice; +option go_package = "vmservice"; + +enum VmResourceOperationType { + VM_RESOURCE_OPERATION_TYPE_UNSPECIFIED = 0; + VM_RESOURCE_OPERATION_TYPE_ADD = 1; + VM_RESOURCE_OPERATION_TYPE_REMOVE = 2; + VM_RESOURCE_OPERATION_TYPE_UPDATE = 3; +} + +enum VmResourceType { + VM_RESOURCE_TYPE_UNSPECIFIED = 0; + VM_RESOURCE_TYPE_VPMEM = 1; + VM_RESOURCE_TYPE_SCSI = 2; + VM_RESOURCE_TYPE_VPCI = 3; + VM_RESOURCE_TYPE_PLAN9 = 4; + VM_RESOURCE_TYPE_VMNIC = 5; + VM_RESOURCE_TYPE_MEMORY = 6; + VM_RESOURCE_TYPE_PROCESSOR = 7; +} diff --git a/openvmm/openvmm_ttrpc_vmservice/src/vmservice.scsi.proto b/openvmm/openvmm_ttrpc_vmservice/src/vmservice.scsi.proto new file mode 100644 index 0000000000..faff2b583f --- /dev/null +++ b/openvmm/openvmm_ttrpc_vmservice/src/vmservice.scsi.proto @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +syntax = 'proto3'; + +package vmservice; +option go_package = "vmservice"; + +enum ScsiDiskType { + SCSI_DISK_UNSPECIFIED = 0; + SCSI_DISK_TYPE_VHD1 = 1; + SCSI_DISK_TYPE_VHDX = 2; + SCSI_DISK_TYPE_PHYSICAL = 3; +} + +message ScsiController { + repeated ScsiDisk scsi_disks = 1; +} + +message ScsiDisk { + reserved 1; + reserved "controller"; + uint32 lun = 2; + string host_path = 3; + ScsiDiskType type = 4; + bool read_only = 5; +} diff --git a/openvmm/openvmm_ttrpc_vmservice/src/vmservice.state.proto b/openvmm/openvmm_ttrpc_vmservice/src/vmservice.state.proto new file mode 100644 index 0000000000..b782bc8435 --- /dev/null +++ b/openvmm/openvmm_ttrpc_vmservice/src/vmservice.state.proto @@ -0,0 +1,18 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +syntax = 'proto3'; + +package vmservice; +option go_package = "vmservice"; + +// Represents VM state. +enum VmState { + VM_STATE_UNSPECIFIED = 0; + VM_STATE_CRASHED = 1; // Crashed, or in an unknown state. + VM_STATE_PAUSED = 2; + VM_STATE_RUNNING = 3; + VM_STATE_HALTED = 4; // Powered off. + VM_STATE_SAVED = 5; + VM_STATE_TORN_DOWN = 6; +} diff --git a/xtask/src/tasks/fmt/lints/workspaced.rs b/xtask/src/tasks/fmt/lints/workspaced.rs index e1baae6c8a..bc2ef39c86 100644 --- a/xtask/src/tasks/fmt/lints/workspaced.rs +++ b/xtask/src/tasks/fmt/lints/workspaced.rs @@ -29,14 +29,16 @@ pub struct WorkspacedManifest { members: Vec, excluded: Vec, dependencies: Vec, + only_diffed: bool, } impl Lint for WorkspacedManifest { - fn new(_ctx: &LintCtx) -> Self { + fn new(ctx: &LintCtx) -> Self { WorkspacedManifest { members: Vec::new(), excluded: Vec::new(), dependencies: Vec::new(), + only_diffed: ctx.only_diffed, } } @@ -167,12 +169,15 @@ impl Lint for WorkspacedManifest { } fn exit_workspace(&mut self, content: &mut Lintable) { - // Any members or dependencies that we expected to see but didn't are errors - for member in self.members.iter() { - content.unfixable(&format!( - "workspace member {} does not exist", - member.display() - )); + // Any members or dependencies that we expected to see but didn't are errors, + // unless we're only checking diffs, in which case we know we'll miss crates. + if !self.only_diffed { + for member in self.members.iter() { + content.unfixable(&format!( + "workspace member {} does not exist", + member.display() + )); + } } // Dependencies that we didn't see may be from other workspaces, as is done in the internal repo, so they're allowed // Exclusions that we didn't see may be nested workspaces, which don't get visited, so they're allowed