* [pve-devel] [PATCH storage 1/2] pbs: free image: explicitly return undef
@ 2021-05-04 9:52 Fabian Ebner
2021-05-04 9:52 ` [pve-devel] [PATCH storage 2/2] lvm: volume import: handle worker returned by free_image Fabian Ebner
2021-06-21 7:39 ` [pve-devel] applied: [PATCH storage 1/2] pbs: free image: explicitly return undef Thomas Lamprecht
0 siblings, 2 replies; 4+ messages in thread
From: Fabian Ebner @ 2021-05-04 9:52 UTC (permalink / raw)
To: pve-devel
Storage.pm's vdisk_free interprets truthy return values as worker subs, so be
explicit about returning undef here. Not an issue at the moment, because
run_client_command already returns undef, but better be safe than sorry.
Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
---
PVE/Storage/PBSPlugin.pm | 2 ++
1 file changed, 2 insertions(+)
diff --git a/PVE/Storage/PBSPlugin.pm b/PVE/Storage/PBSPlugin.pm
index ae45a1a..68c702a 100644
--- a/PVE/Storage/PBSPlugin.pm
+++ b/PVE/Storage/PBSPlugin.pm
@@ -595,6 +595,8 @@ sub free_image {
my ($vtype, $name, $vmid) = $class->parse_volname($volname);
run_client_cmd($scfg, $storeid, "forget", [ $name ], 1);
+
+ return;
}
--
2.20.1
^ permalink raw reply [flat|nested] 4+ messages in thread
* [pve-devel] [PATCH storage 2/2] lvm: volume import: handle worker returned by free_image
2021-05-04 9:52 [pve-devel] [PATCH storage 1/2] pbs: free image: explicitly return undef Fabian Ebner
@ 2021-05-04 9:52 ` Fabian Ebner
2021-06-21 7:39 ` [pve-devel] applied: " Thomas Lamprecht
2021-06-21 7:39 ` [pve-devel] applied: [PATCH storage 1/2] pbs: free image: explicitly return undef Thomas Lamprecht
1 sibling, 1 reply; 4+ messages in thread
From: Fabian Ebner @ 2021-05-04 9:52 UTC (permalink / raw)
To: pve-devel
only affects LVM storages with 'saferemove 1' where the import fails at a rather
advanced stage. Previously in such cases, the renamed (by free_image) volume
del-vm-XYZ-disk-N would be left over.
Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
---
PVE/Storage/LVMPlugin.pm | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/PVE/Storage/LVMPlugin.pm b/PVE/Storage/LVMPlugin.pm
index df49b76..b85fb89 100644
--- a/PVE/Storage/LVMPlugin.pm
+++ b/PVE/Storage/LVMPlugin.pm
@@ -670,8 +670,16 @@ sub volume_import {
$class->volume_import_write($fh, $file);
};
if (my $err = $@) {
- eval { $class->free_image($storeid, $scfg, $volname, 0) };
+ my $cleanup_worker = eval { $class->free_image($storeid, $scfg, $volname, 0) };
warn $@ if $@;
+
+ if ($cleanup_worker) {
+ my $rpcenv = PVE::RPCEnvironment::get();
+ my $authuser = $rpcenv->get_user();
+
+ $rpcenv->fork_worker('imgdel', undef, $authuser, $cleanup_worker);
+ }
+
die $err;
}
--
2.20.1
^ permalink raw reply [flat|nested] 4+ messages in thread
* [pve-devel] applied: [PATCH storage 1/2] pbs: free image: explicitly return undef
2021-05-04 9:52 [pve-devel] [PATCH storage 1/2] pbs: free image: explicitly return undef Fabian Ebner
2021-05-04 9:52 ` [pve-devel] [PATCH storage 2/2] lvm: volume import: handle worker returned by free_image Fabian Ebner
@ 2021-06-21 7:39 ` Thomas Lamprecht
1 sibling, 0 replies; 4+ messages in thread
From: Thomas Lamprecht @ 2021-06-21 7:39 UTC (permalink / raw)
To: Proxmox VE development discussion, Fabian Ebner
On 04.05.21 11:52, Fabian Ebner wrote:
> Storage.pm's vdisk_free interprets truthy return values as worker subs, so be
> explicit about returning undef here. Not an issue at the moment, because
> run_client_command already returns undef, but better be safe than sorry.
>
> Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
> ---
> PVE/Storage/PBSPlugin.pm | 2 ++
> 1 file changed, 2 insertions(+)
>
>
applied, thanks!
^ permalink raw reply [flat|nested] 4+ messages in thread
* [pve-devel] applied: [PATCH storage 2/2] lvm: volume import: handle worker returned by free_image
2021-05-04 9:52 ` [pve-devel] [PATCH storage 2/2] lvm: volume import: handle worker returned by free_image Fabian Ebner
@ 2021-06-21 7:39 ` Thomas Lamprecht
0 siblings, 0 replies; 4+ messages in thread
From: Thomas Lamprecht @ 2021-06-21 7:39 UTC (permalink / raw)
To: Proxmox VE development discussion, Fabian Ebner
On 04.05.21 11:52, Fabian Ebner wrote:
> only affects LVM storages with 'saferemove 1' where the import fails at a rather
> advanced stage. Previously in such cases, the renamed (by free_image) volume
> del-vm-XYZ-disk-N would be left over.
>
> Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
> ---
> PVE/Storage/LVMPlugin.pm | 10 +++++++++-
> 1 file changed, 9 insertions(+), 1 deletion(-)
>
>
applied, thanks!
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2021-06-21 7:39 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-04 9:52 [pve-devel] [PATCH storage 1/2] pbs: free image: explicitly return undef Fabian Ebner
2021-05-04 9:52 ` [pve-devel] [PATCH storage 2/2] lvm: volume import: handle worker returned by free_image Fabian Ebner
2021-06-21 7:39 ` [pve-devel] applied: " Thomas Lamprecht
2021-06-21 7:39 ` [pve-devel] applied: [PATCH storage 1/2] pbs: free image: explicitly return undef Thomas Lamprecht
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal