From: "Fabian Grünbichler" <f.gruenbichler@proxmox.com>
To: Proxmox VE development discussion <pve-devel@lists.proxmox.com>
Subject: Re: [pve-devel] [PATCH v6 storage] Optionally allow blockdev in abs_filesystem_path
Date: Mon, 15 Mar 2021 10:25:54 +0100 [thread overview]
Message-ID: <1615546537.wzwar6nrpb.astroid@nora.none> (raw)
In-Reply-To: <<20210309104318.317454-1-d.jaeger@proxmox.com>
On March 9, 2021 11:43 am, Dominic Jäger wrote:
> This is required to import from LVM storages
>
> Signed-off-by: Dominic Jäger <d.jaeger@proxmox.com>
> ---
> v5->v6: unchanged
>
> PVE/Storage.pm | 9 ++++++---
> 1 file changed, 6 insertions(+), 3 deletions(-)
>
> diff --git a/PVE/Storage.pm b/PVE/Storage.pm
> index 8ee2c92..7c2e24e 100755
> --- a/PVE/Storage.pm
> +++ b/PVE/Storage.pm
> @@ -609,7 +609,7 @@ sub path {
> }
>
> sub abs_filesystem_path {
> - my ($cfg, $volid) = @_;
> + my ($cfg, $volid, $allowBlockdev) = @_;
that's not how we name perl variables..
>
> my $path;
> if (parse_volume_id ($volid, 1)) {
> @@ -623,8 +623,11 @@ sub abs_filesystem_path {
> }
> }
> }
> -
> - die "can't find file '$volid'\n" if !($path && -f $path);
> + if ($allowBlockdev) {
> + die "can't find file '$volid'\n" if !($path && (-f $path || -b $path));
> + } else {
> + die "can't find file '$volid'\n" if !($path && -f $path);
> + }
this could easily still be a single if:
die "can't find file '$volid'\n"
if !($path && -f $path) && !($path && $allow_block_dev && -b $path);
or some other transformation of the condition, like
if !$path || !(-f $path || ($allow_block_dev && -b $path))
or
if !($path && (-f $path || ($allow_block_dev && -b $path)))
>
> return $path;
> }
> --
> 2.20.1
>
>
> _______________________________________________
> pve-devel mailing list
> pve-devel@lists.proxmox.com
> https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
>
prev parent reply other threads:[~2021-03-15 9:26 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-09 10:43 Dominic Jäger
2021-03-09 10:43 ` [pve-devel] [PATCH v6 qemu-server] Add API for import wizards Dominic Jäger
[not found] ` <<20210309104318.317454-2-d.jaeger@proxmox.com>
2021-03-15 9:25 ` Fabian Grünbichler
2021-03-09 10:43 ` [pve-devel] [PATCH v6 manager] gui: Add import for disk & VM Dominic Jäger
[not found] ` <<20210309104318.317454-1-d.jaeger@proxmox.com>
2021-03-15 9:25 ` 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=1615546537.wzwar6nrpb.astroid@nora.none \
--to=f.gruenbichler@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