misc: Migrate away from versionize

Replace with serde instead.

Fixes: #6370

Signed-off-by: Rob Bradford <rbradford@rivosinc.com>
This commit is contained in:
Rob Bradford
2024-04-07 14:28:07 +01:00
committed by Bo Chen
parent dad55fcef2
commit 10ab87d6a3
45 changed files with 219 additions and 471 deletions
+4 -9
View File
@@ -9,6 +9,7 @@ use crate::{
VIRTIO_F_IOMMU_PLATFORM,
};
use anyhow::anyhow;
use serde::{Deserialize, Serialize};
use std::{
collections::BTreeMap,
io, result,
@@ -18,8 +19,6 @@ use std::{
},
};
use thiserror::Error;
use versionize::{VersionMap, Versionize, VersionizeResult};
use versionize_derive::Versionize;
use vhost::{
vdpa::{VhostVdpa, VhostVdpaIovaRange},
vhost_kern::VhostKernFeatures,
@@ -29,9 +28,7 @@ use vhost::{
use virtio_queue::{Descriptor, Queue, QueueT};
use vm_device::dma_mapping::ExternalDmaMapping;
use vm_memory::{GuestAddress, GuestAddressSpace, GuestMemory, GuestMemoryAtomic};
use vm_migration::{
Migratable, MigratableError, Pausable, Snapshot, Snapshottable, Transportable, VersionMapped,
};
use vm_migration::{Migratable, MigratableError, Pausable, Snapshot, Snapshottable, Transportable};
use vm_virtio::{AccessPlatform, Translatable};
use vmm_sys_util::eventfd::EventFd;
@@ -95,7 +92,7 @@ pub enum Error {
pub type Result<T> = std::result::Result<T, Error>;
#[derive(Versionize)]
#[derive(Serialize, Deserialize)]
pub struct VdpaState {
pub avail_features: u64,
pub acked_features: u64,
@@ -107,8 +104,6 @@ pub struct VdpaState {
pub backend_features: u64,
}
impl VersionMapped for VdpaState {}
pub struct Vdpa {
common: VirtioCommon,
id: String,
@@ -489,7 +484,7 @@ impl Snapshottable for Vdpa {
)));
}
let snapshot = Snapshot::new_from_versioned_state(&self.state().map_err(|e| {
let snapshot = Snapshot::new_from_state(&self.state().map_err(|e| {
MigratableError::Snapshot(anyhow!("Error snapshotting vDPA device: {:?}", e))
})?)?;