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

Dominik Csapak d.csapak at proxmox.com
Tue Sep 10 14:57:15 CEST 2019


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

Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
 src/PVE/LXC/Config.pm | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/src/PVE/LXC/Config.pm b/src/PVE/LXC/Config.pm
index 9790345..2a67e7f 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 = {
@@ -910,7 +915,7 @@ sub update_pct_config {
 		delete $conf->{$opt};
 		PVE::LXC::write_cgroup_value("memory", $vmid,
 					     "memory.memsw.limit_in_bytes", -1);
-	    } elsif ($opt eq 'description' || $opt eq 'onboot' || $opt eq 'startup' || $opt eq 'hookscript') {
+	    } elsif ($opt eq 'description' || $opt eq 'onboot' || $opt eq 'startup' || $opt eq 'hookscript' || $opt eq 'tags') {
 		delete $conf->{$opt};
 	    } elsif ($opt eq 'nameserver' || $opt eq 'searchdomain' ||
 		     $opt eq 'tty' || $opt eq 'console' || $opt eq 'cmode') {
@@ -1045,7 +1050,7 @@ sub update_pct_config {
 	} elsif ($opt eq 'cpuunits') {
 	    $conf->{$opt} = $value;
 	    PVE::LXC::write_cgroup_value("cpu", $vmid, "cpu.shares", $value);
-	} elsif ($opt eq 'description') {
+	} elsif ($opt eq 'description' || $opt eq 'tags') {
 	    $conf->{$opt} = $value;
 	} elsif ($opt =~ m/^net(\d+)$/) {
 	    my $netid = $1;
-- 
2.20.1





More information about the pve-devel mailing list