Skip to content

Commit

Permalink
Issue #88: Improve error message for better debugging.
Browse files Browse the repository at this point in the history
Signed-off-by: Shishir Mahajan <[email protected]>
  • Loading branch information
shishir-a412ed committed Oct 2, 2020
1 parent 933ce38 commit 99e2053
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ func (l *lvmDriver) Create(req *volume.CreateRequest) error {
return fmt.Errorf("Please don't specify --opt keyfile= for snapshots")
}
if isThinSnap, _, err = isThinlyProvisioned(vgName, snap); err != nil {
l.logger.Err(fmt.Sprintf("Create: lvdisplayGrep error: %s", err))
l.logger.Err(fmt.Sprintf("Create: lvdisplayGrep error: %v", err))
return fmt.Errorf("Error creating volume")
}
}
Expand Down Expand Up @@ -237,6 +237,7 @@ func (l *lvmDriver) Get(req *volume.GetRequest) (*volume.GetResponse, error) {

createdAt, err := getVolumeCreationDateTime(v.VgName, v.Name)
if err != nil {
l.logger.Err(fmt.Sprintf("Get: %v", err))
return nil, err
}

Expand Down
2 changes: 1 addition & 1 deletion utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ func loadFromDisk(l *lvmDriver) error {
func lvdisplayGrep(vgName, lvName, keyword string) (bool, string, error) {
outByttes, err := exec.Command("lvdisplay", fmt.Sprintf("/dev/%s/%s", vgName, lvName)).Output()
if err != nil {
return false, "", err
return false, "", fmt.Errorf("Error in lvdisplay. This usually happens if one of the underlying lvm volumes is missing or deleted: %v", err)
}
var result []string
outStr := strings.TrimSpace(string(outByttes[:]))
Expand Down

0 comments on commit 99e2053

Please sign in to comment.