Skip to content

armgit / Pulse

Public Imported from GitHub
0

Real-time monitoring dashboard for Proxmox VE, PBS, Docker, Kubernetes, TrueNAS and vSphere. Self-hosted, with alerts for failed backups, full disks, unhealthy containers and offline nodes.

Keep vzdump backups from dir storages whose name starts with pbs-

rcourtmana9987fb4548a
diff --git a/internal/monitoring/monitor_backups.go b/internal/monitoring/monitor_backups.go
index b8ebb10a7b..ea8e81a12e 100644
--- a/internal/monitoring/monitor_backups.go
+++ b/internal/monitoring/monitor_backups.go
@@ -299,7 +299,11 @@ func (m *Monitor) pollStorageBackupsWithNodes(ctx context.Context, instanceName
}
// If not found in map, fall back to queried node (shouldn't happen normally)
}
- isPBSStorage := strings.HasPrefix(storage.Storage, "pbs-") || storage.Type == "pbs"
+ // Classify by storage type only. A dir/NFS storage is free to be
+ // NAMED "pbs-…" (e.g. "pbs-backup"), and treating the name prefix
+ // as PBS silently dropped its vzdump backups whenever a direct PBS
+ // connection was also configured (#1592).
+ isPBSStorage := storage.Type == "pbs"
if isPBSStorage && hasPBSDirectConnection {
log.Debug().
Str("instance", instanceName).
diff --git a/internal/monitoring/monitor_backups_dir_storage_test.go b/internal/monitoring/monitor_backups_dir_storage_test.go
new file mode 100644
index 0000000000..ccd7b99988
--- /dev/null
+++ b/internal/monitoring/monitor_backups_dir_storage_test.go
@@ -0,0 +1,70 @@
+package monitoring
+
+import (
+ "context"
+ "testing"
+ "time"
+
+ "github.com/rcourtman/pulse-go-rewrite/internal/config"
+ "github.com/rcourtman/pulse-go-rewrite/internal/models"
+ pveapi "github.com/rcourtman/pulse-go-rewrite/pkg/proxmox"
+)
+
+// dirStorageNamedPBSClient serves a dir-type storage whose NAME starts with
+// "pbs-" alongside a real pbs-type storage. Only the latter may be treated as
+// PBS-backed when a direct PBS connection exists (#1592).
+type dirStorageNamedPBSClient struct {
+ mockPVEClientExtra
+}
+
+func (c *dirStorageNamedPBSClient) GetStorage(ctx context.Context, node string) ([]pveapi.Storage, error) {
+ return []pveapi.Storage{
+ {Storage: "pbs-backup", Content: "backup", Type: "dir", Enabled: 1, Active: 1},
+ {Storage: "pbs-real", Content: "backup", Type: "pbs", Enabled: 1, Active: 1},
+ }, nil
+}
+
+func (c *dirStorageNamedPBSClient) GetStorageContent(ctx context.Context, node, storage string) ([]pveapi.StorageContent, error) {
+ switch storage {
+ case "pbs-backup":
+ return []pveapi.StorageContent{{
+ Volid: "pbs-backup:backup/vzdump-qemu-106-2026_07_17-01_00_00.vma.zst",
+ VMID: 106,
+ Size: 2048,
+ CTime: time.Date(2026, 7, 17, 1, 0, 0, 0, time.UTC).Unix(),
+ Content: "backup",
+ }}, nil
+ case "pbs-real":
+ return []pveapi.StorageContent{{
+ Volid: "pbs-real:backup/vm/107/2026-07-17T01:00:00Z",
+ VMID: 107,
+ Size: 2048,
+ CTime: time.Date(2026, 7, 17, 1, 0, 0, 0, time.UTC).Unix(),
+ Content: "backup",
+ Format: "pbs-vm",
+ }}, nil
+ }
+ return nil, nil
+}
+
+func TestPollStorageBackups_KeepsDirStorageNamedLikePBS(t *testing.T) {
+ m := &Monitor{
+ state: models.NewState(),
+ config: &config.Config{
+ PBSInstances: []config.PBSInstance{{Name: "pbs-1", Host: "https://pbs.example:8007"}},
+ },
+ }
+
+ client := &dirStorageNamedPBSClient{}
+ nodes := []pveapi.Node{{Node: "node1", Status: "online"}}
+
+ m.pollStorageBackupsWithNodes(context.Background(), "pve1", client, nodes, map[string]string{"node1": "online"})
+
+ backups := m.state.GetSnapshot().PVEBackups.StorageBackups
+ if len(backups) != 1 {
+ t.Fatalf("expected exactly the dir-storage backup to survive, got %+v", backups)
+ }
+ if backups[0].Storage != "pbs-backup" || backups[0].VMID != 106 {
+ t.Fatalf("expected vzdump from dir storage named pbs-backup, got %+v", backups[0])
+ }
+}