From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [IPv6:2a01:7e0:0:424::9]) by lore.proxmox.com (Postfix) with ESMTPS id 173D51FF170 for ; Tue, 19 Nov 2024 14:30:56 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 0E0482C3E8; Tue, 19 Nov 2024 14:31:02 +0100 (CET) From: Stefan Hanreich To: pve-devel@lists.proxmox.com Date: Tue, 19 Nov 2024 14:30:56 +0100 Message-Id: <20241119133056.167727-1-s.hanreich@proxmox.com> X-Mailer: git-send-email 2.39.5 MIME-Version: 1.0 X-SPAM-LEVEL: Spam detection results: 0 AWL -0.232 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 KAM_LAZY_DOMAIN_SECURITY 1 Sending domain does not have any anti-forgery methods RDNS_NONE 0.793 Delivered to internal network by a host with no rDNS SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_NONE 0.001 SPF: sender does not publish an SPF Record Subject: [pve-devel] [PATCH pve-network 1/1] debian: migrate legacy mac/ipam db 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" We opted for a simple copy of the legacy file to the new location, since any other migration path would be too strenuous. The worst-case scenario of failures with this approach is losing IPAM / MAC entries that are created during the update window in the legacy files by nodes that are not yet updated to the new version. Those can be fixed by a simple start / stop of the affected VMs, triggering a rewrite of the IPAM database. Signed-off-by: Stefan Hanreich --- I took the liberty of already including a version guard, since we will apply it directly before bumping. If that's a wrong assumption or if the version number is wrong, please adapt it respectively. debian/libpve-network-perl.postinst | 32 +++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 debian/libpve-network-perl.postinst diff --git a/debian/libpve-network-perl.postinst b/debian/libpve-network-perl.postinst new file mode 100644 index 0000000..733961b --- /dev/null +++ b/debian/libpve-network-perl.postinst @@ -0,0 +1,32 @@ +#!/bin/sh + +set -e + +migrate_ipam_db() { + LEGACY_IPAM_DB_FILE="/etc/pve/priv/ipam.db" + IPAM_DB_FILE="/etc/pve/sdn/pve-ipam-state.json" + + if test -f "$LEGACY_IPAM_DB_FILE" && test ! -f "$IPAM_DB_FILE"; then + cp $LEGACY_IPAM_DB_FILE $IPAM_DB_FILE + fi +} + +migrate_mac_cache() { + LEGACY_MAC_DB_FILE="/etc/pve/priv/macs.db" + MAC_DB_FILE="/etc/pve/sdn/mac-cache.json" + + if test -f "$LEGACY_MAC_DB_FILE" && test ! -f "$MAC_DB_FILE"; then + cp $LEGACY_MAC_DB_FILE $MAC_DB_FILE + fi +} + +case "$1" in + configure) + if dpkg --compare-versions "$2" 'lt' '0.9.9'; then + migrate_ipam_db + migrate_mac_cache + fi + ;; +esac + +exit 0 -- 2.39.5 _______________________________________________ pve-devel mailing list pve-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel