diff --git a/README.md b/README.md index 1a5c8a5..8a0f5e0 100644 --- a/README.md +++ b/README.md @@ -285,6 +285,38 @@ systemctl restart corosync 5. `journalctl -u corosync` — Corosync-Logs prüfen 6. `journalctl -u pve-cluster` — pmxcfs-Logs prüfen +### Workaround: Corosync zeigt noch alte IPs in der GUI + +Falls nach der Migration in der Proxmox-GUI unter **Datacenter → Cluster** noch die alten IPs stehen, wurde `/etc/pve/corosync.conf` nicht aktualisiert. Das passiert weil `/etc/pve` während der Migration read-only ist und die Config nur direkt nach `/etc/corosync/corosync.conf` geschrieben wird. Aktuelle Versionen des Tools aktualisieren `/etc/pve/corosync.conf` automatisch nach dem Quorum. + +```bash +# 1. Prüfen was wo drin steht: +grep -A1 ring0_addr /etc/corosync/corosync.conf +grep -A1 ring0_addr /etc/pve/corosync.conf + +# 2. Wenn /etc/corosync/corosync.conf die neuen IPs hat: +cp /etc/corosync/corosync.conf /etc/pve/corosync.conf + +# 3. Falls auch /etc/corosync/corosync.conf die alten IPs hat, +# manuell editieren (IPs anpassen): +nano /etc/pve/corosync.conf + +# 4. config_version in /etc/pve/corosync.conf hochzählen +# (Pflicht, damit alle Nodes die Änderung übernehmen) +# Die Zeile steht ganz oben/oder fast unten in der Datei im totem {} Block: +# +# totem { +# ... +# config_version: 4 <-- diese Zahl um 1 erhöhen (z.B. 4 -> 5) +# } +# +# Aktuelle Version anzeigen: +grep config_version /etc/pve/corosync.conf + +# 5. Corosync neu starten: +systemctl restart corosync +``` + ### Workaround: Ceph MON-Map manuell aktualisieren Falls nach der Migration `ceph-mon` und `ceph-mgr` nicht starten (z.B. weil eine ältere Version des Tools die MON-Map nicht aktualisiert hat), muss die Ceph MON-Map manuell korrigiert werden. Die MON-Map ist eine interne Datenbank in der die MON-Adressen gespeichert sind — ein reines Update der `ceph.conf` reicht nicht. diff --git a/migrator.py b/migrator.py index db10ac1..a066be2 100644 --- a/migrator.py +++ b/migrator.py @@ -383,6 +383,10 @@ class Migrator: else: print(" [!] Konnte Quorum nicht erzwingen!") + # Update corosync.conf in cluster FS (now that /etc/pve is writable) + if configs.get('corosync'): + self._update_corosync_cluster_fs(configs) + # Update Ceph config via cluster FS if possible if configs.get('ceph'): self._update_ceph(plan, configs) @@ -401,6 +405,31 @@ class Migrator: return True + def _update_corosync_cluster_fs(self, configs: dict): + """Write corosync.conf to /etc/pve/ now that quorum is available. + + During migration, we only wrote to /etc/corosync/corosync.conf (directly). + But Proxmox reads from /etc/pve/corosync.conf (cluster FS) on service start, + so we need to update that too, otherwise the old IPs show up in the GUI. + """ + print("\n [Corosync] /etc/pve/corosync.conf aktualisieren...") + + # Check if /etc/pve is writable + rc, _, _ = self.ssh.execute_local( + "touch /etc/pve/.corosync_test && rm -f /etc/pve/.corosync_test" + ) + if rc == 0: + ok, msg = self.ssh.write_local_file( + "/etc/pve/corosync.conf", configs['corosync'] + ) + if ok: + print(" [Corosync] /etc/pve/corosync.conf aktualisiert (via Cluster-FS)") + else: + print(f" [Corosync] FEHLER /etc/pve/corosync.conf: {msg}") + else: + print(" [Corosync] WARNUNG: /etc/pve nicht beschreibbar!") + print(" [Corosync] Manuell ausführen: cp /etc/corosync/corosync.conf /etc/pve/corosync.conf") + def _wait_for_quorum(self, timeout: int = 60) -> bool: """Wait for cluster quorum to be established.""" start = time.time()