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 F27C5AE27 for ; Thu, 28 Apr 2022 10:48:41 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id EB29C2ED2B for ; Thu, 28 Apr 2022 10:48:41 +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 57F1E2ED21 for ; Thu, 28 Apr 2022 10:48:41 +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 2AEA542F19 for ; Thu, 28 Apr 2022 10:48:41 +0200 (CEST) From: Fabian Ebner To: pve-devel@lists.proxmox.com Date: Thu, 28 Apr 2022 10:47:18 +0200 Message-Id: <20220428084718.62125-1-f.ebner@proxmox.com> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 AWL 0.079 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% 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. [rbdplugin.pm] Subject: [pve-devel] [PATCH storage] rbd: unmap volume after rename 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: , X-List-Received-Date: Thu, 28 Apr 2022 08:48:42 -0000 When krbd is used, subsequent removal after an an operation involving a rename could fail with > librbd::image::PreRemoveRequest: 0x559b7506a470 \ > check_image_watchers: image has watchers - not removing because the old mapping was still present. For both operations with a rename, the owning guest should be offline, but even if it weren't, unmap simply fails when the volume is in-use. Signed-off-by: Fabian Ebner --- PVE/Storage/RBDPlugin.pm | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/PVE/Storage/RBDPlugin.pm b/PVE/Storage/RBDPlugin.pm index e9856a9..d71af36 100644 --- a/PVE/Storage/RBDPlugin.pm +++ b/PVE/Storage/RBDPlugin.pm @@ -482,6 +482,9 @@ sub create_base { ); run_rbd_command($cmd, errmsg => "rbd rename '$name' error"); + eval { $class->unmap_volume($storeid, $scfg, $volname); }; + warn $@ if $@; + my $running = undef; #fixme : is create_base always offline ? $class->volume_snapshot($scfg, $storeid, $newname, $snap, $running); @@ -817,6 +820,9 @@ sub rename_volume { errmsg => "could not rename image '${source_image}' to '${target_volname}'", ); + eval { $class->unmap_volume($storeid, $scfg, $source_volname); }; + warn $@ if $@; + $base_name = $base_name ? "${base_name}/" : ''; return "${storeid}:${base_name}${target_volname}"; -- 2.30.2