vmm/devices/virtio/block/vhost_user/
persist.rs1use serde::{Deserialize, Serialize};
7
8use super::VhostUserBlockError;
9use super::device::VhostUserBlock;
10use crate::devices::virtio::block::CacheType;
11use crate::devices::virtio::block::persist::BlockConstructorArgs;
12use crate::devices::virtio::persist::VirtioDeviceState;
13use crate::snapshot::Persist;
14
15#[derive(Debug, Clone, Serialize, Deserialize)]
17pub struct VhostUserBlockState {
18 id: String,
19 partuuid: Option<String>,
20 cache_type: CacheType,
21 root_device: bool,
22 socket_path: String,
23 vu_acked_protocol_features: u64,
24 config_space: Vec<u8>,
25 virtio_state: VirtioDeviceState,
26}
27
28impl Persist<'_> for VhostUserBlock {
29 type State = VhostUserBlockState;
30 type ConstructorArgs = BlockConstructorArgs;
31 type Error = VhostUserBlockError;
32
33 fn save(&self) -> Self::State {
34 unimplemented!("VhostUserBlock does not support snapshotting yet");
35 }
36
37 fn restore(
38 _constructor_args: Self::ConstructorArgs,
39 _state: &Self::State,
40 ) -> Result<Self, Self::Error> {
41 Err(VhostUserBlockError::SnapshottingNotSupported)
42 }
43}