File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -275,7 +275,7 @@ mod tests {
275275 Box :: new ( VmmAction :: CreateSnapshot ( CreateSnapshotParams {
276276 snapshot_type : SnapshotType :: Diff ,
277277 snapshot_path : PathBuf :: new ( ) ,
278- mem_file_path : PathBuf :: new ( ) ,
278+ mem_file_path : Some ( PathBuf :: new ( ) ) ,
279279 } ) ) ,
280280 start_time_us,
281281 ) ;
@@ -288,7 +288,7 @@ mod tests {
288288 Box :: new ( VmmAction :: CreateSnapshot ( CreateSnapshotParams {
289289 snapshot_type : SnapshotType :: Diff ,
290290 snapshot_path : PathBuf :: new ( ) ,
291- mem_file_path : PathBuf :: new ( ) ,
291+ mem_file_path : Some ( PathBuf :: new ( ) ) ,
292292 } ) ) ,
293293 start_time_us,
294294 ) ;
Original file line number Diff line number Diff line change @@ -144,7 +144,7 @@ mod tests {
144144 let expected_config = CreateSnapshotParams {
145145 snapshot_type : SnapshotType :: Diff ,
146146 snapshot_path : PathBuf :: from ( "foo" ) ,
147- mem_file_path : PathBuf :: from ( "bar" ) ,
147+ mem_file_path : Some ( PathBuf :: from ( "bar" ) ) ,
148148 } ;
149149 assert_eq ! (
150150 vmm_action_from_request( parse_put_snapshot( & Body :: new( body) , Some ( "create" ) ) . unwrap( ) ) ,
@@ -158,7 +158,7 @@ mod tests {
158158 let expected_config = CreateSnapshotParams {
159159 snapshot_type : SnapshotType :: Full ,
160160 snapshot_path : PathBuf :: from ( "foo" ) ,
161- mem_file_path : PathBuf :: from ( "bar" ) ,
161+ mem_file_path : Some ( PathBuf :: from ( "bar" ) ) ,
162162 } ;
163163 assert_eq ! (
164164 vmm_action_from_request( parse_put_snapshot( & Body :: new( body) , Some ( "create" ) ) . unwrap( ) ) ,
Original file line number Diff line number Diff line change @@ -1665,12 +1665,14 @@ definitions:
16651665 SnapshotCreateParams :
16661666 type : object
16671667 required :
1668- - mem_file_path
16691668 - snapshot_path
16701669 properties :
16711670 mem_file_path :
16721671 type : string
1673- description : Path to the file that will contain the guest memory.
1672+ description :
1673+ Path to the file that will contain the guest memory. It is optional.
1674+ In case that a user doesn't provide a path, they are responsible to
1675+ ensure they store the microVM's memory state via external means.
16741676 snapshot_path :
16751677 type : string
16761678 description : Path to the file that will contain the microVM state.
Original file line number Diff line number Diff line change @@ -161,8 +161,10 @@ pub fn create_snapshot(
161161
162162 snapshot_state_to_file ( & microvm_state, & params. snapshot_path ) ?;
163163
164+ if let Some ( mem_file_path) = params. mem_file_path . as_ref ( ) {
164165 vmm. vm
165- . snapshot_memory_to_file ( & params. mem_file_path , params. snapshot_type ) ?;
166+ . snapshot_memory_to_file ( mem_file_path, params. snapshot_type ) ?;
167+ }
166168
167169 // We need to mark queues as dirty again for all activated devices. The reason we
168170 // do it here is that we don't mark pages as dirty during runtime
Original file line number Diff line number Diff line change @@ -1243,7 +1243,7 @@ mod tests {
12431243 CreateSnapshotParams {
12441244 snapshot_type : SnapshotType :: Full ,
12451245 snapshot_path : PathBuf :: new ( ) ,
1246- mem_file_path : PathBuf :: new ( ) ,
1246+ mem_file_path : Some ( PathBuf :: new ( ) ) ,
12471247 } ,
12481248 ) ) ) ;
12491249 #[ cfg( target_arch = "x86_64" ) ]
Original file line number Diff line number Diff line change @@ -44,7 +44,7 @@ pub struct CreateSnapshotParams {
4444 /// Path to the file that will contain the microVM state.
4545 pub snapshot_path : PathBuf ,
4646 /// Path to the file that will contain the guest memory.
47- pub mem_file_path : PathBuf ,
47+ pub mem_file_path : Option < PathBuf > ,
4848}
4949
5050/// Allows for changing the mapping between tap devices and host devices
Original file line number Diff line number Diff line change @@ -235,7 +235,7 @@ fn verify_create_snapshot(
235235 let snapshot_params = CreateSnapshotParams {
236236 snapshot_type,
237237 snapshot_path : snapshot_file. as_path ( ) . to_path_buf ( ) ,
238- mem_file_path : memory_file. as_path ( ) . to_path_buf ( ) ,
238+ mem_file_path : Some ( memory_file. as_path ( ) . to_path_buf ( ) ) ,
239239 } ;
240240
241241 controller
You can’t perform that action at this time.
0 commit comments