Skip to content

Commit 7ed1c78

Browse files
authored
Merge pull request #1478 from amacaskill/automated-cherry-pick-of-#1338-upstream-release-1.7
Automated cherry pick of #1338: Always call LoggedError for errors returned from
2 parents 9a574b7 + 88bc7e3 commit 7ed1c78

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

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

+5-5
Original file line numberDiff line numberDiff line change
@@ -590,7 +590,7 @@ func (gceCS *GCEControllerServer) executeControllerPublishVolume(ctx context.Con
590590
if gce.IsGCENotFoundError(err) {
591591
return nil, status.Errorf(codes.NotFound, "Could not find instance %v: %v", nodeID, err.Error()), diskType
592592
}
593-
return nil, status.Errorf(codes.Internal, "Failed to get instance: %v", err.Error()), diskType
593+
return nil, common.LoggedError("Failed to get instance: ", err), diskType
594594
}
595595

596596
readWrite := "READ_WRITE"
@@ -625,12 +625,12 @@ func (gceCS *GCEControllerServer) executeControllerPublishVolume(ctx context.Con
625625
machineType := parseMachineType(instance.MachineType)
626626
return nil, status.Errorf(codes.InvalidArgument, "'%s' is not a compatible disk type with the machine type %s, please review the GCP online documentation for available persistent disk options", udErr.DiskType, machineType), diskType
627627
}
628-
return nil, status.Errorf(codes.Internal, "Failed to Attach: %v", err.Error()), diskType
628+
return nil, common.LoggedError("Failed to Attach: ", err), diskType
629629
}
630630

631631
err = gceCS.CloudProvider.WaitForAttach(ctx, project, volKey, instanceZone, instanceName)
632632
if err != nil {
633-
return nil, status.Errorf(codes.Internal, "Errored during WaitForAttach: %v", err.Error()), diskType
633+
return nil, common.LoggedError("Errored during WaitForAttach: ", err), diskType
634634
}
635635

636636
klog.V(4).Infof("ControllerPublishVolume succeeded for disk %v to instance %v", volKey, nodeID)
@@ -722,7 +722,7 @@ func (gceCS *GCEControllerServer) executeControllerUnpublishVolume(ctx context.C
722722
klog.Warningf("Treating volume %v as unpublished because node %v could not be found", volKey.String(), instanceName)
723723
return &csi.ControllerUnpublishVolumeResponse{}, nil, diskType
724724
}
725-
return nil, status.Errorf(codes.Internal, "error getting instance: %v", err.Error()), diskType
725+
return nil, common.LoggedError("error getting instance: ", err), diskType
726726
}
727727

728728
deviceName, err := common.GetDeviceName(volKey)
@@ -972,7 +972,7 @@ func (gceCS *GCEControllerServer) createPDSnapshot(ctx context.Context, project
972972
snapshot, err = gceCS.CloudProvider.GetSnapshot(ctx, project, snapshotName)
973973
if err != nil {
974974
if !gce.IsGCEError(err, "notFound") {
975-
return nil, status.Errorf(codes.Internal, "Failed to get snapshot: %v", err.Error())
975+
return nil, common.LoggedError("Failed to get snapshot: ", err)
976976
}
977977
// If we could not find the snapshot, we create a new one
978978
snapshot, err = gceCS.CloudProvider.CreateSnapshot(ctx, project, volKey, snapshotName, snapshotParams)

0 commit comments

Comments
 (0)