misc: unrelated misc code improvements

Signed-off-by: Philipp Schuster <philipp.schuster@cyberus-technology.de>
On-behalf-of: SAP philipp.schuster@sap.com
This commit is contained in:
Philipp Schuster
2025-11-17 15:46:40 +01:00
committed by Rob Bradford
parent e4fd066d82
commit 935332bc42
+9 -18
View File
@@ -1815,12 +1815,9 @@ impl RequestHandler for Vmm {
self.vm_config.as_ref().ok_or(VmError::VmNotCreated)?; self.vm_config.as_ref().ok_or(VmError::VmNotCreated)?;
if let Some(ref mut vm) = self.vm { if let Some(ref mut vm) = self.vm {
if let Err(e) = vm.resize(desired_vcpus, desired_ram, desired_balloon) { vm.resize(desired_vcpus, desired_ram, desired_balloon)
error!("Error when resizing VM: {e:?}"); .inspect_err(|e| error!("Error when resizing VM: {e:?}"))?;
Err(e) Ok(())
} else {
Ok(())
}
} else { } else {
let mut config = self.vm_config.as_ref().unwrap().lock().unwrap(); let mut config = self.vm_config.as_ref().unwrap().lock().unwrap();
if let Some(desired_vcpus) = desired_vcpus { if let Some(desired_vcpus) = desired_vcpus {
@@ -1842,12 +1839,9 @@ impl RequestHandler for Vmm {
self.vm_config.as_ref().ok_or(VmError::VmNotCreated)?; self.vm_config.as_ref().ok_or(VmError::VmNotCreated)?;
if let Some(ref mut vm) = self.vm { if let Some(ref mut vm) = self.vm {
if let Err(e) = vm.resize_zone(id, desired_ram) { vm.resize_zone(id, desired_ram)
error!("Error when resizing VM: {e:?}"); .inspect_err(|e| error!("Error when resizing zone: {e:?}"))?;
Err(e) Ok(())
} else {
Ok(())
}
} else { } else {
// Update VmConfig by setting the new desired ram. // Update VmConfig by setting the new desired ram.
let memory_config = &mut self.vm_config.as_ref().unwrap().lock().unwrap().memory; let memory_config = &mut self.vm_config.as_ref().unwrap().lock().unwrap().memory;
@@ -1926,12 +1920,9 @@ impl RequestHandler for Vmm {
fn vm_remove_device(&mut self, id: String) -> result::Result<(), VmError> { fn vm_remove_device(&mut self, id: String) -> result::Result<(), VmError> {
if let Some(ref mut vm) = self.vm { if let Some(ref mut vm) = self.vm {
if let Err(e) = vm.remove_device(id) { vm.remove_device(id)
error!("Error when removing device from the VM: {e:?}"); .inspect_err(|e| error!("Error when removing device from the VM: {e:?}"))?;
Err(e) Ok(())
} else {
Ok(())
}
} else if let Some(ref config) = self.vm_config { } else if let Some(ref config) = self.vm_config {
let mut config = config.lock().unwrap(); let mut config = config.lock().unwrap();
if config.remove_device(&id) { if config.remove_device(&id) {