mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
virtio-devices: vhost_user: Add common migration logic
Adding the common vhost-user code for starting logging dirty pages when the migration is started, and its counterpart for stopping, as well as the code in charge of retrieving the bitmap of the dirty pages that have been logged. All these functions are meant to be leveraged from vhost-user devices. Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
This commit is contained in:
@@ -14,7 +14,7 @@ use std::sync::{atomic::AtomicBool, Arc, Barrier, Mutex};
|
||||
use vhost::vhost_user::message::{VhostUserInflight, VhostUserVirtioFeatures};
|
||||
use vhost::vhost_user::{MasterReqHandler, VhostUserMasterReqHandler};
|
||||
use vhost::Error as VhostError;
|
||||
use vm_memory::{Error as MmapError, GuestAddressSpace, GuestMemoryAtomic};
|
||||
use vm_memory::{mmap::MmapRegionError, Error as MmapError, GuestAddressSpace, GuestMemoryAtomic};
|
||||
use vm_virtio::Error as VirtioError;
|
||||
use vmm_sys_util::eventfd::EventFd;
|
||||
use vu_common_ctrl::VhostUserHandle;
|
||||
@@ -109,6 +109,8 @@ pub enum Error {
|
||||
VhostUserGetInflight(VhostError),
|
||||
/// Failed setting inflight shm log.
|
||||
VhostUserSetInflight(VhostError),
|
||||
/// Failed setting the log base.
|
||||
VhostUserSetLogBase(VhostError),
|
||||
/// Invalid used address.
|
||||
UsedAddress,
|
||||
/// Invalid features provided from vhost-user backend
|
||||
@@ -119,6 +121,18 @@ pub enum Error {
|
||||
MissingIrqFd,
|
||||
/// Failed getting the available index.
|
||||
GetAvailableIndex(VirtioError),
|
||||
/// Migration is not supported by this vhost-user device.
|
||||
MigrationNotSupported,
|
||||
/// Failed creating memfd.
|
||||
MemfdCreate(io::Error),
|
||||
/// Failed truncating the file size to the expected size.
|
||||
SetFileSize(io::Error),
|
||||
/// Failed to set the seals on the file.
|
||||
SetSeals(io::Error),
|
||||
/// Failed creating new mmap region
|
||||
NewMmapRegion(MmapRegionError),
|
||||
/// Could not find the shm log region
|
||||
MissingShmLogRegion,
|
||||
}
|
||||
type Result<T> = std::result::Result<T, Error>;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user