[pve-devel] [RFC v1 pve-storage 4/6] plugin: replace fixme comments for deprecated methods with attribute

Max Carrara m.carrara at proxmox.com
Thu Jan 30 15:51:22 CET 2025


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 at 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





More information about the pve-devel mailing list