MCPcopy Create free account
hub / github.com/cloud-hypervisor/cloud-hypervisor / finalize

Method finalize

vm-migration/src/context.rs:181–204  ·  view source on GitHub ↗

Finalizes the metrics and returns a [`CompletedMigrationContext`]. This should be called right after the completed migration was acknowledged by the receiver. From now on, the metrics are considered finalized and should not be modified. They can be stored for further analysis. # Arguments - `state_dur`: The time needed to aggregate the final VM state (i.e., snapshotting it). - `send_state_dur`:

(
        self,
        state_dur: Duration,
        send_state_dur: Duration,
        complete_dur: Duration,
    )

Source from the content-addressed store, hash-verified

179 /// - `complete_dur`: The time of the completion request. This includes
180 /// resuming the VM (if it was running before the migration).
181 pub fn finalize(
182 self,
183 state_dur: Duration,
184 send_state_dur: Duration,
185 complete_dur: Duration,
186 ) -> Result<CompletedMigrationContext, MigrationContextError> {
187 let (migration_begin, downtime_begin, finalized_memory_ctx) = match self {
188 Self::VmPaused {
189 migration_begin,
190 downtime_begin,
191 finalized_memory_ctx,
192 } => (migration_begin, downtime_begin, finalized_memory_ctx),
193 _ => return Err(MigrationContextError::InvalidFinalizeTransition),
194 };
195
196 Ok(CompletedMigrationContext::new(
197 migration_begin.elapsed(),
198 downtime_begin.elapsed(),
199 state_dur,
200 send_state_dur,
201 complete_dur,
202 finalized_memory_ctx,
203 ))
204 }
205}
206
207impl Default for OngoingMigrationContext {

Calls 1

newFunction · 0.85