From: "Fabian Grünbichler" <f.gruenbichler@proxmox.com>
To: Proxmox VE development discussion <pve-devel@lists.proxmox.com>
Subject: [pve-devel] applied: [PATCH v2 pve-manager 08/11] ceph: fix edge case of wrong files being deleted on purge
Date: Mon, 12 Feb 2024 14:33:55 +0100 [thread overview]
Message-ID: <1707743179.h1hwhq5mx5.astroid@yuna.none> (raw)
In-Reply-To: <20240205175419.1271680-9-m.carrara@proxmox.com>
applied this one with a small style follow-up:
diff --git a/PVE/Ceph/Tools.pm b/PVE/Ceph/Tools.pm
index 273a3eb63..ee6c515cb 100644
--- a/PVE/Ceph/Tools.pm
+++ b/PVE/Ceph/Tools.pm
@@ -87,10 +87,7 @@ sub get_cluster_versions {
sub get_config {
my $key = shift;
- my $value = $config_values->{$key};
- if (! defined($value)) {
- $value = $config_files->{$key};
- }
+ my $value = $config_values->{$key} // $config_files->{$key};
die "no such ceph config '$key'" if ! defined($value);
On February 5, 2024 6:54 pm, Max Carrara wrote:
> Having a file named e.g. "60" in your current directory will cause it
> to be deleted when executing `pveceph purge`. This commit fixes that
> by making the config hash differ between which values represent file
> paths and which don't.
>
> Signed-off-by: Max Carrara <m.carrara@proxmox.com>
> ---
> Changes v1 --> v2:as
> * use two hashes instead of one large nested hash to differ between
> config values that correspond to files and adapt surrounding logic
> correspondingly
>
> PVE/Ceph/Tools.pm | 18 ++++++++++++------
> 1 file changed, 12 insertions(+), 6 deletions(-)
>
> diff --git a/PVE/Ceph/Tools.pm b/PVE/Ceph/Tools.pm
> index a1458b40..273a3eb6 100644
> --- a/PVE/Ceph/Tools.pm
> +++ b/PVE/Ceph/Tools.pm
> @@ -35,15 +35,18 @@ my $ceph_service = {
> ceph_volume => '/usr/sbin/ceph-volume',
> };
>
> -my $config_hash = {
> +my $config_values = {
> ccname => $ccname,
> + ceph_mds_data_dir => $ceph_mds_data_dir,
> + long_rados_timeout => 60,
> +};
> +
> +my $config_files = {
> pve_ceph_cfgpath => $pve_ceph_cfgpath,
> pve_mon_key_path => $pve_mon_key_path,
> pve_ckeyring_path => $pve_ckeyring_path,
> ceph_bootstrap_osd_keyring => $ceph_bootstrap_osd_keyring,
> ceph_bootstrap_mds_keyring => $ceph_bootstrap_mds_keyring,
> - ceph_mds_data_dir => $ceph_mds_data_dir,
> - long_rados_timeout => 60,
> ceph_cfgpath => $ceph_cfgpath,
> };
>
> @@ -84,9 +87,12 @@ sub get_cluster_versions {
> sub get_config {
> my $key = shift;
>
> - my $value = $config_hash->{$key};
> + my $value = $config_values->{$key};
> + if (! defined($value)) {
> + $value = $config_files->{$key};
> + }
>
> - die "no such ceph config '$key'" if !$value;
> + die "no such ceph config '$key'" if ! defined($value);
>
> return $value;
> }
> @@ -123,7 +129,7 @@ sub purge_all_ceph_files {
> warn "Foreign MON address in ceph.conf. Keeping config & keyrings\n"
> } else {
> print "Removing config & keyring files\n";
> - foreach my $file (%$config_hash) {
> + for my $file (%$config_files) {
> unlink $file if (-e $file);
> }
> }
> --
> 2.39.2
>
>
>
> _______________________________________________
> pve-devel mailing list
> pve-devel@lists.proxmox.com
> https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
>
>
>
next prev parent reply other threads:[~2024-02-12 13:34 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-05 17:54 [pve-devel] [PATCH v2 master ceph, quincy-stable 8 ceph, pve-storage, pve-manager 00/11] Fix #4759: Configure Permissions for ceph-crash.service Max Carrara
2024-02-05 17:54 ` [pve-devel] [PATCH v2 master ceph 01/11] debian: add patch to fix ceph crash dir permissions in postinst hook Max Carrara
2024-02-12 13:32 ` Fabian Grünbichler
2024-02-13 8:25 ` Max Carrara
2024-02-05 17:54 ` [pve-devel] [PATCH v2 master ceph 02/11] patches: add patch that reorders clients used by ceph-crash Max Carrara
2024-02-12 13:33 ` Fabian Grünbichler
2024-02-05 17:54 ` [pve-devel] [PATCH v2 quincy-stable-8 ceph 03/11] debian: add patch to fix ceph crash dir permissions in postinst hook Max Carrara
2024-02-12 13:32 ` Fabian Grünbichler
2024-02-05 17:54 ` [pve-devel] [PATCH v2 quincy-stable-8 ceph 04/11] patches: add patch that reorders clients used by ceph-crash Max Carrara
2024-02-12 13:33 ` Fabian Grünbichler
2024-02-05 17:54 ` [pve-devel] [PATCH v2 pve-storage 05/11] cephconfig: align our parser more with Ceph's parser Max Carrara
2024-02-12 13:33 ` Fabian Grünbichler
2024-02-13 8:34 ` Max Carrara
2024-02-05 17:54 ` [pve-devel] [PATCH v2 pve-storage 06/11] cephconfig: allow writing arbitrary sections Max Carrara
2024-02-12 13:33 ` Fabian Grünbichler
2024-02-13 8:46 ` Max Carrara
2024-02-05 17:54 ` [pve-devel] [PATCH v2 pve-storage 07/11] amend! " Max Carrara
2024-02-12 13:33 ` Fabian Grünbichler
2024-02-13 8:50 ` Max Carrara
2024-02-05 17:54 ` [pve-devel] [PATCH v2 pve-manager 08/11] ceph: fix edge case of wrong files being deleted on purge Max Carrara
2024-02-12 13:33 ` Fabian Grünbichler [this message]
2024-02-05 17:54 ` [pve-devel] [PATCH v2 pve-manager 09/11] fix #4759: ceph: configure keyring for ceph-crash.service Max Carrara
2024-02-12 13:34 ` Fabian Grünbichler
2024-02-13 9:09 ` Max Carrara
2024-02-14 12:43 ` Max Carrara
2024-02-05 17:54 ` [pve-devel] [PATCH v2 pve-manager 10/11] ceph: create '/etc/pve/ceph' during `pveceph init` Max Carrara
2024-02-05 17:54 ` [pve-devel] [PATCH v2 pve-manager 11/11] fix #4759: debian/postinst: configure ceph-crash.service and its key Max Carrara
2024-02-12 13:34 ` Fabian Grünbichler
2024-02-13 9:25 ` Max Carrara
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=1707743179.h1hwhq5mx5.astroid@yuna.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