/cloud-hypervisor/docs/ |
H A D | live_migration.md | 1 # Live Migration 3 This document gives examples of how to use the live migration support 6 1. local migration - migrating a VM from one Cloud Hypervisor instance to another on the same machi… 7 1. remote migration - migrating a VM between two machines; 12 ## Local Migration (Suitable for Live Upgrade of VMM) 17 $ target/release/cloud-hypervisor 18 --kernel ~/workloads/vmlinux \ 19 --disk path=~/workloads/focal.raw \ 20 --cpus boot=1 --memory size=1G,shared=on \ 21 --cmdline "root=/dev/vda1 console=ttyS0" \ [all …]
|
H A D | api.md | 1 - [Cloud Hypervisor API](#cloud-hypervisor-api) 2 - [External API](#external-api) 3 - [REST API](#rest-api) 4 - [REST API Location and availability](#rest-api-location-and-availability) 5 - [REST API Endpoints](#rest-api-endpoints) 6 - [Virtual Machine Manager (VMM) Actions](#virtual-machine-manager-vmm-actions) 7 - [Virtual Machine (VM) Actions](#virtual-machine-vm-actions) 8 - [REST API Examples](#rest-api-examples) 9 - [Create a Virtual Machine](#create-a-virtual-machine) 10 - [Boot a Virtual Machine](#boot-a-virtual-machine) [all …]
|
/cloud-hypervisor/vm-migration/src/ |
H A D | lib.rs | 3 // SPDX-License-Identifier: Apache-2.0 AND BSD-3-Clause 28 #[error("Failed to send migratable component snapshot")] 37 #[error("Failed to start migration for migratable component")] 40 #[error("Failed to stop migration for migratable component")] 46 #[error("Failed to start migration for migratable component")] 49 #[error("Failed to complete migration for migratable component")] 52 #[error("Failed to release a disk lock before the migration")] 59 fn pause(&mut self) -> std::result::Result<(), MigratableError> { in pause() 64 fn resume(&mut self) -> std::result::Result<(), MigratableError> { in resume() 71 /// Migratable component can split their migration snapshot into [all …]
|
H A D | protocol.rs | 3 // SPDX-License-Identifier: Apache-2.0 13 // Migration protocol 16 // 2: Source -> Dest : send "start command" 17 // 3: Dest -> Source : sends "ok response" when read to accept state data 18 // 4: Source -> Dest : sends "config command" followed by config data, length 20 // 5: Dest -> Source : sends "ok response" when ready to accept memory data 21 // 6: Source -> Dest : send "memory command" followed by table of u64 pairs (GPA, size) 24 // 7: Dest -> Source : sends "ok response" when ready to accept more memory data 25 // 8..(n-4): Repeat steps 6 and 7 until source has no more memory to send 26 // (n-3): Source -> Dest : sends "state command" followed by state data, length [all …]
|
/cloud-hypervisor/src/bin/ |
H A D | ch-remote.rs | 3 // SPDX-License-Identifier: Apache-2.0 79 fn vmm_ping(&self) -> zbus::Result<String>; in vmm_ping() 80 fn vmm_shutdown(&self) -> zbus::Result<()>; in vmm_shutdown() 81 fn vm_add_device(&self, device_config: &str) -> zbus::Result<Optional<String>>; in vm_add_device() 82 fn vm_add_disk(&self, disk_config: &str) -> zbus::Result<Optional<String>>; in vm_add_disk() 83 fn vm_add_fs(&self, fs_config: &str) -> zbus::Result<Optional<String>>; in vm_add_fs() 84 fn vm_add_net(&self, net_config: &str) -> zbus::Result<Optional<String>>; in vm_add_net() 85 fn vm_add_pmem(&self, pmem_config: &str) -> zbus::Result<Optional<String>>; in vm_add_pmem() 86 fn vm_add_user_device(&self, vm_add_user_device: &str) -> zbus::Result<Optional<String>>; in vm_add_user_device() 87 fn vm_add_vdpa(&self, vdpa_config: &str) -> zbus::Result<Optional<String>>; in vm_add_vdpa() [all …]
|
/cloud-hypervisor/vmm/src/api/ |
H A D | mod.rs | 4 // SPDX-License-Identifier: Apache-2.0 9 //! This API is a synchronous, [mpsc](https://doc.rust-lang.org/std/sync/mpsc/) 11 //! Cloud Hypervisor threads. The IPC follows a command-response protocol, i.e. 25 //! able to send the response back. 64 /// API request send error 65 #[error("API request send error")] 184 /// Error starting migration receiver 185 #[error("Error starting migration receiver")] 188 /// Error starting migration sender 189 #[error("Error starting migration sender")] [all …]
|
/cloud-hypervisor/vmm/src/ |
H A D | lib.rs | 3 // SPDX-License-Identifier: Apache-2.0 59 use crate::migration::get_vm_snapshot; 60 use crate::migration::{recv_vm_config, recv_vm_state}; 86 pub mod migration; module 104 /// API response send error 132 /// Cannot create D-Bus thread 134 #[error("Error spawning D-Bus thread")] 137 /// Cannot start D-Bus session 139 #[error("Error starting D-Bus session")] 142 /// Cannot create `event-monitor` thread [all …]
|
H A D | vm.rs | 6 // Use of this source code is governed by a BSD-style license that can be 7 // found in the LICENSE-BSD-3-Clause file. 11 // SPDX-License-Identifier: Apache-2.0 AND BSD-3-Clause 90 use crate::migration::get_vm_snapshot; 92 use crate::migration::url_to_file; 93 use crate::migration::{url_to_path, SNAPSHOT_CONFIG_FILE, SNAPSHOT_STATE_FILE}; 157 ThreadCleanup(std::boxed::Box<dyn std::any::Any + std::marker::Send>), 210 #[error("Cannot send VM snapshot")] 219 #[error("Too many virtio-vsock devices")] 259 #[error("Error enabling SEV-SNP VM")] [all …]
|
H A D | device_manager.rs | 4 // Use of this source code is governed by a BSD-style license that can be 5 // found in the LICENSE-BSD-3-Clause file. 9 // SPDX-License-Identifier: Apache-2.0 AND BSD-3-Clause 148 const VIRTIO_PCI_DEVICE_NAME_PREFIX: &str = "_virtio-pci"; 161 /// Cannot create vhost-user-net device 162 #[error("Cannot create vhost-user-net device")] 165 /// Cannot create virtio-blk device 166 #[error("Cannot create virtio-blk device")] 169 /// Cannot create virtio-net device 170 #[error("Cannot create virtio-net device")] [all …]
|
H A D | memory_manager.rs | 3 // SPDX-License-Identifier: Apache-2.0 56 use crate::migration::url_to_path; 66 const SNAPSHOT_FILENAME: &str = "memory-ranges"; 104 pub fn region(&self) -> &Arc<GuestRegionMmap> { in region() 110 pub fn hotplugged_size(&self) -> u64 { in hotplugged_size() 113 pub fn hugepages(&self) -> bool { in hugepages() 116 pub fn blocks_state(&self) -> &Arc<Mutex<BlocksState>> { in blocks_state() 119 pub fn plugged_ranges(&self) -> MemoryRangeTable { in plugged_ranges() 134 pub fn regions(&self) -> &Vec<Arc<GuestRegionMmap>> { in regions() 137 pub fn virtio_mem_zone(&self) -> &Option<VirtioMemZone> { in virtio_mem_zone() [all …]
|
H A D | cpu.rs | 6 // Use of this source code is governed by a BSD-style license that can be 7 // found in the LICENSE-BSD-3-Clause file. 11 // SPDX-License-Identifier: Apache-2.0 AND BSD-3-Clause 94 /// Extract the specified bits of a 64-bit integer. 101 ($value >> $offset) & (!0u64 >> (64 - $length)) 108 $value & (!0u64 >> (64 - $length)) 155 ThreadCleanup(std::boxed::Box<dyn std::any::Any + std::marker::Send>), 337 /// A wrapper around creating and using a kvm-based VCPU. 354 /// * `id` - Represents the CPU number between [0, max vcpus). 355 /// * `vm` - The virtual machine this vcpu will get attached to. [all …]
|
/cloud-hypervisor/scripts/ |
H A D | dev_cli.sh | 5 # SPDX-License-Identifier: Apache-2.0 9 CTR_IMAGE_TAG="ghcr.io/cloud-hypervisor/cloud-hypervisor" 11 # Needs to match explicit version in docker-image.yaml workflow 12 CTR_IMAGE_VERSION="20250412-0" 23 CLH_CTR_BUILD_DIR="/tmp/cloud-hypervisor/ctr-build" 27 CTR_CLH_ROOT_DIR="/cloud-hypervisor" 50 # Send a decorated message to stdout, followed by a new line 53 [ -t 1 ] && [ -n "$TERM" ] && 58 # Send a decorated message to stdout, without a trailing new line 61 [ -t 1 ] && [ -n "$TERM" ] && [all …]
|
/cloud-hypervisor/vmm/src/api/openapi/ |
H A D | cloud-hypervisor.yaml | 4 description: Local HTTP based API for managing and inspecting a cloud-hypervisor virtual machine. 7 url: http://www.apache.org/licenses/LICENSE-2.0.html 11 - url: http://localhost/api/v1 27 summary: Shuts the cloud-hypervisor VMM. 35 summary: Returns general information about the cloud-hypervisor Virtual Machine (VM) instance. 57 …summary: Create the cloud-hypervisor Virtual Machine (VM) instance. The instance is not booted, on… 72 summary: Delete the cloud-hypervisor Virtual Machine (VM) instance. 136 /vm.power-button: 139 operationId: power-buttonVM 166 /vm.resize-zone: [all …]
|
/cloud-hypervisor/vmm/src/api/http/ |
H A D | mod.rs | 3 // SPDX-License-Identifier: Apache-2.0 75 /// The error message contained in the response is supposed to be user-facing, 78 pub fn error_response(error: HttpError, status: StatusCode) -> Response { in error_response() 85 // See <https://github.com/rust-lang/rust/issues/141673> in error_response() 103 /// After parsing the request, the handler could decide to send an 112 ) -> Response { in handle_request() 149 ) -> std::result::Result<Option<Body>, HttpError> { in put_handler() 158 ) -> std::result::Result<Option<Body>, HttpError> { in get_handler() 166 pub routes: BTreeMap<String, Box<dyn EndpointHandler + Sync + Send>>, 175 /// HTTP_ROUTES contain all the cloud-hypervisor HTTP routes. [all …]
|
/cloud-hypervisor/tests/ |
H A D | integration.rs | 3 // SPDX-License-Identifier: Apache-2.0 7 // hence have known dead-code. This annotation silences dead-code 36 pub const FOCAL_IMAGE_NAME: &str = "focal-server-cloudimg-amd64-custom-20210609-0.raw"; 38 "jammy-server-cloudimg-amd64-custom-vfio-20241012-0.raw"; 39 pub const FOCAL_IMAGE_NAME_QCOW2: &str = "focal-server-cloudimg-amd64-custom-20210609-0.qcow2"; 41 "focal-server-cloudimg-amd64-custom-20210609-0-backing.qcow2"; 42 pub const FOCAL_IMAGE_NAME_VHD: &str = "focal-server-cloudimg-amd64-custom-20210609-0.vhd"; 43 pub const FOCAL_IMAGE_NAME_VHDX: &str = "focal-server-cloudimg-amd64-custom-20210609-0.vhdx"; 44 pub const JAMMY_IMAGE_NAME: &str = "jammy-server-cloudimg-amd64-custom-20241017-0.raw"; 45 pub const WINDOWS_IMAGE_NAME: &str = "windows-server-2022-amd64-2.raw"; [all …]
|
/cloud-hypervisor/virtio-devices/src/ |
H A D | vdpa.rs | 3 // SPDX-License-Identifier: Apache-2.0 35 #[error("Failed to create vhost-vdpa")] 57 #[error("Invalid IOVA range: {0}-{1}")] 122 ) -> Result<Self> { in new() 199 fn enable_vrings(&mut self, enable: bool) -> Result<()> { in enable_vrings() 221 ) -> Result<()> { in activate_vdpa() 318 fn reset_vdpa(&mut self) -> Result<()> { in reset_vdpa() 335 ) -> Result<()> { in dma_map() 336 let iova_last = iova + size - 1; in dma_map() 349 fn dma_unmap(&self, iova: u64, size: u64) -> Result<()> { in dma_unmap() [all …]
|
/cloud-hypervisor/ |
H A D | release-notes.md | 1 - [v46.0](#v460) 2 - [File-level Locking Support with `--disk`](#file-level-locking-support-with---disk) 3 - [Improved Error Reporting with VM Resizing](#improved-error-reporting-with-vm-resizing) 4 - [IPv6 Address Support with `--net`](#ipv6-address-support-with---net) 5 …- [Experimental AArch64 Support with the MSHV Hypervisor](#experimental-aarch64-support-with-the-m… 6 - [Deprecated SGX Support](#deprecated-sgx-support) 7 - [Notable Bug Fixes](#notable-bug-fixes) 8 - [Contributors](#contributors) 9 - [v45.0](#v450) 10 - [Experimental `riscv64` Architecture Support](#experimental-riscv64-architecture-support) [all …]
|
/cloud-hypervisor/pci/src/ |
H A D | vfio_user.rs | 3 // SPDX-License-Identifier: Apache-2.0 63 fn get_register_value(&self) -> u8 { in get_register_value() 79 ) -> Result<Self, VfioUserPciDeviceError> { in new() 113 pub fn map_mmio_regions(&mut self) -> Result<(), VfioUserPciDeviceError> { in map_mmio_regions() 250 ) -> Result<(), VfioUserPciDeviceError> { in dma_map() 266 ) -> Result<(), VfioUserPciDeviceError> { in dma_unmap() 280 fn write(&mut self, base: u64, offset: u64, data: &[u8]) -> Option<Arc<Barrier>> { in write() 298 Migration, enumerator 322 fn get_irq_info(&self, irq_index: u32) -> Option<VfioIrq> { in get_irq_info() 335 fn enable_irq(&self, irq_index: u32, event_fds: Vec<&EventFd>) -> Result<(), VfioError> { in enable_irq() [all …]
|