From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [IPv6:2a01:7e0:0:424::9]) by lore.proxmox.com (Postfix) with ESMTPS id DF4BD1FF16B for ; Tue, 1 Jul 2025 17:43:37 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 3AA51A1C4; Tue, 1 Jul 2025 17:41:54 +0200 (CEST) From: Fiona Ebner To: pve-devel@lists.proxmox.com Date: Tue, 1 Jul 2025 17:40:21 +0200 Message-ID: <20250701154117.434512-2-f.ebner@proxmox.com> X-Mailer: git-send-email 2.47.2 In-Reply-To: <20250701154117.434512-1-f.ebner@proxmox.com> References: <20250701154117.434512-1-f.ebner@proxmox.com> MIME-Version: 1.0 X-SPAM-LEVEL: Spam detection results: 0 AWL -0.148 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment RCVD_IN_VALIDITY_CERTIFIED_BLOCKED 0.237 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. RCVD_IN_VALIDITY_RPBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. RCVD_IN_VALIDITY_SAFE_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Subject: [pve-devel] [PATCH qemu v2 01/49] PVE backup: prepare for the switch to using blockdev rather than drive X-BeenThere: pve-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox VE development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Proxmox VE development discussion Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: pve-devel-bounces@lists.proxmox.com Sender: "pve-devel" Also allow finding block nodes by their node name rather than just via an associated block backend, which might not exist for block nodes. For regular drives, it is essential to not use the throttle group, because otherwise the limits intended only for the guest would also apply to the backup job. Signed-off-by: Fiona Ebner --- pve-backup.c | 51 +++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 39 insertions(+), 12 deletions(-) diff --git a/pve-backup.c b/pve-backup.c index 0450303017..457fcb7e5c 100644 --- a/pve-backup.c +++ b/pve-backup.c @@ -847,29 +847,56 @@ static PVEBackupDevInfo coroutine_fn GRAPH_RDLOCK *get_single_device_info( Error **errp) { BlockBackend *blk = blk_by_name(device); - if (!blk) { - error_set(errp, ERROR_CLASS_DEVICE_NOT_FOUND, - "Device '%s' not found", device); - return NULL; + BlockDriverState *root_bs, *bs; + + if (blk) { + root_bs = bs = blk_bs(blk); + } else { + /* TODO PVE 10 - fleecing will always be attached without blk */ + root_bs = bs = bdrv_find_node(device); + if (!bs) { + error_set(errp, ERROR_CLASS_DEVICE_NOT_FOUND, + "Device '%s' not found", device); + return NULL; + } + /* For TPM, bs is already correct, otherwise need the file child. */ + if (!strncmp(bs->drv->format_name, "throttle", 8)) { + if (!bs->file || !bs->file->bs) { + error_set(errp, ERROR_CLASS_DEVICE_NOT_FOUND, + "Device '%s' not found (no file child)", device); + return NULL; + } + bs = bs->file->bs; + } } - BlockDriverState *bs = blk_bs(blk); + if (!bdrv_co_is_inserted(bs)) { error_setg(errp, "Device '%s' has no medium", device); return NULL; } + PVEBackupDevInfo *di = g_new0(PVEBackupDevInfo, 1); di->bs = bs; - di->device_name = g_strdup(bdrv_get_device_name(bs)); + /* Need the name of the root node, e.g. drive-scsi0 */ + di->device_name = g_strdup(bdrv_get_device_or_node_name(root_bs)); if (device_uses_fleecing && device_uses_fleecing(device)) { g_autofree gchar *fleecing_devid = g_strconcat(device, "-fleecing", NULL); + BlockDriverState *fleecing_bs; + BlockBackend *fleecing_blk = blk_by_name(fleecing_devid); - if (!fleecing_blk) { - error_set(errp, ERROR_CLASS_DEVICE_NOT_FOUND, - "Device '%s' not found", fleecing_devid); - goto fail; + if (fleecing_blk) { + fleecing_bs = blk_bs(fleecing_blk); + } else { + /* TODO PVE 10 - fleecing will always be attached without blk */ + fleecing_bs = bdrv_find_node(fleecing_devid); + if (!fleecing_bs) { + error_set(errp, ERROR_CLASS_DEVICE_NOT_FOUND, + "Device '%s' not found", fleecing_devid); + goto fail; + } } - BlockDriverState *fleecing_bs = blk_bs(fleecing_blk); + if (!bdrv_co_is_inserted(fleecing_bs)) { error_setg(errp, "Device '%s' has no medium", fleecing_devid); goto fail; @@ -927,7 +954,7 @@ static GList coroutine_fn GRAPH_RDLOCK *get_device_info( PVEBackupDevInfo *di = g_new0(PVEBackupDevInfo, 1); di->bs = bs; - di->device_name = g_strdup(bdrv_get_device_name(bs)); + di->device_name = g_strdup(bdrv_get_device_or_node_name(bs)); di_list = g_list_append(di_list, di); } } -- 2.47.2 _______________________________________________ pve-devel mailing list pve-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel