From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by lists.proxmox.com (Postfix) with ESMTPS id 3E318B8D2E for ; Wed, 6 Dec 2023 15:09:18 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 1B5FD2D8A for ; Wed, 6 Dec 2023 15:09:18 +0100 (CET) Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com [94.136.29.106]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by firstgate.proxmox.com (Proxmox) with ESMTPS for ; Wed, 6 Dec 2023 15:09:15 +0100 (CET) Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1]) by proxmox-new.maurer-it.com (Proxmox) with ESMTP id AFAE8425EE for ; Wed, 6 Dec 2023 15:09:15 +0100 (CET) Date: Wed, 6 Dec 2023 15:09:14 +0100 (CET) From: =?UTF-8?Q?Fabian_Gr=C3=BCnbichler?= To: Proxmox Backup Server development discussion , Christian Ebner Message-ID: <1776013681.1933.1701871754440@webmail.proxmox.com> In-Reply-To: <20231206113101.139743-1-c.ebner@proxmox.com> References: <20231206113101.139743-1-c.ebner@proxmox.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Priority: 3 Importance: Normal X-Mailer: Open-Xchange Mailer v7.10.6-Rev55 X-Originating-Client: open-xchange-appsuite X-SPAM-LEVEL: Spam detection results: 0 AWL 0.064 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. [me.store, result.data, proxmox.com] Subject: Re: [pbs-devel] [PATCH v3 proxmox-backup] ui: warn of missing gc-schedule, prune/verify jobs X-BeenThere: pbs-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox Backup Server development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Dec 2023 14:09:18 -0000 > Christian Ebner hat am 06.12.2023 12:31 CET geschrieben: > > Warn about a missing garbage collection schedule, prune job or verify > job configurations in the datastore's summary panel. > > Show the number of prune/verify job configurations, if there are jobs > configured. for all of them there are possible reasons for not having them set up: - verify: I trust my storage to protect me against bit rot, and I don't want to incur the performance penalty of doing a full verification just to ensure logical consistency - prune: I only do client-side pruning - prune+GC: this is an append-only backup storage, I never want to remove data all of those could be improved of course (logical-verification as a verify mode or new job type, changing the warning to information if a prune action was done recently, allowing an explicit "append-only" flag that actually disallows pruning, ..) all of them except for GC also don't take namespaces into account, but that might be harder to get right. there's another source of confusion if I am an unprivileged user - I might not "see" the jobs that are defined, and get a warning as a result, even though everything is okay. that last one *could* be tackled by leaking the count, even if not leaking the details, but I am not sure if we want to do that ;) for GC at least we could differentiate based on status code and make the user aware that unknown is for lack of privs. I'd also differentiate between "unknown because no request made/no response retrieved yet" and "unknown because request failed" - the latter case should be a "warning" as well (and ideally contain the error at least as tool tip?), and not "missing", except if we can match the failure to missing privileges.. > Signed-off-by: Christian Ebner > --- > changes since version 2: > - move message string initialization to controllers `init` function > > changes since version 1: > - add check mark icon for configured jobs/schedule > - add question mark icon for unknown configuration state > - fix typo in garbage collection variable name > - add missing trailing commas found by pve-eslint > - refactor message initialization to allow to use format helper > functions > www/datastore/Summary.js | 96 ++++++++++++++++++++++++++++++++++++++++ > 1 file changed, 96 insertions(+) > > diff --git a/www/datastore/Summary.js b/www/datastore/Summary.js > index a932b4e0..273a5bf0 100644 > --- a/www/datastore/Summary.js > +++ b/www/datastore/Summary.js > @@ -49,12 +49,30 @@ Ext.define('PBS.DataStoreInfo', { > usage: {}, > stillbad: 0, > mountpoint: "", > + gcScheduleMsg: "", > + pruneJobMsg: "", > + verifyJobMsg: "", > }, > }, > > controller: { > xclass: 'Ext.app.ViewController', > > + fmtConfigured: function(fmtString, params) { > + let msg = Ext.String.format(fmtString, params); > + return ` ${msg}`; > + }, > + > + fmtMissing: function(fmtString, params) { > + let msg = Ext.String.format(fmtString, params); > + return ` ${msg}`; > + }, > + > + fmtWarning: function(fmtString, params) { > + let msg = Ext.String.format(fmtString, params); > + return ` ${msg}`; > + }, > + > onLoad: function(store, data, success) { > let me = this; > if (!success) { > @@ -101,6 +119,50 @@ Ext.define('PBS.DataStoreInfo', { > vm.set('ctcount', countstext(counts.ct)); > vm.set('vmcount', countstext(counts.vm)); > vm.set('hostcount', countstext(counts.host)); > + > + Proxmox.Utils.API2Request({ > + url: `/config/datastore/${me.view.datastore}`, > + success: function(response) { > + if (response.result.data['gc-schedule']) { > + vm.set('gcScheduleMsg', me.fmtConfigured(gettext('configured'))); > + } else { > + vm.set('gcScheduleMsg', me.fmtWarning(gettext('none configured'))); > + } > + }, > + failure: function() { > + vm.set('gcScheduleMsg', me.fmtMissing(gettext('unknown'))); > + }, > + }); > + > + Proxmox.Utils.API2Request({ > + url: `/admin/prune?store=${me.view.datastore}`, > + success: function(response) { > + let len = response.result.data.length; > + if (len > 0) { > + vm.set('pruneJobMsg', me.fmtConfigured(gettext('{0} configured'), len)); > + } else { > + vm.set('pruneJobMsg', me.fmtWarning(gettext('none configured'))); > + } > + }, > + failure: function() { > + vm.set('pruneJobMsg', me.fmtMissing(gettext('unknown'))); > + }, > + }); > + > + Proxmox.Utils.API2Request({ > + url: `/admin/verify?store=${me.view.datastore}`, > + success: function(response) { > + let len = response.result.data.length; > + if (len > 0) { > + vm.set('verifyJobMsg', me.fmtConfigured(gettext('{0} configured'), len)); > + } else { > + vm.set('verifyJobMsg', me.fmtWarning(gettext('none configured'))); > + } > + }, > + failure: function() { > + vm.set('verifyJobMsg', me.fmtMissing(gettext('unknown'))); > + }, > + }); > }, > > startStore: function() { this.store.startUpdate(); }, > @@ -108,6 +170,12 @@ Ext.define('PBS.DataStoreInfo', { > > init: function(view) { > let me = this; > + > + let vm = me.getViewModel(); > + vm.set('gcScheduleMsg', me.fmtMissing(gettext('unknown'))); > + vm.set('pruneJobMsg', me.fmtMissing(gettext('unknown'))); > + vm.set('verifyJobMsg', me.fmtMissing(gettext('unknown'))); > + > let datastore = encodeURIComponent(view.datastore); > me.store = Ext.create('Proxmox.data.ObjectStore', { > interval: 5*1000, > @@ -201,6 +269,34 @@ Ext.define('PBS.DataStoreInfo', { > visible: '{stillbad}', > }, > }, > + { > + title: gettext('Garbage Collection Schedule'), > + printBar: false, > + bind: { > + data: { > + text: '{gcScheduleMsg}', > + }, > + }, > + padding: '10 0 0 0', > + }, > + { > + title: gettext('Prune Jobs'), > + printBar: false, > + bind: { > + data: { > + text: '{pruneJobMsg}', > + }, > + }, > + }, > + { > + title: gettext('Verify Jobs'), > + printBar: false, > + bind: { > + data: { > + text: '{verifyJobMsg}', > + }, > + }, > + }, > ], > }); > > -- > 2.39.2 > > > > _______________________________________________ > pbs-devel mailing list > pbs-devel@lists.proxmox.com > https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel