From 0f2f523aa6a5b1c045f63ca8822bb761cd81703c Mon Sep 17 00:00:00 2001 From: Thomas Lamprecht Date: Mon, 14 Nov 2022 15:59:49 +0100 Subject: [PATCH] file restore: limit max dimm size to 512 MB this is on top of the normal memory, and over 1.3 GB required is just huge, sadly the commit adding this has zero details about what setups fail and what work again with the change, so hard to tell, but any setup that needs that much sounds like a bug in ZFS or remaining code here. Signed-off-by: Thomas Lamprecht --- proxmox-file-restore/src/qemu_helper.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/proxmox-file-restore/src/qemu_helper.rs b/proxmox-file-restore/src/qemu_helper.rs index d090c320..d186a26b 100644 --- a/proxmox-file-restore/src/qemu_helper.rs +++ b/proxmox-file-restore/src/qemu_helper.rs @@ -27,7 +27,7 @@ use crate::{backup_user, cpio}; const PBS_VM_NAME: &str = "pbs-restore-vm"; const MAX_CID_TRIES: u64 = 32; -const DYNAMIC_MEMORY_MB: usize = 1024; +pub const MAX_MEMORY_DIMM_SIZE: usize = 512; const QMP_SOCKET_PREFIX: &str = "/run/proxmox-backup/file-restore-qmp-"; fn create_restore_log_dir() -> Result { @@ -137,11 +137,11 @@ async fn send_qmp_request( pub async fn set_dynamic_memory(cid: i32, target_memory: Option) -> Result<(), Error> { let target_memory = match target_memory { - Some(size) if size > DYNAMIC_MEMORY_MB => { + Some(size) if size > MAX_MEMORY_DIMM_SIZE => { bail!("cannot set to {size}M, maximum is {DYNAMIC_MEMORY_MB}M") } Some(size) => size, - None => DYNAMIC_MEMORY_MB, + None => MAX_MEMORY_DIMM_SIZE, }; let path = format!("{QMP_SOCKET_PREFIX}{cid}.sock"); @@ -306,7 +306,7 @@ pub async fn start_vm( qemu_cmd.arg("-m"); qemu_cmd.arg(format!( "{ram}M,slots=1,maxmem={}M", - DYNAMIC_MEMORY_MB + ram + MAX_MEMORY_DIMM_SIZE + ram )); qemu_cmd.args(&drives); qemu_cmd.arg("-device");