From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: <pve-devel-bounces@lists.proxmox.com> Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) by lore.proxmox.com (Postfix) with ESMTPS id 0161C1FF16F for <inbox@lore.proxmox.com>; Thu, 30 Jan 2025 15:51:52 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id DB92215293; Thu, 30 Jan 2025 15:51:36 +0100 (CET) From: Max Carrara <m.carrara@proxmox.com> To: pve-devel@lists.proxmox.com Date: Thu, 30 Jan 2025 15:51:22 +0100 Message-Id: <20250130145124.317745-5-m.carrara@proxmox.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250130145124.317745-1-m.carrara@proxmox.com> References: <20250130145124.317745-1-m.carrara@proxmox.com> MIME-Version: 1.0 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.064 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Subject: [pve-devel] [RFC v1 pve-storage 4/6] plugin: replace fixme comments for deprecated methods with attribute X-BeenThere: pve-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox VE development discussion <pve-devel.lists.proxmox.com> List-Unsubscribe: <https://lists.proxmox.com/cgi-bin/mailman/options/pve-devel>, <mailto:pve-devel-request@lists.proxmox.com?subject=unsubscribe> List-Archive: <http://lists.proxmox.com/pipermail/pve-devel/> List-Post: <mailto:pve-devel@lists.proxmox.com> List-Help: <mailto:pve-devel-request@lists.proxmox.com?subject=help> List-Subscribe: <https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel>, <mailto:pve-devel-request@lists.proxmox.com?subject=subscribe> Reply-To: Proxmox VE development discussion <pve-devel@lists.proxmox.com> Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: pve-devel-bounces@lists.proxmox.com Sender: "pve-devel" <pve-devel-bounces@lists.proxmox.com> This makes it so that the `get_volume_notes` and `update_volume_notes` methods use the previously introduced `prohibitOverrideAt` attribute handler instead of relying on FIXME comments. Because the comments originally said to "remove on the next APIAGE reset", the `version` for the two attributes is set to 10 (the current APIVER). This means that compilation will fail as soon as APIAGE is reset to 0 (or APIVER is bumped without bumping APIAGE). This can be tested by running `make test` inside the `src/` directory of the repository. Without changing the APIAGE, warnings will be emitted. Setting the APIAGE to 0 and then running `make test` again will throw an exception before running any other code. Signed-off-by: Max Carrara <m.carrara@proxmox.com> --- src/PVE/Storage/CIFSPlugin.pm | 4 ---- src/PVE/Storage/CephFSPlugin.pm | 4 ---- src/PVE/Storage/DirPlugin.pm | 5 +---- src/PVE/Storage/NFSPlugin.pm | 4 ---- src/PVE/Storage/PBSPlugin.pm | 4 ---- src/PVE/Storage/Plugin.pm | 14 ++++++++------ 6 files changed, 9 insertions(+), 26 deletions(-) diff --git a/src/PVE/Storage/CIFSPlugin.pm b/src/PVE/Storage/CIFSPlugin.pm index 475065a..89a9981 100644 --- a/src/PVE/Storage/CIFSPlugin.pm +++ b/src/PVE/Storage/CIFSPlugin.pm @@ -292,15 +292,11 @@ sub check_connection { return 1; } -# FIXME remove on the next APIAGE reset. -# Deprecated, use get_volume_attribute instead. sub get_volume_notes { my $class = shift; PVE::Storage::DirPlugin::get_volume_notes($class, @_); } -# FIXME remove on the next APIAGE reset. -# Deprecated, use update_volume_attribute instead. sub update_volume_notes { my $class = shift; PVE::Storage::DirPlugin::update_volume_notes($class, @_); diff --git a/src/PVE/Storage/CephFSPlugin.pm b/src/PVE/Storage/CephFSPlugin.pm index 36c64ea..934ba8b 100644 --- a/src/PVE/Storage/CephFSPlugin.pm +++ b/src/PVE/Storage/CephFSPlugin.pm @@ -239,15 +239,11 @@ sub deactivate_storage { } } -# FIXME remove on the next APIAGE reset. -# Deprecated, use get_volume_attribute instead. sub get_volume_notes { my $class = shift; PVE::Storage::DirPlugin::get_volume_notes($class, @_); } -# FIXME remove on the next APIAGE reset. -# Deprecated, use update_volume_attribute instead. sub update_volume_notes { my $class = shift; PVE::Storage::DirPlugin::update_volume_notes($class, @_); diff --git a/src/PVE/Storage/DirPlugin.pm b/src/PVE/Storage/DirPlugin.pm index fb23e0a..79c7a94 100644 --- a/src/PVE/Storage/DirPlugin.pm +++ b/src/PVE/Storage/DirPlugin.pm @@ -9,6 +9,7 @@ use File::Path; use IO::File; use POSIX; +use PVE::Storage::Version; use PVE::Storage::Plugin; use PVE::GuestImport::OVF; use PVE::JSONSchema qw(get_standard_option); @@ -127,8 +128,6 @@ my $get_volume_notes_impl = sub { return ''; }; -# FIXME remove on the next APIAGE reset. -# Deprecated, use get_volume_attribute instead. sub get_volume_notes { my ($class, $scfg, $storeid, $volname, $timeout) = @_; return $get_volume_notes_impl->($class, $scfg, $storeid, $volname, $timeout); @@ -153,8 +152,6 @@ my $update_volume_notes_impl = sub { return; }; -# FIXME remove on the next APIAGE reset. -# Deprecated, use update_volume_attribute instead. sub update_volume_notes { my ($class, $scfg, $storeid, $volname, $notes, $timeout) = @_; return $update_volume_notes_impl->($class, $scfg, $storeid, $volname, $notes, $timeout); diff --git a/src/PVE/Storage/NFSPlugin.pm b/src/PVE/Storage/NFSPlugin.pm index 72e9c6d..0dfdc95 100644 --- a/src/PVE/Storage/NFSPlugin.pm +++ b/src/PVE/Storage/NFSPlugin.pm @@ -201,15 +201,11 @@ sub check_connection { return 1; } -# FIXME remove on the next APIAGE reset. -# Deprecated, use get_volume_attribute instead. sub get_volume_notes { my $class = shift; PVE::Storage::DirPlugin::get_volume_notes($class, @_); } -# FIXME remove on the next APIAGE reset. -# Deprecated, use update_volume_attribute instead. sub update_volume_notes { my $class = shift; PVE::Storage::DirPlugin::update_volume_notes($class, @_); diff --git a/src/PVE/Storage/PBSPlugin.pm b/src/PVE/Storage/PBSPlugin.pm index 0808bcc..f0f1b06 100644 --- a/src/PVE/Storage/PBSPlugin.pm +++ b/src/PVE/Storage/PBSPlugin.pm @@ -850,8 +850,6 @@ sub deactivate_volume { return 1; } -# FIXME remove on the next APIAGE reset. -# Deprecated, use get_volume_attribute instead. sub get_volume_notes { my ($class, $scfg, $storeid, $volname, $timeout) = @_; @@ -862,8 +860,6 @@ sub get_volume_notes { return $data->{notes}; } -# FIXME remove on the next APIAGE reset. -# Deprecated, use update_volume_attribute instead. sub update_volume_notes { my ($class, $scfg, $storeid, $volname, $notes, $timeout) = @_; diff --git a/src/PVE/Storage/Plugin.pm b/src/PVE/Storage/Plugin.pm index bcc4eea..0c80859 100644 --- a/src/PVE/Storage/Plugin.pm +++ b/src/PVE/Storage/Plugin.pm @@ -1217,17 +1217,19 @@ sub file_size_info { return wantarray ? ($size, $format, $used, $parent, $st->ctime) : $size; } -# FIXME remove on the next APIAGE reset. -# Deprecated, use get_volume_attribute instead. -sub get_volume_notes { +sub get_volume_notes : prohibitOverrideAt( + version => 10, + message => "Deprecated, use get_volume_attribute instead." +) { my ($class, $scfg, $storeid, $volname, $timeout) = @_; die "volume notes are not supported for $class"; } -# FIXME remove on the next APIAGE reset. -# Deprecated, use update_volume_attribute instead. -sub update_volume_notes { +sub update_volume_notes : prohibitOverrideAt( + version => 10, + message => "Deprecated, use update_volume_attribute instead.", +) { my ($class, $scfg, $storeid, $volname, $notes, $timeout) = @_; die "volume notes are not supported for $class"; -- 2.39.5 _______________________________________________ pve-devel mailing list pve-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel