[pve-devel] [PATCH container v3 1/1] add 'tags' option

Dominik Csapak d.csapak at proxmox.com
Thu Oct 31 13:36:26 CET 2019


this is useful as meta information for e.g., provisioning or config
management systems

adding the info also to the 'status' api call to make it easier to show
it in the gui

Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
thanks @oguz for including this already in the 'fastplug' options

 src/PVE/LXC.pm        | 6 ++++++
 src/PVE/LXC/Config.pm | 5 +++++
 2 files changed, 11 insertions(+)

diff --git a/src/PVE/LXC.pm b/src/PVE/LXC.pm
index cdf6d64..0eeca14 100644
--- a/src/PVE/LXC.pm
+++ b/src/PVE/LXC.pm
@@ -159,6 +159,11 @@ our $vmstatus_return_properties = {
 	description => "The current config lock, if any.",
 	type => 'string',
 	optional => 1,
+    },
+    tags => {
+	description => "The current configured tags, if any.",
+	type => 'string',
+	optional => 1,
     }
 };
 
@@ -198,6 +203,7 @@ sub vmstatus {
 	$d->{cpus} = $cpucount if !$d->{cpus};
 
 	$d->{lock} = $conf->{lock} || '';
+	$d->{tags} = $conf->{tags} if defined($conf->{tags});
 
 	if ($d->{pid}) {
 	    my $res = get_container_disk_usage($vmid, $d->{pid});
diff --git a/src/PVE/LXC/Config.pm b/src/PVE/LXC/Config.pm
index fc2f86a..023a91f 100644
--- a/src/PVE/LXC/Config.pm
+++ b/src/PVE/LXC/Config.pm
@@ -473,6 +473,11 @@ my $confdesc = {
 	format => 'pve-volume-id',
 	description => 'Script that will be exectued during various steps in the containers lifetime.',
     },
+    tags => {
+	type => 'string', format => 'pve-tag-list',
+	description => 'Tags of the Container. This is only meta information.',
+	optional => 1,
+    },
 };
 
 my $valid_lxc_conf_keys = {
-- 
2.20.1





More information about the pve-devel mailing list