public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Thomas Lamprecht <t.lamprecht@proxmox.com>
To: Proxmox VE development discussion <pve-devel@lists.proxmox.com>,
	Lorenz Stechauner <l.stechauner@proxmox.com>
Subject: Re: [pve-devel] [PATCH storage] status: add unlink to worker in file upload
Date: Wed, 21 Jul 2021 16:51:31 +0200	[thread overview]
Message-ID: <9bca870e-c601-3905-fb14-f3b6acef1385@proxmox.com> (raw)
In-Reply-To: <20210721125217.3734806-1-l.stechauner@proxmox.com>

On 21.07.21 14:52, Lorenz Stechauner wrote:
> this is the first step in which not the http server removes the
> temporary file, but the worker itself. for now, this `unlink`
> statement won't unlink anything existing. but after changes to
> the http server have been made, the endpoint will be able to
> clean up for itself afterwards.
> 
> Signed-off-by: Lorenz Stechauner <l.stechauner@proxmox.com>
> ---
> a version bump would be helpful, so the older versions can be
> marked as 'breaks' in the pve-http-server repo after the above
> mentioned changes.
> 

You do not necesarrily need to send it out as its own patch, IMO this
would be still benefit from being grouped in a series with the other changes
that are related to the overall thing you want to achieve.

As mentioned in the review, it's totally fine if you do not actually do
the breaks, but you should be aware of the need for it and also mention
it to ensure a maintainer does not forgets on actually applying + bumping.

>  PVE/API2/Storage/Status.pm | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/PVE/API2/Storage/Status.pm b/PVE/API2/Storage/Status.pm
> index 72fd851..9275d1f 100644
> --- a/PVE/API2/Storage/Status.pm
> +++ b/PVE/API2/Storage/Status.pm
> @@ -478,6 +478,7 @@ __PACKAGE__->register_method ({
>  	    print "command: " . join(' ', @$cmd) . "\n";
>  
>  	    eval { PVE::Tools::run_command($cmd, errmsg => 'import failed'); };
> +	    unlink $tmpfilename;

error handling still missing for the unlink. As unlink returns the files actually
unlinked (it accepts a list) it's easy to do for the single-file case:

unlink $tmpfilename or warn "bla - $!\n";


>  	    if (my $err = $@) {
>  		unlink $dest;
>  		die $err;
> 





      reply	other threads:[~2021-07-21 14:51 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-21 12:52 Lorenz Stechauner
2021-07-21 14:51 ` Thomas Lamprecht [this message]

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=9bca870e-c601-3905-fb14-f3b6acef1385@proxmox.com \
    --to=t.lamprecht@proxmox.com \
    --cc=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
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal