Skip to content

Commit f6e00b0

Browse files
authored
Merge pull request #2218 from mattcary/snap-log
Increase logging of snapshot status
2 parents 665558d + b877ad9 commit f6e00b0

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

pkg/gce-pd-csi-driver/controller.go

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1705,7 +1705,7 @@ func (gceCS *GCEControllerServer) createPDSnapshot(ctx context.Context, project
17051705
return nil, status.Errorf(codes.Internal, "Failed to covert creation timestamp: %v", err.Error())
17061706
}
17071707

1708-
ready, err := isCSISnapshotReady(snapshot.Status)
1708+
ready, err := isCSISnapshotReady(snapshot)
17091709
if err != nil {
17101710
return nil, status.Errorf(codes.Internal, "Snapshot had error checking ready status: %v", err.Error())
17111711
}
@@ -1847,15 +1847,13 @@ func (gceCS *GCEControllerServer) validateExistingSnapshot(snapshot *compute.Sna
18471847
return nil
18481848
}
18491849

1850-
func isCSISnapshotReady(status string) (bool, error) {
1851-
switch status {
1850+
func isCSISnapshotReady(snapshot *compute.Snapshot) (bool, error) {
1851+
klog.V(4).Infof("snapshot %s is %s", snapshot.SelfLink, snapshot.Status)
1852+
switch snapshot.Status {
18521853
case "READY":
18531854
return true, nil
18541855
case "FAILED":
1855-
return false, fmt.Errorf("snapshot status is FAILED")
1856-
case "DELETING":
1857-
klog.V(4).Infof("snapshot is in DELETING")
1858-
fallthrough
1856+
return false, fmt.Errorf("snapshot %s status is FAILED", snapshot.SelfLink)
18591857
default:
18601858
return false, nil
18611859
}
@@ -2103,7 +2101,7 @@ func generateDiskSnapshotEntry(snapshot *compute.Snapshot) (*csi.ListSnapshotsRe
21032101
// We ignore the error intentionally here since we are just listing snapshots
21042102
// TODO: If the snapshot is in "FAILED" state we need to think through what this
21052103
// should actually look like.
2106-
ready, _ := isCSISnapshotReady(snapshot.Status)
2104+
ready, _ := isCSISnapshotReady(snapshot)
21072105

21082106
entry := &csi.ListSnapshotsResponse_Entry{
21092107
Snapshot: &csi.Snapshot{

0 commit comments

Comments
 (0)