all lists on lists.proxmox.com
 help / color / mirror / Atom feed
From: Leo Nunner <l.nunner@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH v2 qemu-server] feature #3937: config: store user in meta property
Date: Wed,  1 Mar 2023 14:27:05 +0100	[thread overview]
Message-ID: <20230301132705.151922-4-l.nunner@proxmox.com> (raw)
In-Reply-To: <20230301132705.151922-1-l.nunner@proxmox.com>

Adds a field to the "meta" config property which stores the user who
created the VM.

Signed-off-by: Leo Nunner <l.nunner@proxmox.com>
---
 PVE/QemuServer.pm | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm
index 40be44d..0a7a6b0 100644
--- a/PVE/QemuServer.pm
+++ b/PVE/QemuServer.pm
@@ -287,6 +287,11 @@ my $meta_info_fmt = {
 	pattern => '\d+(\.\d+)+',
 	optional => 1,
     },
+    'creation-user' => {
+	type => 'string',
+	description => "The user who created the VM.",
+	optional => 1,
+    },
 };
 
 my $confdesc = {
@@ -2205,10 +2210,13 @@ sub parse_meta_info {
 sub new_meta_info_string {
     my () = @_; # for now do not allow to override any value
 
+    my $rpcenv = PVE::RPCEnvironment->get();
+
     return PVE::JSONSchema::print_property_string(
 	{
 	    'creation-qemu' => kvm_user_version(),
 	    ctime => "". int(time()),
+	    'creation-user' => $rpcenv->get_user(),
 	},
 	$meta_info_fmt
     );
-- 
2.30.2





      parent reply	other threads:[~2023-03-01 13:27 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-01 13:27 [pve-devel] [PATCH v2 container " Leo Nunner
2023-03-01 13:27 ` [pve-devel] [PATCH v2 container 1/2] cleanup: json config: factor out ignored properties into hash Leo Nunner
2023-03-01 13:27 ` [pve-devel] [PATCH v2 container 2/2] feature #3937: config: introduce meta property Leo Nunner
2023-03-01 13:27 ` Leo Nunner [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230301132705.151922-4-l.nunner@proxmox.com \
    --to=l.nunner@proxmox.com \
    --cc=pve-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal