all lists on 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>,
	Aaron Lauterer <a.lauterer@proxmox.com>
Subject: [pve-devel] applied: [PATCH v2 storage 2/3] rbd: fix #3286 add namespace support
Date: Mon, 12 Apr 2021 14:41:12 +0200	[thread overview]
Message-ID: <7e901844-fdae-afee-470d-7dde232e8a10@proxmox.com> (raw)
In-Reply-To: <20210407142218.29156-3-a.lauterer@proxmox.com>

On 07.04.21 16:22, Aaron Lauterer wrote:
> This patch introduces support for Cephs RBD namespaces.
> 
> A new storage config parameter 'namespace' defines the namespace to be
> used for the RBD storage.
> 
> The namespace must already exist in the Ceph cluster as it is not
> automatically created.
> 
> The main intention is to use this for external Ceph clusters. With
> namespaces, each PVE cluster can get its own namespace and will not
> conflict with other PVE clusters.
> 
> Signed-off-by: Aaron Lauterer <a.lauterer@proxmox.com>
> 
> ---
> v1 -> v2:
> use `defined` to check if a namespace if configured instead of
> evaluating the value which would wrongly evaluate to false if the pool
> would be called '0'. Thx @Thomas for pointing this out.
> 
> much less changes since the 'centralize rbd path concatenation' patch
> took care of most instances.
> 
> removed empty new lines that I did not catch in the previous version
> 
> rvc -> v1:
> add --namespace parameter centrally in sub $build_cmd. All commands
> except one (rbd unmap) support it. To handle commands that don't support
> it, a hash with them was introduced.
> 
> In a few places paths (FS, Ceph hierarchy) are needed. These are the
> places scattered throughout the plugin where the namespace is inserted
> if it is configured.
> 
>  PVE/Storage/RBDPlugin.pm | 19 +++++++++++++++++++
>  1 file changed, 19 insertions(+)
> 

applied, but addressed one little issue (see below). thanks!

> diff --git a/PVE/Storage/RBDPlugin.pm b/PVE/Storage/RBDPlugin.pm
> index 421539f..02950be 100644
> --- a/PVE/Storage/RBDPlugin.pm
> +++ b/PVE/Storage/RBDPlugin.pm
> @@ -25,6 +25,8 @@ my $get_parent_image_name = sub {
>  my $get_rbd_path = sub {
>      my ($scfg, $volume) = @_;
>      my $pool =  $scfg->{pool} ? $scfg->{pool} : 'rbd';
> +
> +    return "${pool}/$scfg->{namespace}/${volume}" if defined($scfg->{namespace});
>      return "${pool}/${volume}";
>  };
>  
> @@ -36,6 +38,14 @@ my $build_cmd = sub {
>  
>      my $cmd = [$binary, '-p', $pool];
>  
> +    # some subcommands will fail if the --namespace parameter is present
> +    my $no_namespace_parameter = {
> +	unmap => 1,
> +    };
> +
> +    push @$cmd, '--namespace', $scfg->{namespace}
> +	if ($scfg->{namespace} && !$no_namespace_parameter->{$op});

above check still failed for "falsy" namespace values, I fixed that in a follow-up

> +
>      push @$cmd, '-c', $cmd_option->{ceph_conf} if ($cmd_option->{ceph_conf});
>      push @$cmd, '-m', $cmd_option->{mon_host} if ($cmd_option->{mon_host});
>      push @$cmd, '--auth_supported', $cmd_option->{auth_supported} if ($cmd_option->{auth_supported});






  reply	other threads:[~2021-04-12 12:41 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-07 14:22 [pve-devel] [PATCH v2 storage 0/3] ceph: " Aaron Lauterer
2021-04-07 14:22 ` [pve-devel] [PATCH v2 storage 1/3] rbd: centralize rbd path concatenation Aaron Lauterer
2021-04-12 12:39   ` [pve-devel] applied: " Thomas Lamprecht
2021-04-07 14:22 ` [pve-devel] [PATCH v2 storage 2/3] rbd: fix #3286 add namespace support Aaron Lauterer
2021-04-12 12:41   ` Thomas Lamprecht [this message]
2021-04-07 14:22 ` [pve-devel] [PATCH v2 storage 3/3] rbd: add integration test for namespace handling Aaron Lauterer
2021-04-12 12:48   ` [pve-devel] applied: " 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=7e901844-fdae-afee-470d-7dde232e8a10@proxmox.com \
    --to=t.lamprecht@proxmox.com \
    --cc=a.lauterer@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 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