mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
vmm: Make desired vCPUs optional in resize command
In order to be able to support resizing either vCPUs or memory or both make the fields in the resize command optional. Signed-off-by: Rob Bradford <robert.bradford@intel.com>
This commit is contained in:
committed by
Samuel Ortiz
parent
72b9e920a3
commit
f1b6657833
@@ -481,16 +481,19 @@ impl Vm {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub fn resize(&mut self, desired_vcpus: u8) -> Result<()> {
|
||||
self.cpu_manager
|
||||
.lock()
|
||||
.unwrap()
|
||||
.resize(desired_vcpus)
|
||||
.map_err(Error::CpuManager)?;
|
||||
self.devices
|
||||
.notify_hotplug(HotPlugNotificationType::CPUDevicesChanged)
|
||||
.map_err(Error::DeviceManager)?;
|
||||
self.config.lock().unwrap().cpus.boot_vcpus = desired_vcpus;
|
||||
pub fn resize(&mut self, desired_vcpus: Option<u8>) -> Result<()> {
|
||||
if let Some(desired_vcpus) = desired_vcpus {
|
||||
self.cpu_manager
|
||||
.lock()
|
||||
.unwrap()
|
||||
.resize(desired_vcpus)
|
||||
.map_err(Error::CpuManager)?;
|
||||
self.devices
|
||||
.notify_hotplug(HotPlugNotificationType::CPUDevicesChanged)
|
||||
.map_err(Error::DeviceManager)?;
|
||||
self.config.lock().unwrap().cpus.boot_vcpus = desired_vcpus;
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user