mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2025-02-23 03:42:20 +00:00
vmm: cpu: Deny resizing if CpuManager is not dynamic
Signed-off-by: Rob Bradford <robert.bradford@intel.com>
This commit is contained in:
parent
e5cb13588b
commit
188078467d
@ -125,6 +125,9 @@ pub enum Error {
|
|||||||
#[cfg(all(target_arch = "x86_64", feature = "gdb"))]
|
#[cfg(all(target_arch = "x86_64", feature = "gdb"))]
|
||||||
/// Failed to translate guest virtual address.
|
/// Failed to translate guest virtual address.
|
||||||
TranslateVirtualAddress(hypervisor::HypervisorCpuError),
|
TranslateVirtualAddress(hypervisor::HypervisorCpuError),
|
||||||
|
|
||||||
|
/// CPU hotplug/unplug not supported
|
||||||
|
ResizingNotSupported,
|
||||||
}
|
}
|
||||||
pub type Result<T> = result::Result<T, Error>;
|
pub type Result<T> = result::Result<T, Error>;
|
||||||
|
|
||||||
@ -1093,6 +1096,10 @@ impl CpuManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn resize(&mut self, desired_vcpus: u8) -> Result<bool> {
|
pub fn resize(&mut self, desired_vcpus: u8) -> Result<bool> {
|
||||||
|
if !self.dynamic {
|
||||||
|
return Err(Error::ResizingNotSupported);
|
||||||
|
}
|
||||||
|
|
||||||
match desired_vcpus.cmp(&self.present_vcpus()) {
|
match desired_vcpus.cmp(&self.present_vcpus()) {
|
||||||
cmp::Ordering::Greater => {
|
cmp::Ordering::Greater => {
|
||||||
self.create_vcpus(desired_vcpus, None)?;
|
self.create_vcpus(desired_vcpus, None)?;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user