From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) by lore.proxmox.com (Postfix) with ESMTPS id 9DB041FF2F6 for ; Wed, 29 May 2024 12:08:51 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 2E3812932; Wed, 29 May 2024 12:09:15 +0200 (CEST) Date: Wed, 29 May 2024 12:09:07 +0200 From: Fabian =?iso-8859-1?q?Gr=FCnbichler?= To: Proxmox VE development discussion References: <20240529092055.1205099-1-d.csapak@proxmox.com> In-Reply-To: <20240529092055.1205099-1-d.csapak@proxmox.com> MIME-Version: 1.0 User-Agent: astroid/0.16.0 (https://github.com/astroidmail/astroid) Message-Id: <1716977179.8f9c3dt69m.astroid@yuna.none> X-SPAM-LEVEL: Spam detection results: 0 AWL 0.059 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record T_SCC_BODY_TEXT_LINE -0.01 - URIBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [proxmox.com, qemu.pm] Subject: Re: [pve-devel] [PATCH qemu-server] api: snapshot create/delete/rollback: print log line that mentions snapshot name X-BeenThere: pve-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox VE development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Proxmox VE development discussion Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: pve-devel-bounces@lists.proxmox.com Sender: "pve-devel" On May 29, 2024 11:20 am, Dominik Csapak wrote: > so that an admin can see from the task logs which snapshot was rolled > back/created/removed without the need to look into the journal (to which > the admin might not have access to). good idea in general, but wouldn't it be better to log it before attempting the operation, so that the context is in the task log irrespective of how a potential error message looks like? (side note, we might want to think about making the whole snapshot process a bit more verbose? i.e., log the individual parts as well?) > > Signed-off-by: Dominik Csapak > --- > noticed while trying to find out, to which snapshot a vm was rolled back > to on a host where i don't have access to the syslog ;) > > PVE/API2/Qemu.pm | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/PVE/API2/Qemu.pm b/PVE/API2/Qemu.pm > index 2a1d4d79..903c60a4 100644 > --- a/PVE/API2/Qemu.pm > +++ b/PVE/API2/Qemu.pm > @@ -5196,6 +5196,7 @@ __PACKAGE__->register_method({ > PVE::Cluster::log_msg('info', $authuser, "snapshot VM $vmid: $snapname"); > PVE::QemuConfig->snapshot_create($vmid, $snapname, $param->{vmstate}, > $param->{description}); > + print "Created snapshot '$snapname'.\n"; > }; > > return $rpcenv->fork_worker('qmsnapshot', $vmid, $authuser, $realcmd); > @@ -5376,6 +5377,7 @@ __PACKAGE__->register_method({ > my $realcmd = sub { > PVE::Cluster::log_msg('info', $authuser, "rollback snapshot VM $vmid: $snapname"); > PVE::QemuConfig->snapshot_rollback($vmid, $snapname); > + print "Rolled back to snapshot '$snapname'.\n"; > > if ($param->{start} && !PVE::QemuServer::Helpers::vm_running_locally($vmid)) { > PVE::API2::Qemu->vm_start({ vmid => $vmid, node => $node }); > @@ -5435,6 +5437,7 @@ __PACKAGE__->register_method({ > $lock_obtained = 1; > PVE::Cluster::log_msg('info', $authuser, "delete snapshot VM $vmid: $snapname"); > PVE::QemuConfig->snapshot_delete($vmid, $snapname, $param->{force}); > + print "Removed snapshot '$snapname'.\n"; > }; > > my $realcmd = sub { > -- > 2.39.2 > > > > _______________________________________________ > pve-devel mailing list > pve-devel@lists.proxmox.com > https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel > > > _______________________________________________ pve-devel mailing list pve-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel