Skip to content

Commit 10e5282

Browse files
shuo-wuyasker
authored andcommitted
show error info of listing backup volume in logs
https://github.com/rancher/longhorn/issues/399
1 parent 206e1fa commit 10e5282

File tree

17 files changed

+1654
-3
lines changed

17 files changed

+1654
-3
lines changed

engineapi/backups.go

+17-3
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import (
1010
"github.com/mitchellh/mapstructure"
1111
"github.com/pkg/errors"
1212

13+
"github.com/rancher/backupstore"
1314
"github.com/rancher/longhorn-manager/types"
1415
"github.com/rancher/longhorn-manager/util"
1516
)
@@ -26,6 +27,7 @@ type backupVolume struct {
2627
Created string
2728
LastBackupName string
2829
SpaceUsage string
30+
Messages map[backupstore.MessageType]string
2931
Backups map[string]interface{}
3032
}
3133

@@ -86,10 +88,22 @@ func parseBackupVolumesList(output string) ([]*BackupVolume, error) {
8688
volumes := []*BackupVolume{}
8789

8890
for name, v := range data {
91+
if v.Messages != nil {
92+
for mType, mContent := range v.Messages {
93+
if mType == backupstore.MessageTypeError {
94+
logrus.Errorf("message from backupVolume[%v], type[%v], content[%v]",
95+
name, mType, mContent)
96+
} else {
97+
logrus.Warnf("message from backupVolume[%v], type[%v], content[%v]",
98+
name, mType, mContent)
99+
}
100+
}
101+
}
89102
volumes = append(volumes, &BackupVolume{
90-
Name: name,
91-
Size: v.Size,
92-
Created: v.Created,
103+
Name: name,
104+
Size: v.Size,
105+
Created: v.Created,
106+
Messages: v.Messages,
93107
})
94108
}
95109

engineapi/types.go

+2
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import (
44
"fmt"
55
"strings"
66

7+
"github.com/rancher/backupstore"
78
"github.com/rancher/longhorn-manager/types"
89
)
910

@@ -85,6 +86,7 @@ type BackupVolume struct {
8586
Created string `json:"created"`
8687
LastBackupName string
8788
SpaceUsage string
89+
Messages map[backupstore.MessageType]string `json:"messages"`
8890
Backups map[string]*Backup
8991
BaseImage string `json:"baseImage"`
9092
}

vendor.conf

+1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ gopkg.in/check.v1 20d25e2
1515
github.com/satori/go.uuid 5bf94b69c6b68ee1b541973bb8e1144db23a194b
1616
gopkg.in/yaml.v2 v2.2.2
1717

18+
github.com/rancher/backupstore 750a0cc9c7555490b762f6070108a4f23a7132d3
1819
github.com/rancher/go-iscsi-helper c99e8cd573f9bbc78bdf0e479d2dc7f15e237792
1920
github.com/c9s/goprocinfo 0010a05ce49fde7f50669bc7ecda7d41dd6ab824
2021
github.com/kubernetes-incubator/external-storage v5.2.0

vendor/github.com/rancher/backupstore/Dockerfile.dapper

+39
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/github.com/rancher/backupstore/LICENSE

+201
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/github.com/rancher/backupstore/Makefile

+23
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/github.com/rancher/backupstore/README.md

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)