all lists on lists.proxmox.com
 help / color / mirror / Atom feed
From: "Fabian Grünbichler" <f.gruenbichler@proxmox.com>
To: Gabriel Goller <g.goller@proxmox.com>, pbs-devel@lists.proxmox.com
Subject: [pbs-devel] applied: [PATCH proxmox-backup v2] fix: allow datastore creation in directory with lost+found directory
Date: Fri, 22 Nov 2024 09:08:01 +0100	[thread overview]
Message-ID: <173226288122.2118190.4517531377570129879@yuna.proxmox.com> (raw)
In-Reply-To: <20241120105505.238476-1-g.goller@proxmox.com>

with a slight style change by pulling out the `to_str()` into its own line, to
reduce the total number of lines ;)

Quoting Gabriel Goller (2024-11-20 11:55:05)
> When creating a datastore without the "reuse-datastore" option and the
> datastore contains a `lost+found` directory (which is quite common), the
> creation fails. Add `lost+found` to the ignore list.
> 
> Reported here: https://forum.proxmox.com/threads/bug-when-adding-new-storage-task-error-datastore-path-is-not-empty.157629/#post-721733
> 
> Fixes: 6e101ff75777 ("fix #5439: allow to reuse existing datastore")
> Signed-off-by: Gabriel Goller <g.goller@proxmox.com>
> ---
> 
> v2, thanks @Fiona:
>  - exact match with == instead of `.starts_with`
> 
>  src/api2/config/datastore.rs | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/src/api2/config/datastore.rs b/src/api2/config/datastore.rs
> index 374c302fcf28..9c36cb312a99 100644
> --- a/src/api2/config/datastore.rs
> +++ b/src/api2/config/datastore.rs
> @@ -89,7 +89,10 @@ pub(crate) fn do_create_datastore(
>          if let Ok(dir) = std::fs::read_dir(&path) {
>              for file in dir {
>                  let name = file?.file_name();
> -                if !name.to_str().map_or(false, |name| name.starts_with('.')) {
> +                if !name
> +                    .to_str()
> +                    .map_or(false, |name| name.starts_with('.') || name == "lost+found")
> +                {
>                      bail!("datastore path is not empty");
>                  }
>              }
> -- 
> 2.39.5
> 
> 
> 
> _______________________________________________
> pbs-devel mailing list
> pbs-devel@lists.proxmox.com
> https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel
> 
>


_______________________________________________
pbs-devel mailing list
pbs-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel


      reply	other threads:[~2024-11-22  8:07 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-20 10:55 [pbs-devel] " Gabriel Goller
2024-11-22  8:08 ` Fabian Grünbichler [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=173226288122.2118190.4517531377570129879@yuna.proxmox.com \
    --to=f.gruenbichler@proxmox.com \
    --cc=g.goller@proxmox.com \
    --cc=pbs-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 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