Skip to content

Commit 3f15e92

Browse files
committed
Remove the skipped item from the resource list when it's skipped by BIA.
Signed-off-by: Xun Jiang <xun.jiang@broadcom.com>
1 parent bcdee1b commit 3f15e92

2 files changed

Lines changed: 10 additions & 0 deletions

File tree

pkg/backup/backed_up_items_map.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,14 @@ func (m *backedUpItemsMap) AddItem(key itemKey) {
9898
m.totalItems[key] = struct{}{}
9999
}
100100

101+
func (m *backedUpItemsMap) DeleteItem(key itemKey) {
102+
m.Lock()
103+
defer m.Unlock()
104+
105+
delete(m.backedUpItems, key)
106+
delete(m.totalItems, key)
107+
}
108+
101109
func (m *backedUpItemsMap) AddItemToTotal(key itemKey) {
102110
m.Lock()
103111
defer m.Unlock()

pkg/backup/item_backupper.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,8 @@ func (ib *itemBackupper) backupItemInternal(logger logrus.FieldLogger, obj runti
247247
// If err is nil and updatedObj is nil, it means the item is skipped by plugin action,
248248
// we should return here to avoid backing up the item, and avoid potential NPE in the following code.
249249
if updatedObj == nil {
250+
log.Infof("Remove item from the backup's backupItems list and totalItems list because it's skipped by plugin action.")
251+
ib.backupRequest.BackedUpItems.DeleteItem(key)
250252
return false, itemFiles, nil
251253
}
252254

0 commit comments

Comments
 (0)