From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <pve-devel-bounces@lists.proxmox.com>
Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68])
	by lore.proxmox.com (Postfix) with ESMTPS id B2BC91FF15E
	for <inbox@lore.proxmox.com>; Tue, 11 Feb 2025 12:21:26 +0100 (CET)
Received: from firstgate.proxmox.com (localhost [127.0.0.1])
	by firstgate.proxmox.com (Proxmox) with ESMTP id 82792294FE;
	Tue, 11 Feb 2025 12:21:24 +0100 (CET)
From: Fiona Ebner <f.ebner@proxmox.com>
To: pve-devel@lists.proxmox.com
Date: Tue, 11 Feb 2025 12:20:45 +0100
Message-Id: <20250211112045.37214-2-f.ebner@proxmox.com>
X-Mailer: git-send-email 2.39.5
In-Reply-To: <20250211112045.37214-1-f.ebner@proxmox.com>
References: <20250211112045.37214-1-f.ebner@proxmox.com>
MIME-Version: 1.0
X-SPAM-LEVEL: Spam detection results:  0
 AWL -0.048 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
 RCVD_IN_VALIDITY_CERTIFIED_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to
 Validity was blocked. See
 https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more
 information.
 RCVD_IN_VALIDITY_RPBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to
 Validity was blocked. See
 https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more
 information.
 RCVD_IN_VALIDITY_SAFE_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to
 Validity was blocked. See
 https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more
 information.
 SPF_HELO_NONE           0.001 SPF: HELO does not publish an SPF Record
 SPF_PASS               -0.001 SPF: sender matches SPF record
 URIBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to URIBL was blocked. See
 http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more
 information. [params.storage]
Subject: [pve-devel] [PATCH manager v2] ui: restore: enable safeguarding of
 mount point volumes by default
X-BeenThere: pve-devel@lists.proxmox.com
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Proxmox VE development discussion <pve-devel.lists.proxmox.com>
List-Unsubscribe: <https://lists.proxmox.com/cgi-bin/mailman/options/pve-devel>, 
 <mailto:pve-devel-request@lists.proxmox.com?subject=unsubscribe>
List-Archive: <http://lists.proxmox.com/pipermail/pve-devel/>
List-Post: <mailto:pve-devel@lists.proxmox.com>
List-Help: <mailto:pve-devel-request@lists.proxmox.com?subject=help>
List-Subscribe: <https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel>, 
 <mailto:pve-devel-request@lists.proxmox.com?subject=subscribe>
Reply-To: Proxmox VE development discussion <pve-devel@lists.proxmox.com>
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Errors-To: pve-devel-bounces@lists.proxmox.com
Sender: "pve-devel" <pve-devel-bounces@lists.proxmox.com>

Same rationale as in pve-manager commit 5f855ccf ("ui: restore:
improve warning for restoring container with same ID"): it's
surprising to (new) users that all owned mount point volumes are
erased upon container restore, even those that are not currently
selected for backup. This is different from VM restore, where volumes
attached at drives not present in the backup will be kept around as
unused volumes.

Opt-in by default to the new option to change this behavior.

Remove the special message printed regarding removal of mount point
volumes to avoid confusion/complexity. With the checkbox for
safeguarding being present, attention is already directed towards this
behavior. And since the checkbox is enabled by default, one needs to
explicitly opt-out for not backed-up mount points. For backed-up mount
points, it should be clear that they are overwritten by the restore,
since the confirm dialog already states "This will permanently erase
current CT data".

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
---

New in v2.

Dependency bump for pve-container is needed.

 www/manager6/window/Restore.js | 18 +++++++++++++++---
 1 file changed, 15 insertions(+), 3 deletions(-)

diff --git a/www/manager6/window/Restore.js b/www/manager6/window/Restore.js
index 6efe1313..3d759d6a 100644
--- a/www/manager6/window/Restore.js
+++ b/www/manager6/window/Restore.js
@@ -47,6 +47,9 @@ Ext.define('PVE.window.Restore', {
 	    if (values.storage) {
 		params.storage = values.storage;
 	    }
+	    if (values['restore-safeguard-mp-volumes']) {
+		params['restore-safeguard-mp-volumes'] = 1;
+	    }
 
 	    ['bwlimit', 'cores', 'name', 'memory', 'sockets'].forEach(opt => {
 		if ((values[opt] ?? '') !== '') {
@@ -96,9 +99,6 @@ Ext.define('PVE.window.Restore', {
 		    gettext('This will permanently erase current {0} data.'),
 		    view.vmtype === 'lxc' ? 'CT' : 'VM',
 		)}`;
-		if (view.vmtype === 'lxc') {
-		    confirmMsg += `<br>${gettext('Mount point volumes are also erased.')}`;
-		}
 		Ext.Msg.confirm(gettext('Confirm'), confirmMsg, function(btn) {
 		    if (btn === 'yes') {
 			executeRestore();
@@ -278,6 +278,18 @@ Ext.define('PVE.window.Restore', {
 			},
 		    ],
 		},
+		{
+		    xtype: 'proxmoxcheckbox',
+		    name: 'restore-safeguard-mp-volumes',
+		    itemId: 'restoreSafeguardMpVolumes',
+		    fieldLabel: gettext('Safeguard Mount Point Volumes'),
+		    flex: 1,
+		    checked: true,
+		    autoEl: {
+			tag: 'div',
+			'data-qtip': gettext("Preserve mount point volumes that are not included in the backup as 'unused'."),
+		    },
+		},
 	    );
 	} else if (me.vmtype === 'qemu') {
 	    items.push({
-- 
2.39.5



_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel