Skip to content

Commit

Permalink
optimize(glance): wrap error of saving image (#20634)
Browse files Browse the repository at this point in the history
  • Loading branch information
zexi authored Jun 25, 2024
1 parent 60f1dbf commit 3c2e94a
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion pkg/image/models/images.go
Original file line number Diff line number Diff line change
Expand Up @@ -537,7 +537,7 @@ func (self *SImage) SaveImageFromStream(reader io.Reader, totalSize int64, calCh
format := ""
img, err := qemuimg.NewQemuImage(localPath)
if err != nil {
return err
return errors.Wrapf(err, "NewQemuImage %s", localPath)
}
format = string(img.Format)
virtualSizeBytes = img.SizeBytes
Expand Down
2 changes: 1 addition & 1 deletion pkg/util/procutils/remote_stat.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ func RemoteStat(filename string) (os.FileInfo, error) {
if strings.Contains(strings.ToLower(string(output)), "no such file or directory") {
return nil, os.ErrNotExist
}
return nil, errors.Wrap(err, "NewRemoteCommandAsFarAsPossible")
return nil, errors.Wrapf(err, "NewRemoteCommandAsFarAsPossible with stat %v: %s", args, output)
}
json, err := jsonutils.Parse(output)
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion pkg/util/qemuimg/qemuimg.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ func (img *SQemuImage) parse() error {
fileInfo, err := procutils.RemoteStat(img.Path)
if err != nil {
if !os.IsNotExist(err) {
return err
return errors.Wrapf(err, "remote stat of %s", img.Path)
} else {
// not created yet
return nil
Expand Down

0 comments on commit 3c2e94a

Please sign in to comment.