File tree Expand file tree Collapse file tree 4 files changed +16
-3
lines changed Expand file tree Collapse file tree 4 files changed +16
-3
lines changed Original file line number Diff line number Diff line change @@ -57,7 +57,7 @@ pub struct BlockState {
5757 ) ]
5858 cache_type : CacheTypeState ,
5959 root_device : bool ,
60- disk_path : String ,
60+ pub disk_path : String ,
6161 virtio_state : VirtioDeviceState ,
6262 rate_limiter_state : RateLimiterState ,
6363}
Original file line number Diff line number Diff line change @@ -418,7 +418,18 @@ pub fn restore_from_snapshot(
418418) -> std:: result:: Result < Arc < Mutex < Vmm > > , LoadSnapshotError > {
419419 use self :: LoadSnapshotError :: * ;
420420 let track_dirty_pages = params. enable_diff_snapshots ;
421- let microvm_state = snapshot_state_from_file ( & params. snapshot_path , version_map) ?;
421+ let mut microvm_state = snapshot_state_from_file ( & params. snapshot_path , version_map) ?;
422+
423+ let new_snapshot_path = & params. new_snapshot_path ;
424+
425+ if ! new_snapshot_path. eq ( "" ) {
426+ let n = microvm_state. device_states . block_devices . len ( ) ;
427+ for i in 0 ..n {
428+ if microvm_state. device_states . block_devices [ i] . device_state . disk_path . contains ( "fc-dev-thinpool-" ) {
429+ microvm_state. device_states . block_devices [ i] . device_state . disk_path = new_snapshot_path. clone ( ) ;
430+ }
431+ }
432+ }
422433
423434 // Some sanity checks before building the microvm.
424435 snapshot_state_sanity_check ( & microvm_state) ?;
Original file line number Diff line number Diff line change @@ -50,6 +50,8 @@ pub struct LoadSnapshotParams {
5050 pub mem_file_path : PathBuf ,
5151 /// Setting this flag enables user page faults handling by a different process.
5252 pub enable_user_page_faults : bool ,
53+ /// Setting this string to nonempty changes the snapshot device
54+ pub new_snapshot_path : String ,
5355 /// Path to the passfd socket.
5456 pub sock_file_path : PathBuf ,
5557 /// Setting this flag will enable KVM dirty page tracking and will
Original file line number Diff line number Diff line change 6969# would help with reproducible builds (in addition to pinning Cargo.lock)
7070
7171# Development container image (without tag)
72- DEVCTR_IMAGE_NO_TAG=" docker.io/vhiveease /fcuvm_dev"
72+ DEVCTR_IMAGE_NO_TAG=" docker.io/amohoste /fcuvm_dev"
7373
7474# Development container tag
7575# DEVCTR_IMAGE_TAG="v30"
You can’t perform that action at this time.
0 commit comments