public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [pve-devel] [PATCH storage] rbd: unmap volume after rename
@ 2022-04-28  8:47 Fabian Ebner
  2022-04-28 11:44 ` [pve-devel] applied: " Thomas Lamprecht
  0 siblings, 1 reply; 2+ messages in thread
From: Fabian Ebner @ 2022-04-28  8:47 UTC (permalink / raw)
  To: pve-devel

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 <f.ebner@proxmox.com>
---
 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





^ permalink raw reply	[flat|nested] 2+ messages in thread

* [pve-devel] applied: [PATCH storage] rbd: unmap volume after rename
  2022-04-28  8:47 [pve-devel] [PATCH storage] rbd: unmap volume after rename Fabian Ebner
@ 2022-04-28 11:44 ` Thomas Lamprecht
  0 siblings, 0 replies; 2+ messages in thread
From: Thomas Lamprecht @ 2022-04-28 11:44 UTC (permalink / raw)
  To: Proxmox VE development discussion, Fabian Ebner

On 28.04.22 10:47, Fabian Ebner wrote:
> 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 <f.ebner@proxmox.com>
> ---
>  PVE/Storage/RBDPlugin.pm | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
>

applied, thanks!




^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-04-28 11:44 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-28  8:47 [pve-devel] [PATCH storage] rbd: unmap volume after rename Fabian Ebner
2022-04-28 11:44 ` [pve-devel] applied: " Thomas Lamprecht

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal