Skip to content

PBS backup discovery fails when datastore uses namespaces #556

@jacobwtyler

Description

@jacobwtyler

Bug Description

The backup discovery feature (discoverPBSBackups in src/server/services/backupService.ts) does not pass the --ns (namespace) flag when running proxmox-backup-client snapshot list. This causes PBS backup discovery to return 0 results for any datastore that uses namespaces.

Root Cause

In backupService.ts, the snapshot list command is built without considering the PBS namespace configured in storage.cfg:

const command = `${snapshotEnvStr}timeout 30 proxmox-backup-client snapshot list ct/${ctId} --repository ${repository} 2>&1 || echo "PBS_ERROR"`;

However, Proxmox storage configs commonly use namespaces:

pbs: pbs-ds1
    datastore pbs-ds1
    server 192.168.55.14
    namespace jacob        # <-- this is ignored
    ...

The Storage interface already captures the namespace via [key: string]: any during config parsing (in storageService.ts line ~86), but discoverPBSBackups never reads it.

Expected Behavior

When a PBS storage has a namespace configured, the snapshot list command should include --ns <namespace>:

proxmox-backup-client snapshot list ct/101 --repository root@pam@192.168.55.14:pbs-ds1 --ns jacob

Fix

Add the namespace flag before building the command in discoverPBSBackups:

const pbsNamespace = (storage as any).namespace ? `--ns ${(storage as any).namespace}` : '';
const command = `${snapshotEnvStr}timeout 30 proxmox-backup-client snapshot list ct/${ctId} --repository ${repository} ${pbsNamespace} 2>&1 || echo "PBS_ERROR"`;

The storage object already contains the namespace from the parsed storage.cfg, so no additional data fetching is needed.

Environment

  • PVE Scripts Local v0.5.8
  • Proxmox VE 8.x / 9.x
  • Two PBS datastores, both using namespaces (jacob and camp)
  • Without the fix: 0 backups discovered
  • With the fix: 743 backups discovered across 39 containers

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions