From 9fa84380634b8f163adee27fed0c479f50487f46 Mon Sep 17 00:00:00 2001 From: Sebastien Boeuf Date: Wed, 24 Jun 2020 10:18:46 +0200 Subject: [PATCH] vmm: Fill CpuManager's vCPU list on restore path It's important that on restore path, the CpuManager's vCPU gets filled with each new vCPU that is being created. In order to cover both boot and restore paths, the list is being filled from the common function create_vcpu(). Signed-off-by: Sebastien Boeuf --- vmm/src/cpu.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/vmm/src/cpu.rs b/vmm/src/cpu.rs index 572684971..f198f660c 100644 --- a/vmm/src/cpu.rs +++ b/vmm/src/cpu.rs @@ -745,9 +745,10 @@ impl CpuManager { .expect("Failed to configure vCPU"); } - let vcpu_clone = Arc::clone(&vcpu); + // Adding vCPU to the CpuManager's vCPU list. + self.vcpus.push(Arc::clone(&vcpu)); - Ok(vcpu_clone) + Ok(vcpu) } /// Only create new vCPUs if there aren't any inactive ones to reuse @@ -766,8 +767,7 @@ impl CpuManager { // Only create vCPUs in excess of all the allocated vCPUs. for cpu_id in self.vcpus.len() as u8..desired_vcpus { - let vcpu = self.create_vcpu(cpu_id, entry_point, None)?; - self.vcpus.push(vcpu); + self.create_vcpu(cpu_id, entry_point, None)?; } Ok(())