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 <sebastien.boeuf@intel.com>
This commit is contained in:
Sebastien Boeuf 2020-06-24 10:18:46 +02:00
parent 0b45f6364e
commit 9fa8438063

View File

@ -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(())