fix: properly identify PMG host config backups

Addresses #359 - PMG host config backups with VMID=0 are now correctly
identified as "Host" type instead of being misidentified as LXC containers.
Added purple color scheme for Host type backups in the UI.
This commit is contained in:
Pulse Monitor
2025-08-27 18:52:27 +00:00
parent 31f86be0b3
commit 3995a7dacb
2 changed files with 12 additions and 2 deletions
@@ -8,7 +8,7 @@ import { MetricBar } from '@/components/Dashboard/MetricBar';
import { BackupsFilter } from './BackupsFilter';
type BackupType = 'snapshot' | 'local' | 'remote';
type GuestType = 'VM' | 'LXC' | 'Template' | 'ISO';
type GuestType = 'VM' | 'LXC' | 'Host' | 'Template' | 'ISO';
interface UnifiedBackup {
backupType: BackupType;
@@ -246,6 +246,8 @@ const UnifiedBackups: Component = () => {
displayType = 'VM';
} else if (backup.type === 'lxc') {
displayType = 'LXC';
} else if (backup.type === 'host') {
displayType = 'Host'; // PMG host config backups
} else {
displayType = 'LXC'; // Default fallback (most people have more containers than VMs)
}
@@ -1676,6 +1678,8 @@ const UnifiedBackups: Component = () => {
<span class={`inline-flex items-center px-1.5 py-0.5 rounded text-xs font-medium ${
item.type === 'VM'
? 'bg-blue-100 text-blue-700 dark:bg-blue-900/50 dark:text-blue-300'
: item.type === 'Host'
? 'bg-purple-100 text-purple-700 dark:bg-purple-900/50 dark:text-purple-300'
: 'bg-green-100 text-green-700 dark:bg-green-900/50 dark:text-green-300'
}`}>
{item.type}
+7 -1
View File
@@ -2254,7 +2254,10 @@ func (m *Monitor) pollStorageBackupsWithNodes(ctx context.Context, instanceName
// Determine type from content type and volid
backupType := "unknown"
if strings.Contains(content.Volid, "/vm/") || strings.Contains(content.Volid, "qemu") {
// Check for PMG host backups (VMID=0 and contains pmgbackup)
if content.VMID == 0 && strings.Contains(content.Volid, "pmgbackup") {
backupType = "host"
} else if strings.Contains(content.Volid, "/vm/") || strings.Contains(content.Volid, "qemu") {
backupType = "qemu"
} else if strings.Contains(content.Volid, "/ct/") || strings.Contains(content.Volid, "lxc") {
backupType = "lxc"
@@ -2264,6 +2267,9 @@ func (m *Monitor) pollStorageBackupsWithNodes(ctx context.Context, instanceName
} else if strings.Contains(content.Format, "pbs-vm") {
// PBS format check as fallback
backupType = "qemu"
} else if content.VMID == 0 {
// Any other VMID=0 backup is likely a host backup
backupType = "host"
}
// For shared storage (like PBS), use the storage name as node