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 5D5247A0EB for ; Thu, 6 May 2021 17:27:06 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 533B022D62 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 2CE6D22D28 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 F230D46524 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:19 +0200 Message-Id: <20210506152624.12605-5-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 4/9] file-restore: support more drives 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:06 -0000 A PCI bus can only support up to 32 devices, so excluding built-in devices that left us with a maximum of about 25 drives. By adding a new PCI bridge every 32 devices (starting at bridge ID 2 to avoid conflicts with automatic bridges), we can theoretically support up to 8096 drives. Signed-off-by: Stefan Reiter --- Tested with a 41 disk VM, the most I could force into a PVE config. src/bin/proxmox_file_restore/qemu_helper.rs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/bin/proxmox_file_restore/qemu_helper.rs b/src/bin/proxmox_file_restore/qemu_helper.rs index 9b44b55d..c9d816ca 100644 --- a/src/bin/proxmox_file_restore/qemu_helper.rs +++ b/src/bin/proxmox_file_restore/qemu_helper.rs @@ -217,10 +217,21 @@ pub async fn start_vm( "file=pbs:repository={},,snapshot={},,archive={}{},read-only=on,if=none,id=drive{}", details.repo, details.snapshot, file, keyfile, id )); + + // a PCI bus can only support 32 devices, so add a new one every 32 + let bus = (id / 32) + 2; + if id % 32 == 0 { + drives.push("-device".to_owned()); + drives.push(format!("pci-bridge,id=bridge{},chassis_nr={}", bus, bus)); + } + drives.push("-device".to_owned()); // drive serial is used by VM to map .fidx files to /dev paths let serial = file.strip_suffix(".img.fidx").unwrap_or(&file); - drives.push(format!("virtio-blk-pci,drive=drive{},serial={}", id, serial)); + drives.push(format!( + "virtio-blk-pci,drive=drive{},serial={},bus=bridge{}", + id, serial, bus + )); id += 1; } -- 2.20.1