[pve-devel] [PATCH v4 manager 1/4] cluster resources: include content type for storages

Fabian Ebner f.ebner at proxmox.com
Wed Nov 18 11:04:17 CET 2020


Signed-off-by: Fabian Ebner <f.ebner at proxmox.com>
---

New in v4

 PVE/API2/Cluster.pm | 6 ++++++
 PVE/API2Tools.pm    | 4 ++++
 2 files changed, 10 insertions(+)

diff --git a/PVE/API2/Cluster.pm b/PVE/API2/Cluster.pm
index e768cbc6..8eb913b6 100644
--- a/PVE/API2/Cluster.pm
+++ b/PVE/API2/Cluster.pm
@@ -282,6 +282,12 @@ __PACKAGE__->register_method({
 		    optional => 1,
 		    renderer => 'bytes',
 		},
+		content => {
+		    description => "Allowed storage content types (when type == storage).",
+		    type => 'string',
+		    format => 'pve-storage-content-list',
+		    optional => 1,
+		},
 	    },
 	},
     },
diff --git a/PVE/API2Tools.pm b/PVE/API2Tools.pm
index b90c5488..3e2626ae 100644
--- a/PVE/API2Tools.pm
+++ b/PVE/API2Tools.pm
@@ -14,6 +14,7 @@ use Digest::MD5 qw(md5_hex);
 use URI;
 use URI::Escape;
 use PVE::SafeSyslog;
+use PVE::Storage::Plugin;
 
 my $hwaddress;
 
@@ -120,6 +121,8 @@ sub extract_vm_stats {
 sub extract_storage_stats {
     my ($storeid, $scfg, $node, $rrd) = @_;
 
+    my $content = PVE::Storage::Plugin::content_hash_to_string($scfg->{content});
+
     my $entry = {
 	id => "storage/$node/$storeid",
 	storage => $storeid,
@@ -127,6 +130,7 @@ sub extract_storage_stats {
 	type => 'storage',
 	status => 'unknown',
 	shared => $scfg->{shared} || 0,
+	content => $content,
     };
 
     if (my $d = $rrd->{"pve2-storage/$node/$storeid"}) {
-- 
2.20.1






More information about the pve-devel mailing list