fix(migration): add debug logging for volume migration (#5700)

* add debug logging

* Update api/bolt/migrator/migrate_dbversion31.go

* log resource control delete

Co-authored-by: Stéphane Busso <sbusso@users.noreply.github.com>
pull/5710/head
Hui 3 years ago committed by GitHub
parent fc52830c7d
commit a6138dd5a3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -2,6 +2,7 @@ package migrator
import ( import (
"fmt" "fmt"
"log"
portainer "github.com/portainer/portainer/api" portainer "github.com/portainer/portainer/api"
"github.com/portainer/portainer/api/bolt/errors" "github.com/portainer/portainer/api/bolt/errors"
@ -167,6 +168,7 @@ func (m *Migrator) updateVolumeResourceControlToDB32() error {
totalSnapshots := len(endpoint.Snapshots) totalSnapshots := len(endpoint.Snapshots)
if totalSnapshots == 0 { if totalSnapshots == 0 {
log.Println("[DEBUG] [volume migration] [message: no snapshot found]")
continue continue
} }
@ -179,6 +181,7 @@ func (m *Migrator) updateVolumeResourceControlToDB32() error {
if volumesData, done := snapshot.SnapshotRaw.Volumes.(map[string]interface{}); done { if volumesData, done := snapshot.SnapshotRaw.Volumes.(map[string]interface{}); done {
if volumesData["Volumes"] == nil { if volumesData["Volumes"] == nil {
log.Println("[DEBUG] [volume migration] [message: no volume data found]")
continue continue
} }
@ -199,7 +202,7 @@ func (m *Migrator) updateVolumeResourceControlToDB32() error {
if err != nil { if err != nil {
return fmt.Errorf("failed deleting resource control %d: %w", resourceControl.ID, err) return fmt.Errorf("failed deleting resource control %d: %w", resourceControl.ID, err)
} }
log.Printf("[DEBUG] [volume migration] [message: legacy resource control(%s) has been deleted]", resourceControl.ResourceID)
} }
} }

Loading…
Cancel
Save