StartBackupMonitor starts monitoring a backup task.
(upid, nodeName string, vmid int)
| 745 | |
| 746 | // StartBackupMonitor starts monitoring a backup task. |
| 747 | func (a *App) StartBackupMonitor(upid, nodeName string, vmid int) { |
| 748 | // Resolve client |
| 749 | var client *api.Client |
| 750 | if a.isGroupMode { |
| 751 | // Find node in global state to get source profile |
| 752 | var node *api.Node |
| 753 | for _, n := range models.GlobalState.OriginalNodes { |
| 754 | if n != nil && n.Name == nodeName { |
| 755 | node = n |
| 756 | break |
| 757 | } |
| 758 | } |
| 759 | if node != nil { |
| 760 | c, err := a.getClientForNode(node) |
| 761 | if err == nil { |
| 762 | client = c |
| 763 | } |
| 764 | } |
| 765 | } else { |
| 766 | client = a.client |
| 767 | } |
| 768 | |
| 769 | if client == nil { |
| 770 | a.logger.Error("Could not resolve client for backup monitoring task %s (node %s)", upid, nodeName) |
| 771 | return |
| 772 | } |
| 773 | |
| 774 | a.poller.AddTask(client, upid, nodeName, vmid) |
| 775 | } |
| 776 | |
| 777 | // GetActiveBackupsForVM returns a list of active backups for a specific VM. |
| 778 | func (a *App) GetActiveBackupsForVM(vmid int) []*taskpoller.TaskInfo { |
no test coverage detected