mirror of
https://github.com/rcourtman/Pulse.git
synced 2026-05-20 01:01:20 +00:00
Resolves #641 ## Problem When a VM migrates between Proxmox nodes, Pulse was treating it as a new resource and discarding custom alert threshold overrides. This occurred because guest IDs included the node name (e.g., `instance-node-VMID`), causing the ID to change when the VM moved to a different node. Users reported that after migrating a VM, previously disabled alerts (e.g., memory threshold set to 0) would resume firing. ## Root Cause Guest IDs were constructed as: - Standalone: `node-VMID` - Cluster: `instance-node-VMID` When a VM migrated from node1 to node2, the ID changed from `instance-node1-100` to `instance-node2-100`, causing: - Alert threshold overrides to be orphaned (keyed by old ID) - Guest metadata (custom URLs, descriptions) to be orphaned - Active alerts to reference the wrong resource ID ## Solution Changed guest ID format to be stable across node migrations: - New format: `instance-VMID` (for both standalone and cluster) - Retains uniqueness across instances while being node-independent - Allows VMs to migrate freely without losing configuration ## Implementation ### Backend Changes 1. **Guest ID Construction** (`monitor_polling.go`): - Simplified to always use `instance-VMID` format - Removed node from the ID construction logic 2. **Alert Override Migration** (`alerts.go`): - Added lazy migration in `getGuestThresholds()` - Detects legacy ID formats and migrates to new format - Preserves user configurations automatically 3. **Guest Metadata Migration** (`guest_metadata.go`): - Added `GetWithLegacyMigration()` helper method - Called during VM/container polling to migrate metadata - Preserves custom URLs and descriptions 4. **Active Alerts Migration** (`alerts.go`): - Added migration logic in `LoadActiveAlerts()` - Translates legacy alert resource IDs to new format - Preserves alert acknowledgments across restarts ### Frontend Changes 5. **ID Construction Updates**: - `ThresholdsTable.tsx`: Updated fallback from `instance-node-vmid` to `instance-vmid` - `Dashboard.tsx`: Simplified guest ID construction - `GuestRow.tsx`: Updated `buildGuestId()` helper ## Migration Strategy - **Lazy Migration**: Configs are migrated as guests are discovered - **Backwards Compatible**: Old IDs are detected and automatically converted - **Zero Downtime**: No manual intervention required - **Persisted**: Migrated configs are saved on next config write cycle ## Testing Recommendations After deployment: 1. Verify existing alert overrides still apply 2. Test VM migration - confirm thresholds persist 3. Check guest metadata (custom URLs) survive migration 4. Verify active alerts maintain acknowledgment state ## Related - Addresses similar issues with guest metadata and active alert tracking - Lays groundwork for any future guest-specific configuration features - Aligns with project philosophy: correctness and UX over implementation complexity |
||
|---|---|---|
| .. | ||
| backoff.go | ||
| backoff_test.go | ||
| backup_guard_test.go | ||
| ceph.go | ||
| circuit_breaker.go | ||
| circuit_breaker_test.go | ||
| container_disk_usage.go | ||
| diagnostic_snapshots.go | ||
| docker_commands.go | ||
| docker_commands_test.go | ||
| fake_executor_integration.go | ||
| fs_filters.go | ||
| fs_filters_test.go | ||
| harness_integration.go | ||
| helpers_test.go | ||
| integration_integration_test.go | ||
| main_test.go | ||
| metrics.go | ||
| metrics_history.go | ||
| metrics_history_concurrency_test.go | ||
| monitor.go | ||
| monitor_docker_test.go | ||
| monitor_health_test.go | ||
| monitor_host_agents_test.go | ||
| monitor_memory_test.go | ||
| monitor_pmg_test.go | ||
| monitor_polling.go | ||
| monitor_snapshots_test.go | ||
| monitor_storage_test.go | ||
| monitor_temperature_toggle_test.go | ||
| poller.go | ||
| ratetracker.go | ||
| ratetracker_concurrency_test.go | ||
| reload.go | ||
| scheduler.go | ||
| staleness_tracker.go | ||
| staleness_tracker_test.go | ||
| task_queue.go | ||
| temperature.go | ||
| temperature_service.go | ||
| temperature_test.go | ||