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

Dominik Csapak d.csapak at proxmox.com
Thu Oct 31 13:36:25 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>
---
 PVE/API2/Qemu.pm  |  1 +
 PVE/QemuServer.pm | 14 +++++++++++++-
 2 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/PVE/API2/Qemu.pm b/PVE/API2/Qemu.pm
index b2c0b0d..6ac557f 100644
--- a/PVE/API2/Qemu.pm
+++ b/PVE/API2/Qemu.pm
@@ -280,6 +280,7 @@ my $generaloptions = {
     'startup' => 1,
     'tdf' => 1,
     'template' => 1,
+    'tags' => 1,
 };
 
 my $vmpoweroptions = {
diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm
index bfe6662..18a802b 100644
--- a/PVE/QemuServer.pm
+++ b/PVE/QemuServer.pm
@@ -700,6 +700,11 @@ EODESCR
 	description => "Configure additional enhancements for SPICE.",
 	optional => 1
     },
+    tags => {
+	type => 'string', format => 'pve-tag-list',
+	description => 'Tags of the VM. This is only meta information.',
+	optional => 1,
+    },
 };
 
 my $cicustom_fmt = {
@@ -3107,7 +3112,12 @@ 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,
+    },
 };
 
 my $last_proc_pid_stat;
@@ -3178,6 +3188,7 @@ sub vmstatus {
 
 	$d->{serial} = 1 if conf_has_serial($conf);
 	$d->{lock} = $conf->{lock} if $conf->{lock};
+	$d->{tags} = $conf->{tags} if defined($conf->{tags});
 
 	$res->{$vmid} = $d;
     }
@@ -4805,6 +4816,7 @@ my $fast_plug_option = {
     'protection' => 1,
     'vmstatestorage' => 1,
     'hookscript' => 1,
+    'tags' => 1,
 };
 
 # hotplug changes in [PENDING]
-- 
2.20.1





More information about the pve-devel mailing list