From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by lists.proxmox.com (Postfix) with ESMTPS id 561CB7A188 for ; Thu, 6 May 2021 17:27:36 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 4ED5822D5D for ; Thu, 6 May 2021 17:27:06 +0200 (CEST) Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com [94.136.29.106]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by firstgate.proxmox.com (Proxmox) with ESMTPS id 2055022D23 for ; Thu, 6 May 2021 17:27:04 +0200 (CEST) Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1]) by proxmox-new.maurer-it.com (Proxmox) with ESMTP id EB2EA46522 for ; Thu, 6 May 2021 17:27:03 +0200 (CEST) From: Stefan Reiter To: pbs-devel@lists.proxmox.com Date: Thu, 6 May 2021 17:26:18 +0200 Message-Id: <20210506152624.12605-4-s.reiter@proxmox.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210506152624.12605-1-s.reiter@proxmox.com> References: <20210506152624.12605-1-s.reiter@proxmox.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 AWL 0.015 Adjusted score from AWL reputation of From: address KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Subject: [pbs-devel] [PATCH proxmox-backup 3/9] file-restore: add more RAM for VMs with many drives or debug X-BeenThere: pbs-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox Backup Server development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 May 2021 15:27:36 -0000 The guest kernel requires more memory depending on how many disks are attached. 256 seems to be enough for basically any reasonable and unreasonable amount of disks though. For debug instance, make it 1G, as these are never started automatically anyway, and need at least 512MB since the initramfs (especially when including a debug build of the daemon) is substantially bigger. Signed-off-by: Stefan Reiter --- src/bin/proxmox_file_restore/qemu_helper.rs | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/bin/proxmox_file_restore/qemu_helper.rs b/src/bin/proxmox_file_restore/qemu_helper.rs index a2b5b09d..9b44b55d 100644 --- a/src/bin/proxmox_file_restore/qemu_helper.rs +++ b/src/bin/proxmox_file_restore/qemu_helper.rs @@ -183,8 +183,6 @@ pub async fn start_vm( "-vnc", "none", "-enable-kvm", - "-m", - "128", "-kernel", buildcfg::PROXMOX_BACKUP_KERNEL_FN, "-initrd", @@ -226,11 +224,24 @@ pub async fn start_vm( id += 1; } + let ram = if debug { + 1024 + } else { + // add more RAM if many drives are given + match id { + f if f < 10 => 128, + f if f < 20 => 192, + _ => 256, + } + }; + // Try starting QEMU in a loop to retry if we fail because of a bad 'cid' value let mut attempts = 0; loop { let mut qemu_cmd = std::process::Command::new("qemu-system-x86_64"); qemu_cmd.args(base_args.iter()); + qemu_cmd.arg("-m"); + qemu_cmd.arg(ram.to_string()); qemu_cmd.args(&drives); qemu_cmd.arg("-device"); qemu_cmd.arg(format!( -- 2.20.1