From: Lorenz Stechauner <l.stechauner@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH v2 http-server 1/1] anyevent: move unlink from http-server to endpoint
Date: Thu, 22 Jul 2021 15:06:23 +0200 [thread overview]
Message-ID: <20210722130631.237107-2-l.stechauner@proxmox.com> (raw)
In-Reply-To: <20210722130631.237107-1-l.stechauner@proxmox.com>
any uploaded file has to be deleted by the corrosponding
endpoint. the file upload was only used by the 'upload to
storage' feature in pve.
this change allows the endpoint to delete the file itself,
making the old and racey`sleep 1` (waiting until the worker
has opened the file) obsolete.
this change breaks all pve-manager versions, in which the
worker does not unlink the temp file itself.
Signed-off-by: Lorenz Stechauner <l.stechauner@proxmox.com>
---
src/PVE/APIServer/AnyEvent.pm | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/PVE/APIServer/AnyEvent.pm b/src/PVE/APIServer/AnyEvent.pm
index cd77806..23b8d10 100644
--- a/src/PVE/APIServer/AnyEvent.pm
+++ b/src/PVE/APIServer/AnyEvent.pm
@@ -114,7 +114,7 @@ sub log_aborted_request {
}
sub cleanup_reqstate {
- my ($reqstate) = @_;
+ my ($reqstate, $deletetmpfile) = @_;
delete $reqstate->{log};
delete $reqstate->{request};
@@ -123,7 +123,7 @@ sub cleanup_reqstate {
delete $reqstate->{starttime};
if ($reqstate->{tmpfilename}) {
- unlink $reqstate->{tmpfilename};
+ unlink $reqstate->{tmpfilename} if $deletetmpfile;
delete $reqstate->{tmpfilename};
}
}
@@ -131,7 +131,7 @@ sub cleanup_reqstate {
sub client_do_disconnect {
my ($self, $reqstate) = @_;
- cleanup_reqstate($reqstate);
+ cleanup_reqstate($reqstate, 1);
my $shutdown_hdl = sub {
my $hdl = shift;
--
2.30.2
next prev parent reply other threads:[~2021-07-22 13:07 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-07-22 13:06 [pve-devel] [PATCH-SERIES v2 http-server/storage/manager] add checksum and algorithm to iso upload Lorenz Stechauner
2021-07-22 13:06 ` Lorenz Stechauner [this message]
2021-07-22 13:06 ` [pve-devel] [PATCH v2 storage 1/3] status: move unlink from http-server to enpoint Lorenz Stechauner
2021-07-30 13:13 ` Thomas Lamprecht
2021-07-22 13:06 ` [pve-devel] [PATCH v2 storage 2/3] status: remove sleep(1) in file upload Lorenz Stechauner
2021-07-22 13:06 ` [pve-devel] [PATCH v2 storage 1/1] status: add checksum and algorithm to " Lorenz Stechauner
2021-07-30 13:15 ` Thomas Lamprecht
2021-07-22 13:06 ` [pve-devel] [PATCH v2 manager 1/5] ui: move upload window into UploadToStorage.js Lorenz Stechauner
2021-07-22 13:06 ` [pve-devel] [PATCH v2 manager 2/5] ui: refactor UploadToStorage.js Lorenz Stechauner
2021-08-02 14:34 ` Dominik Csapak
2021-07-22 13:06 ` [pve-devel] [PATCH v2 manager 3/5] ui/UploadToStorage: add checksum and algorithm Lorenz Stechauner
2021-08-02 14:37 ` Dominik Csapak
2021-07-22 13:06 ` [pve-devel] [PATCH v2 manager 4/5] ui/UploadToStorage: add TaskViewer Lorenz Stechauner
2021-07-22 13:06 ` [pve-devel] [PATCH v2 manager 5/5] ui/UplaodToStorage: check file extension Lorenz Stechauner
2021-08-02 14:40 ` Dominik Csapak
2021-07-30 13:19 ` [pve-devel] [PATCH-SERIES v2 http-server/storage/manager] add checksum and algorithm to iso upload Thomas Lamprecht
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210722130631.237107-2-l.stechauner@proxmox.com \
--to=l.stechauner@proxmox.com \
--cc=pve-devel@lists.proxmox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox