mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
vmm: Fix clippy lints
This PR fixes some clippy lints in the vmm crate. Signed-off-by: Oliver Anderson <oliver.anderson@cyberus-technology.de> On-behalf-of: SAP oliver.anderson@sap.com
This commit is contained in:
committed by
Rob Bradford
parent
0be7d1bd82
commit
8de24b5f08
@@ -1615,26 +1615,23 @@ impl RequestHandler for Vmm {
|
|||||||
fn vm_create(&mut self, config: Box<VmConfig>) -> result::Result<(), VmError> {
|
fn vm_create(&mut self, config: Box<VmConfig>) -> result::Result<(), VmError> {
|
||||||
// We only store the passed VM config.
|
// We only store the passed VM config.
|
||||||
// The VM will be created when being asked to boot it.
|
// The VM will be created when being asked to boot it.
|
||||||
if self.vm_config.is_none() {
|
if self.vm_config.is_some() {
|
||||||
self.vm_config = Some(Arc::new(Mutex::new(*config)));
|
return Err(VmError::VmAlreadyCreated);
|
||||||
self.console_info =
|
|
||||||
Some(pre_create_console_devices(self).map_err(VmError::CreateConsoleDevices)?);
|
|
||||||
|
|
||||||
if self
|
|
||||||
.vm_config
|
|
||||||
.as_ref()
|
|
||||||
.unwrap()
|
|
||||||
.lock()
|
|
||||||
.unwrap()
|
|
||||||
.landlock_enable
|
|
||||||
{
|
|
||||||
apply_landlock(self.vm_config.as_ref().unwrap().as_ref())
|
|
||||||
.map_err(VmError::ApplyLandlock)?;
|
|
||||||
}
|
|
||||||
Ok(())
|
|
||||||
} else {
|
|
||||||
Err(VmError::VmAlreadyCreated)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
self.vm_config = Some(Arc::new(Mutex::new(*config)));
|
||||||
|
self.console_info =
|
||||||
|
Some(pre_create_console_devices(self).map_err(VmError::CreateConsoleDevices)?);
|
||||||
|
|
||||||
|
if self
|
||||||
|
.vm_config
|
||||||
|
.as_ref()
|
||||||
|
.is_some_and(|config| config.lock().unwrap().landlock_enable)
|
||||||
|
{
|
||||||
|
apply_landlock(self.vm_config.as_ref().unwrap().as_ref())
|
||||||
|
.map_err(VmError::ApplyLandlock)?;
|
||||||
|
}
|
||||||
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn vm_boot(&mut self) -> result::Result<(), VmError> {
|
fn vm_boot(&mut self) -> result::Result<(), VmError> {
|
||||||
|
|||||||
@@ -408,8 +408,10 @@ fn memory_zone_get_align_size(zone: &MemoryZoneConfig) -> Result<u64, Error> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// The `hugepages` is enabled and the `hugepage_size` is specified, just use it directly.
|
// The `hugepages` is enabled and the `hugepage_size` is specified, just use it directly.
|
||||||
if zone.hugepages && zone.hugepage_size.is_some() {
|
if let Some(hugepage_size) = zone.hugepage_size
|
||||||
return Ok(zone.hugepage_size.unwrap());
|
&& zone.hugepages
|
||||||
|
{
|
||||||
|
return Ok(hugepage_size);
|
||||||
}
|
}
|
||||||
|
|
||||||
// There are two scenarios here:
|
// There are two scenarios here:
|
||||||
|
|||||||
Reference in New Issue
Block a user