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.
Go aialertsdashboarddockerdocker-monitoringgohomelabinfrastructure-monitoringkubernetesmonitoringmspproxmoxproxmox-backup-serverproxmox-mail-gatewayproxmox-veself-hostedtruenastypescriptvspherewebhooks
Keep identical local backup paths independent across PVE nodes
pulse-triage[bot]a9b950d672e2
diff --git a/docs/release-control/v6/internal/subsystems/monitoring.md b/docs/release-control/v6/internal/subsystems/monitoring.mdindex 34f7e5a665..36f22fa6ac 100644--- a/docs/release-control/v6/internal/subsystems/monitoring.md+++ b/docs/release-control/v6/internal/subsystems/monitoring.md@@ -17,6 +17,36 @@## Purpose+### Local archive identities include their independent disk++A PVE volume ID is a path within a repository, not proof that identically named+local disks share content. Local archive deduplication and opaque public IDs+use the exact connection, storage read node, storage name and volume ID. The+`pvelocal1:` ID is a SHA-256 digest of those four length-prefixed UTF-8 byte+strings in that order. Case, delimiters and field boundaries are significant;+guest placement, timestamps, size and read order cannot rename a file. Distinct+local copies reach both live inventory and recovery history with distinct IDs.+Shared and inherently remote repositories keep their previous deduplication+and IDs, including direct-PBS attribution/exclusion behaviour.++This intentionally replaces the old connection/volume-only *local* IDs. No+legacy record is assigned an invented disk: partial scans preserve old points+and evidence unchanged, so unscoped history can overlap new observations until+a complete accepted scan. Only that ordinary full scan reconciles obsolete IDs;+other connections and unread files are not removed. Existing partial-history,+carry-forward, absence and protection policies stay in force. JSON shape, guest+attribution, read permissions and guest/backup operations are unchanged. Clients+must continue treating archive IDs as opaque, not parsing the old delimiter.++`pve_local_archive_identity_test.go` covers VM/LXC, both node orders, warm/cold+cache, repeated partial reads, guest moves, independent accepted absence,+legacy-to-scoped reconciliation, connection isolation, tuple boundaries and+shared controls. The dir-storage/PBS regression also exercises both local+copies alongside a direct PBS connection. The normal-suite consumer lifecycle+can export its actual poll/ingest/posture frames for desktop/narrow Backups+proof. This establishes source identity correctness, not restore availability,+installed guest recovery or the cause of #3248's original stale dates.+### Disabled local backup targets keep their own unread scopeA skipped local backup-content read cannot be covered by a successfuldiff --git a/docs/release-control/v6/internal/subsystems/storage-recovery.md b/docs/release-control/v6/internal/subsystems/storage-recovery.mdindex e643c3ca8a..dd2cea834a 100644--- a/docs/release-control/v6/internal/subsystems/storage-recovery.md+++ b/docs/release-control/v6/internal/subsystems/storage-recovery.md@@ -21,6 +21,36 @@## Purpose+### Local archive identities include their independent disk++A PVE volume ID is a path within a repository, not proof that identically named+local disks share content. Local archive deduplication and opaque public IDs+use the exact connection, storage read node, storage name and volume ID. The+`pvelocal1:` ID is a SHA-256 digest of those four length-prefixed UTF-8 byte+strings in that order. Case, delimiters and field boundaries are significant;+guest placement, timestamps, size and read order cannot rename a file. Distinct+local copies reach both live inventory and recovery history with distinct IDs.+Shared and inherently remote repositories keep their previous deduplication+and IDs, including direct-PBS attribution/exclusion behaviour.++This intentionally replaces the old connection/volume-only *local* IDs. No+legacy record is assigned an invented disk: partial scans preserve old points+and evidence unchanged, so unscoped history can overlap new observations until+a complete accepted scan. Only that ordinary full scan reconciles obsolete IDs;+other connections and unread files are not removed. Existing partial-history,+carry-forward, absence and protection policies stay in force. JSON shape, guest+attribution, read permissions and guest/backup operations are unchanged. Clients+must continue treating archive IDs as opaque, not parsing the old delimiter.++`pve_local_archive_identity_test.go` covers VM/LXC, both node orders, warm/cold+cache, repeated partial reads, guest moves, independent accepted absence,+legacy-to-scoped reconciliation, connection isolation, tuple boundaries and+shared controls. The dir-storage/PBS regression also exercises both local+copies alongside a direct PBS connection. The normal-suite consumer lifecycle+can export its actual poll/ingest/posture frames for desktop/narrow Backups+proof. This establishes source identity correctness, not restore availability,+installed guest recovery or the cause of #3248's original stale dates.+### Disabled local backup targets keep their own unread scopeA skipped local backup-content read cannot be covered by a successfuldiff --git a/internal/monitoring/monitor_backups.go b/internal/monitoring/monitor_backups.goindex 08f53d57ed..6e3e648b88 100644--- a/internal/monitoring/monitor_backups.go+++ b/internal/monitoring/monitor_backups.go@@ -2,6 +2,7 @@ package monitoringimport ("context"+ "crypto/sha256""fmt""regexp""sort"@@ -174,6 +175,21 @@ func (m *Monitor) backupInventoryScopeForAlerts() *alerts.BackupInventoryScope {return scope}+// A volume ID names a path inside a storage, not an independent node's disk.+// Shared repositories keep their existing IDs; local IDs use the exact read+// origin, never the guest's current node. Length-prefix each UTF-8 byte string+// before hashing so delimiters, case and field boundaries remain significant.+func pveStorageBackupID(instance, storageNode, storage, volume string) string {+ if storageNode == "" {+ return fmt.Sprintf("%s-%s", instance, volume)+ }+ tuple := fmt.Sprintf("%d:%s%d:%s%d:%s%d:%s", len(instance), instance,+ len(storageNode), storageNode, len(storage), storage, len(volume), volume)+ // No hyphen in this namespace/digest: it cannot equal a legacy shared ID,+ // whose connection and volume are always separated by a hyphen.+ return fmt.Sprintf("pvelocal1:%x", sha256.Sum256([]byte(tuple)))+}+func (m *Monitor) pollStorageBackupsWithNodes(ctx context.Context, instanceName string, client PVEClientInterface, nodes []proxmox.Node, nodeEffectiveStatus map[string]string) {if ctx.Err() != nil {return@@ -182,15 +198,15 @@ func (m *Monitor) pollStorageBackupsWithNodes(ctx context.Context, instanceNamevar allBackups []models.StorageBackupvar pbsConfirmations []models.PBSGuestConfirmationhasPBSDirectConnection := m.config != nil && len(m.config.PBSInstances) > 0- seenVolids := make(map[string]bool) // Track seen volume IDs to avoid duplicates- hadSuccessfulNode := false // Track if at least one node responded successfully- successfulNodeQueries := 0 // Number of nodes whose storage list was enumerated- storagesWithBackup := 0 // Number of storages that should contain backups- contentSuccess := 0 // Number of successful storage content fetches- contentFailures := 0 // Number of failed storage content fetches- storageQueryErrors := 0 // Number of nodes where storage list could not be queried- hadPermissionError := false // Track if any permission errors occurred this cycle- permissionFailureCount := 0 // Number of node/storage reads rejected by authorization+ seenBackups := make(map[string]bool) // Collapse repeated views of the same repository only+ hadSuccessfulNode := false // Track if at least one node responded successfully+ successfulNodeQueries := 0 // Number of nodes whose storage list was enumerated+ storagesWithBackup := 0 // Number of storages that should contain backups+ contentSuccess := 0 // Number of successful storage content fetches+ contentFailures := 0 // Number of failed storage content fetches+ storageQueryErrors := 0 // Number of nodes where storage list could not be queried+ hadPermissionError := false // Track if any permission errors occurred this cycle+ permissionFailureCount := 0 // Number of node/storage reads rejected by authorizationstoragePreserveNeeded := map[string]struct{}{}confirmationPreserveNeeded := map[string]struct{}{}unreadNodes := map[string]struct{}{}@@ -363,11 +379,13 @@ func (m *Monitor) pollStorageBackupsWithNodes(ctx context.Context, instanceName// Convert to modelsfor _, content := range contents {- // Skip if we've already seen this item (shared storage duplicate)- if seenVolids[content.Volid] {+ backupID := pveStorageBackupID(instanceName, storageNode, storage.Storage, content.Volid)+ // Shared views collapse, but matching paths on independent local+ // disks must survive both live inventory and recovery ingestion.+ if seenBackups[backupID] {continue}- seenVolids[content.Volid] = true+ seenBackups[backupID] = true// Skip templates and ISOs - they're not backupsif content.Content == "vztmpl" || content.Content == "iso" {@@ -465,7 +483,7 @@ func (m *Monitor) pollStorageBackupsWithNodes(ctx context.Context, instanceNamebackup := models.StorageBackup{StorageNode: storageNode,- ID: fmt.Sprintf("%s-%s", instanceName, content.Volid),+ ID: backupID,Storage: storage.Storage,Node: backupNode,Instance: instanceName,diff --git a/internal/monitoring/monitor_backups_dir_storage_test.go b/internal/monitoring/monitor_backups_dir_storage_test.goindex 89b2ecd213..9d84db8078 100644--- a/internal/monitoring/monitor_backups_dir_storage_test.go+++ b/internal/monitoring/monitor_backups_dir_storage_test.go@@ -57,16 +57,21 @@ func TestPollStorageBackups_KeepsDirStorageNamedLikePBS(t *testing.T) {}client := &dirStorageNamedPBSClient{}- nodes := []pveapi.Node{{Node: "node1", Status: "online"}}+ nodes := []pveapi.Node{{Node: "node1", Status: "online"}, {Node: "node2", Status: "online"}}- m.pollStorageBackupsWithNodes(context.Background(), "pve1", client, nodes, map[string]string{"node1": "online"})+ m.pollStorageBackupsWithNodes(context.Background(), "pve1", client, nodes, map[string]string{"node1": "online", "node2": "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 len(backups) != 2 {+ t.Fatalf("expected each independent dir-storage copy 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])+ if backups[0].ID == backups[1].ID || backups[0].StorageNode == backups[1].StorageNode {+ t.Fatalf("local disks named like PBS must have independent identities: %+v", backups)+ }+ for _, backup := range backups {+ if backup.Storage != "pbs-backup" || backup.VMID != 106 {+ t.Fatalf("expected only vzdump from dir storage named pbs-backup, got %+v", backup)+ }}}diff --git a/internal/monitoring/pve_local_archive_identity_test.go b/internal/monitoring/pve_local_archive_identity_test.gonew file mode 100644index 0000000000..9d2fe98bb7--- /dev/null+++ b/internal/monitoring/pve_local_archive_identity_test.go@@ -0,0 +1,332 @@+package monitoring++import (+ "context"+ "crypto/sha256"+ "encoding/json"+ "fmt"+ "os"+ "reflect"+ "strings"+ "testing"+ "time"++ "github.com/rcourtman/pulse-go-rewrite/internal/models"+ "github.com/rcourtman/pulse-go-rewrite/internal/operationaltrust"+ "github.com/rcourtman/pulse-go-rewrite/internal/recovery"+ proxmoxmapper "github.com/rcourtman/pulse-go-rewrite/internal/recovery/mapper/proxmox"+ "github.com/rcourtman/pulse-go-rewrite/internal/unifiedresources"+ "github.com/rcourtman/pulse-go-rewrite/pkg/proxmox"+)++// The same archive pathname can exist on two independent local disks, e.g.+// after a guest and its backups move between nodes. Guest placement is not+// the archive's repository identity. This fixture only performs ordinary reads.+type localArchiveIdentityClient struct {+ *pveReconciliationClient+ kind string+ storageType string+ shared bool+}++func (c *localArchiveIdentityClient) GetStorage(ctx context.Context, node string) ([]proxmox.Storage, error) {+ rows, err := c.pveReconciliationClient.GetStorage(ctx, node)+ for i := range rows {+ rows[i].Storage = "local"+ rows[i].Type = c.storageType+ if c.shared {+ rows[i].Shared = 1+ }+ }+ return rows, err+}++func (c *localArchiveIdentityClient) GetStorageContent(ctx context.Context, storage, volume string) ([]proxmox.StorageContent, error) {+ rows, err := c.pveReconciliationClient.GetStorageContent(ctx, node, storage)+ for i := range rows {+ rows[i].VMID = 101+ rows[i].Volid = fmt.Sprintf("local:backup/vzdump-%s-101-2026_10_26-00_00_00.tar.zst", c.kind)+ rows[i].Format = "tar.zst"+ rows[i].Size = 1024+ if node == "node-b" && !c.shared && c.storageType == "dir" {+ rows[i].Size = 4096+ }+ }+ return rows, err+}++func localArchiveIdentityFixture(t *testing.T, kind string) (*pveReconciliationFixture, *localArchiveIdentityClient) {+ t.Helper()+ f := newPVEReconciliationFixture(t)+ f.m.state.UpdateVMs(nil)+ f.ids = f.ids[:1]+ if kind == "lxc" {+ f.m.state.UpdateContainers([]models.Container{{ID: makeGuestID("cluster", "node-b", 101), VMID: 101, Instance: "cluster", Node: "node-b", Name: "guest-101", Status: "running"}})+ f.ids[0] = unifiedresources.ProxmoxGuestCanonicalID(unifiedresources.ResourceTypeSystemContainer, "cluster", 101)+ } else {+ f.m.state.UpdateVMs([]models.VM{{ID: makeGuestID("cluster", "node-b", 101), VMID: 101, Instance: "cluster", Node: "node-b", Name: "guest-101", Status: "running"}})+ }+ return f, &localArchiveIdentityClient{pveReconciliationClient: f.client, kind: kind, storageType: "dir"}+}++func TestPVELocalArchiveIdentityLifecycle(t *testing.T) {+ for _, kind := range []string{"qemu", "lxc"} {+ for _, reverse := range []bool{false, true} {+ for _, cold := range []bool{false, true} {+ t.Run(fmt.Sprintf("%s/reverse=%t/cold=%t", kind, reverse, cold), func(t *testing.T) {+ f, c := localArchiveIdentityFixture(t, kind)+ if reverse {+ f.nodes[0], f.nodes[1] = f.nodes[1], f.nodes[0]+ }+ poll := func() {+ f.m.pollStorageBackupsWithNodes(context.Background(), "cluster", c, f.nodes, f.online)+ f.wait(t)+ }+ poll()+ rows, points := f.m.state.GetSnapshot().PVEBackups.StorageBackups, f.points(t)+ if len(rows) != 2 || len(points) != 2 {+ t.Fatalf("independent same-path archives collapsed: live=%d durable=%d want2/2", len(rows), len(points))+ }+ before := map[string]models.StorageBackup{}+ for _, r := range rows {+ before[r.StorageNode] = r+ if r.Node != "node-b" {+ t.Fatalf("guest placement changed: %+v", r)+ }+ if p := points["pve-backup:"+r.ID]; p.SubjectResourceID != f.ids[0] || p.CompletedAt == nil || !p.CompletedAt.Equal(r.Time) {+ t.Fatalf("archive did not reach its canonical guest with exact date: %+v", p)+ }+ }+ if len(before) != 2 || before["node-a"].ID == before["node-b"].ID || before["node-a"].Size != 1024 || before["node-b"].Size != 4096 {+ t.Fatalf("repository identities or bytes merged: %+v", rows)+ }+ if cold {+ f.m.state.UpdateStorageBackupsForInstance("cluster", nil)+ }+ f.client.contentErr = fmt.Errorf("503 unavailable")+ f.client.at = f.client.at.Add(15 * time.Minute)+ for range 2 {+ poll()+ got := f.points(t)+ oldID := "pve-backup:" + before["node-b"].ID+ if len(got) != 2 || !reflect.DeepEqual(got[oldID], points[oldID]) {+ t.Fatal("unread same-path point was replaced or its evidence renewed by the peer")+ }+ f.assertHistory(t, recovery.ProtectionHistoryPartial, operationaltrust.EvidencePermissionsUnknown)+ raw := f.m.state.GetSnapshot().PVEBackups.StorageBackups+ want := 2+ if cold {+ want = 1+ }+ if len(raw) != want {+ t.Fatalf("partial live inventory=%d want%d", len(raw), want)+ }+ for _, r := range raw {+ if r.StorageNode == "node-b" && !reflect.DeepEqual(r, before["node-b"]) {+ t.Fatal("carried archive facts changed")+ }+ if r.StorageNode == "node-a" && (r.ID != before["node-a"].ID || !r.Time.Equal(f.client.at)) {+ t.Fatal("accepted peer lost stable identity or current observation")+ }+ }+ }+ f.client.contentErr = nil+ poll()+ if len(f.points(t)) != 2 || len(f.m.state.GetSnapshot().PVEBackups.StorageBackups) != 2 {+ t.Fatal("complete recovery lost a repository")+ }+ // A change in guest placement must not rename either disk's archive.+ if kind == "lxc" {+ guests := f.m.state.GetSnapshot().Containers+ guests[0].Node = "node-a"+ f.m.state.UpdateContainers(guests)+ } else {+ guests := f.m.state.GetSnapshot().VMs+ guests[0].Node = "node-a"+ f.m.state.UpdateVMs(guests)+ }+ poll()+ for _, r := range f.m.state.GetSnapshot().PVEBackups.StorageBackups {+ if r.ID != before[r.StorageNode].ID || r.Node != "node-a" {+ t.Fatal("guest move changed archive identity or failed to update attribution")+ }+ }+ f.client.emptyB = true+ poll()+ if len(f.points(t)) != 1 || len(f.m.state.GetSnapshot().PVEBackups.StorageBackups) != 1 {+ t.Fatal("accepted empty disk did not remove only its own archive")+ }+ if _, ok := f.points(t)["pve-backup:"+before["node-a"].ID]; !ok {+ t.Fatal("empty sibling erased the other disk")+ }+ f.client.emptyAll = true+ poll()+ if len(f.points(t)) != 0 || len(f.m.state.GetSnapshot().PVEBackups.StorageBackups) != 0 {+ t.Fatal("complete absence did not clear inventory")+ }+ })+ }+ }+ }+}++func TestPVELocalArchiveSharedIdentityControls(t *testing.T) {+ for _, scope := range []string{"flag", "nfs", "cifs", "pbs"} {+ for _, reverse := range []bool{false, true} {+ t.Run(fmt.Sprintf("%s/reverse=%t", scope, reverse), func(t *testing.T) {+ f, c := localArchiveIdentityFixture(t, "qemu")+ if scope == "flag" {+ c.shared = true+ } else {+ c.storageType = scope+ }+ if reverse {+ f.nodes[0], f.nodes[1] = f.nodes[1], f.nodes[0]+ }+ f.m.pollStorageBackupsWithNodes(context.Background(), "cluster", c, f.nodes, f.online)+ f.wait(t)+ rows := f.m.state.GetSnapshot().PVEBackups.StorageBackups+ if len(rows) != 1 || len(f.points(t)) != 1 || rows[0].ID != "cluster-"+rows[0].Volid || rows[0].StorageNode != "" {+ t.Fatalf("shared deduplication/legacy identity changed: %+v", rows)+ }+ })+ }+ }+}++func TestPVELocalArchiveLegacyTransition(t *testing.T) {+ for _, cold := range []bool{false, true} {+ t.Run(fmt.Sprintf("cold=%t", cold), func(t *testing.T) {+ f, c := localArchiveIdentityFixture(t, "qemu")+ content, _ := c.GetStorageContent(context.Background(), "node-b", "local")+ old := models.StorageBackup{ID: "cluster-" + content[0].Volid, Instance: "cluster", Node: "node-b", StorageNode: "node-b", Storage: "local", Volid: content[0].Volid, VMID: 101, Type: "qemu", Time: f.client.at, CTime: f.client.at.Unix(), Size: 4096}+ legacy, err := proxmoxmapper.FromPVEStorageBackupsWithEvidence([]models.StorageBackup{old}, buildProxmoxGuestInfoIndex(f.m.backupReadStateForInstance("cluster")), f.client.at)+ if err != nil {+ t.Fatal(err)+ }+ other := old+ other.ID = "other-" + old.Volid+ other.Instance = "other"+ legacy = append(legacy, proxmoxmapper.FromPVEStorageBackups([]models.StorageBackup{other}, nil)...)+ f.m.ingestRecoveryPointsAsync(legacy)+ f.wait(t)+ original := f.points(t)+ if !cold {+ f.m.state.UpdateStorageBackupsForInstance("cluster", []models.StorageBackup{old})+ }+ f.client.contentErr = fmt.Errorf("503 unavailable")+ f.m.pollStorageBackupsWithNodes(context.Background(), "cluster", c, f.nodes, f.online)+ f.wait(t)+ got := f.points(t)+ if len(got) != 3 || !reflect.DeepEqual(got[legacy[0].ID], original[legacy[0].ID]) {+ t.Fatal("partial transition overwrote ambiguous legacy history instead of retaining it")+ }+ f.assertHistory(t, recovery.ProtectionHistoryPartial, operationaltrust.EvidencePermissionsUnknown)+ f.client.contentErr = nil+ f.m.pollStorageBackupsWithNodes(context.Background(), "cluster", c, f.nodes, f.online)+ f.wait(t)+ got = f.points(t)+ if len(got) != 3 {+ t.Fatalf("complete transition points=%d want two local plus other connection", len(got))+ }+ if _, exists := got[legacy[0].ID]; exists {+ t.Fatal("complete accepted scan retained obsolete unscoped identity")+ }+ if !reflect.DeepEqual(got[legacy[1].ID], original[legacy[1].ID]) {+ t.Fatal("transition modified another connection")+ }+ })+ }+}++// Run by the ordinary Go suite; only the export is optional evidence transport.+func TestPVELocalArchiveIdentityConsumerFrames(t *testing.T) {+ for _, kind := range []string{"qemu", "lxc"} {+ f, c := localArchiveIdentityFixture(t, kind)+ frames := map[string]any{}+ for _, phase := range []string{"observed", "partial", "recovered", "one-removed", "empty"} {+ switch phase {+ case "partial":+ f.client.contentErr = fmt.Errorf("503 unavailable")+ case "recovered":+ f.client.contentErr = nil+ case "one-removed":+ f.client.emptyB = true+ case "empty":+ f.client.emptyAll = true+ }+ f.m.pollStorageBackupsWithNodes(context.Background(), "cluster", c, f.nodes, f.online)+ f.wait(t)+ rows, points, postures := f.m.state.GetSnapshot().PVEBackups, f.points(t), f.postures(t)+ want := 2+ if phase == "one-removed" {+ want = 1+ }+ if phase == "empty" {+ want = 0+ }+ if len(rows.StorageBackups) != want || len(points) != want {+ t.Fatalf("phase=%s live=%d history=%d want%d", phase, len(rows.StorageBackups), len(points), want)+ }+ for _, p := range postures {+ if (phase == "observed" || phase == "recovered" || phase == "one-removed") && p.State != recovery.ProtectionStateProtected {+ t.Fatalf("accepted completed archives lost posture: %+v", p)+ }+ if (phase == "partial" || phase == "empty") && p.State == recovery.ProtectionStateProtected {+ t.Fatal("unread or absent archives claimed protection")+ }+ }+ frames[phase] = map[string]any{"pve": map[string]any{"data": rows}, "postures": map[string]any{"data": postures, "policy": recovery.DefaultProtectionPosturePolicy.Payload()}, "points": points}+ }+ if os.Getenv("PULSE_LOCAL_ARCHIVE_FRAMES") == "1" {+ source, err := os.ReadFile("monitor_backups.go")+ if err != nil {+ t.Fatal(err)+ }+ data, err := json.Marshal(map[string]any{"kind": kind, "runtime_sha256": fmt.Sprintf("%x", sha256.Sum256(source)), "observed_at": time.Now().UTC(), "resource_ids": f.ids, "frames": frames})+ if err != nil {+ t.Fatal(err)+ }+ t.Log("LOCAL_ARCHIVE_FRAME=" + string(data))+ }+ }+}++func TestPVELocalArchiveIdentityTuple(t *testing.T) {+ // A black-box identity check: labels are not normalised, reordered or joined+ // ambiguously. Timestamp, size and the guest's placement do not name a disk.+ inputs := [][4]string{+ {"a-b", "c", "local", "volume"}, {"a", "b-c", "local", "volume"},+ {"a", "b", "c-local", "volume"}, {"A", "b", "c-local", "volume"},+ {"a", "B", "c-local", "volume"}, {"a", "b", "C-local", "volume"},+ {"a:b", "c", "local", "volume"}, {"a", "b:c", "local", "volume"},+ {"a", "b", "local:é", "volume"}, {"a", "b", "local:é", "Volume"},+ {"a", "b", "local", "é:volume"}, {"a", "b", "local:é", ":volume"},+ }+ seen := map[string]bool{}+ for _, in := range inputs {+ m := &Monitor{state: models.NewState()}+ c := &singleArchiveIdentityClient{storage: in[2], volume: in[3]}+ m.pollStorageBackupsWithNodes(context.Background(), in[0], c, []proxmox.Node{{Node: in[1]}}, map[string]string{in[1]: "online"})+ rows := m.state.GetSnapshot().PVEBackups.StorageBackups+ if len(rows) != 1 || seen[rows[0].ID] {+ t.Fatalf("exact repository tuple collided: input=%q rows=%+v", in, rows)+ }+ if !strings.HasPrefix(rows[0].ID, "pvelocal1:") {+ t.Errorf("local identity is not versioned separately from legacy shared IDs: %s", rows[0].ID)+ }+ seen[rows[0].ID] = true+ }+}++type singleArchiveIdentityClient struct {+ mockPVEClientExtra+ storage, volume string+}++func (c *singleArchiveIdentityClient) GetStorage(context.Context, string) ([]proxmox.Storage, error) {+ return []proxmox.Storage{{Storage: c.storage, Type: "dir", Content: "backup", Active: 1, Enabled: 1}}, nil+}+func (c *singleArchiveIdentityClient) GetStorageContent(context.Context, string, string) ([]proxmox.StorageContent, error) {+ return []proxmox.StorageContent{{VMID: 101, Volid: c.volume, CTime: 1, Size: 1, Content: "backup"}}, nil+}