Skip to content

Commit f1e5873

Browse files
committed
new version for device_manager persis.
Signed-off-by: Egor Lazarchuk <[email protected]>
1 parent d9e9d7b commit f1e5873

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

src/vmm/src/device_manager/persist.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,7 @@ pub struct DeviceStates {
199199
/// Virtio block device states.
200200
pub virtio_block_devices: Vec<ConnectedVirtioBlockState>,
201201
/// Vhost-user block device states.
202+
#[version(start = 5, de_fn = "de_vhost_user_block")]
202203
pub vhost_user_block_devices: Vec<ConnectedVhostUserBlockState>,
203204
/// Net device states.
204205
pub net_devices: Vec<ConnectedNetState>,
@@ -258,6 +259,14 @@ impl DeviceStates {
258259

259260
Ok(())
260261
}
262+
263+
fn de_vhost_user_block(&mut self, source_version: u16) -> VersionizeResult<()> {
264+
if source_version < 5 {
265+
self.vhost_user_block_devices = vec![];
266+
}
267+
268+
Ok(())
269+
}
261270
}
262271

263272
pub struct MMIODevManagerConstructorArgs<'a> {

src/vmm/src/version_map.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ lazy_static! {
8686
version_map.new_version();
8787

8888
version_map.set_type_version(VirtioDeviceState::type_id(), 2);
89+
version_map.set_type_version(DeviceStates::type_id(), 5);
8990

9091
version_map
9192
};

0 commit comments

Comments
 (0)