From 65ec6631fb38e4dddad3f4579222514d6ceeeb0e Mon Sep 17 00:00:00 2001 From: Rob Bradford Date: Mon, 27 Jun 2022 14:42:56 +0100 Subject: [PATCH] vmm: cpu: Store the vCPU snapshots in ascending order The snapshots are stored in a BTree which is ordered however as the ids are strings lexical ordering places "11" ahead of "2". So encode the vCPU id with zero padding so it is lexically sorted. This fixes issues with CPU restore on aarch64. See: #4239 Signed-off-by: Rob Bradford --- vmm/src/cpu.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vmm/src/cpu.rs b/vmm/src/cpu.rs index 67ac6bc4d..898d4d974 100644 --- a/vmm/src/cpu.rs +++ b/vmm/src/cpu.rs @@ -387,7 +387,7 @@ impl Snapshottable for Vcpu { .state() .map_err(|e| MigratableError::Pause(anyhow!("Could not get vCPU state {:?}", e)))?; - let mut vcpu_snapshot = Snapshot::new(&format!("{}", self.id)); + let mut vcpu_snapshot = Snapshot::new(&format!("{:03}", self.id)); vcpu_snapshot.add_data_section(SnapshotDataSection::new_from_state( VCPU_SNAPSHOT_ID, &saved_state,