mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
vhost_user_block: Add DEVICE_STATE support
Advertise VHOST_USER_PROTOCOL_F_DEVICE_STATE and implement the associated callbacks for the vhost-user-block backend. Given there's no specific state that needs to be saved through these operations, this a blank implementation. This support will be useful for testing the snapshot case where the source VM is preserved after the snapshot is complete. Signed-off-by: Sebastien Boeuf <sboeuf@meta.com> Assisted-by: Claude:claude-opus-4-8
This commit is contained in:
@@ -337,6 +337,7 @@ impl VhostUserBackendMut for VhostUserBlkBackend {
|
||||
VhostUserProtocolFeatures::CONFIG
|
||||
| VhostUserProtocolFeatures::MQ
|
||||
| VhostUserProtocolFeatures::CONFIGURE_MEM_SLOTS
|
||||
| VhostUserProtocolFeatures::DEVICE_STATE
|
||||
}
|
||||
|
||||
fn set_event_idx(&mut self, enabled: bool) {
|
||||
@@ -452,6 +453,21 @@ impl VhostUserBackendMut for VhostUserBlkBackend {
|
||||
) -> VhostUserBackendResult<()> {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn set_device_state_fd(
|
||||
&mut self,
|
||||
_direction: VhostTransferStateDirection,
|
||||
_phase: VhostTransferStatePhase,
|
||||
_file: File,
|
||||
) -> VhostUserBackendResult<Option<File>> {
|
||||
// This device completes requests synchronously and keeps no inflight
|
||||
// state.
|
||||
Ok(None)
|
||||
}
|
||||
|
||||
fn check_device_state(&self) -> VhostUserBackendResult<()> {
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
struct VhostUserBlkBackendConfig {
|
||||
|
||||
Reference in New Issue
Block a user