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 99AE6773FD for ; Tue, 27 Apr 2021 15:35:57 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 8C6A8206AE for ; Tue, 27 Apr 2021 15:35:57 +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) server-digest SHA256) (No client certificate requested) by firstgate.proxmox.com (Proxmox) with ESMTPS id 4C553206A2 for ; Tue, 27 Apr 2021 15:35:56 +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 254314353F for ; Tue, 27 Apr 2021 15:35:56 +0200 (CEST) From: Stefan Reiter To: pbs-devel@lists.proxmox.com Date: Tue, 27 Apr 2021 15:35:45 +0200 Message-Id: <20210427133545.12593-1-s.reiter@proxmox.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 AWL 0.019 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 URIBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [disk.rs] Subject: [pbs-devel] [PATCH proxmox-backup] file-restore: strip .img.fidx suffix from drive serials 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: Tue, 27 Apr 2021 13:35:57 -0000 Drive serials have a character limit of 20, longer names like "drive-virtio0.img.fidx" or "drive-efidisk0.img.fidx" would get cut off. Fix this by removing the suffix, it is not necessary to uniquely identify an image. Signed-off-by: Stefan Reiter --- src/bin/proxmox_file_restore/qemu_helper.rs | 3 ++- src/bin/proxmox_restore_daemon/disk.rs | 6 +++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/bin/proxmox_file_restore/qemu_helper.rs b/src/bin/proxmox_file_restore/qemu_helper.rs index e50a8bbf..9328addf 100644 --- a/src/bin/proxmox_file_restore/qemu_helper.rs +++ b/src/bin/proxmox_file_restore/qemu_helper.rs @@ -201,7 +201,8 @@ pub async fn start_vm( )); drives.push("-device".to_owned()); // drive serial is used by VM to map .fidx files to /dev paths - drives.push(format!("virtio-blk-pci,drive=drive{},serial={}", id, file)); + let serial = file.strip_suffix(".img.fidx").unwrap_or(&file); + drives.push(format!("virtio-blk-pci,drive=drive{},serial={}", id, serial)); id += 1; } diff --git a/src/bin/proxmox_restore_daemon/disk.rs b/src/bin/proxmox_restore_daemon/disk.rs index 08fe7490..0b564e42 100644 --- a/src/bin/proxmox_restore_daemon/disk.rs +++ b/src/bin/proxmox_restore_daemon/disk.rs @@ -268,7 +268,11 @@ impl DiskState { _ => bail!("no or invalid image in path"), }; - let buckets = match self.disk_map.get_mut(req_fidx.as_ref()) { + let buckets = match self.disk_map.get_mut( + req_fidx + .strip_suffix(".img.fidx") + .unwrap_or_else(|| req_fidx.as_ref()), + ) { Some(x) => x, None => bail!("given image '{}' not found", req_fidx), }; -- 2.20.1