From c61e609eb6917beb9fdcc30138be6e2c56df87fb Mon Sep 17 00:00:00 2001 From: Thomas Lamprecht Date: Sat, 17 Jun 2023 12:41:46 +0200 Subject: [PATCH] fix #4785: avoid overly noisy mkdir deprecation warning for now Move the warning over to creating and updating storage configs, which is much less noisy as the constantly called activate storage (e.g., pvestatd). Signed-off-by: Thomas Lamprecht --- src/PVE/API2/Storage/Config.pm | 10 ++++++++++ src/PVE/Storage/Plugin.pm | 4 ++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/PVE/API2/Storage/Config.pm b/src/PVE/API2/Storage/Config.pm index 0716916..e04b6ab 100755 --- a/src/PVE/API2/Storage/Config.pm +++ b/src/PVE/API2/Storage/Config.pm @@ -256,6 +256,11 @@ __PACKAGE__->register_method ({ $returned_config = $plugin->on_add_hook($storeid, $opts, %$sensitive); + if (defined($opts->{mkdir})) { # TODO: remove complete option in Proxmox VE 9 + warn "NOTE: The 'mkdir' option set for '${storeid}' is deprecated and will be removed" + ." in Proxmox VE 9. Use 'create-base-path' or 'create-subdirs' instead.\n" + } + eval { # try to activate if enabled on local node, # we only do this to detect errors/problems sooner @@ -363,6 +368,11 @@ __PACKAGE__->register_method ({ $scfg->{$k} = $opts->{$k}; } + if (defined($scfg->{mkdir})) { # TODO: remove complete option in Proxmox VE 9 + warn "NOTE: The 'mkdir' option set for '${storeid}' is deprecated and will be removed" + ." in Proxmox VE 9. Use 'create-base-path' or 'create-subdirs' instead.\n" + } + PVE::Storage::write_config($cfg); }, "update storage failed"); diff --git a/src/PVE/Storage/Plugin.pm b/src/PVE/Storage/Plugin.pm index 3f9f1ec..9d3b1ae 100644 --- a/src/PVE/Storage/Plugin.pm +++ b/src/PVE/Storage/Plugin.pm @@ -1369,8 +1369,8 @@ sub activate_storage { "directory '$path' does not exist or is unreachable\n"; } - warn "${storeid}: 'mkdir' option is deprecated. Use 'create-base-path' or 'create-subdirs' instead.\n" - if defined($scfg->{mkdir}); + # TODO: mkdir is basically deprecated since 8.0, but we don't warn here until 8.4 or 9.0, as we + # only got the replacement in 8.0, so no real replacement window, and its really noisy. if (defined($scfg->{content})) { # (opt-out) create content dirs and check validity