Skip to content

Commit

Permalink
Fix deploy test-driver range and add logs
Browse files Browse the repository at this point in the history
  • Loading branch information
Jiawei0227 committed Dec 11, 2020
1 parent 075d973 commit 9a4bfc1
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 2 deletions.
2 changes: 2 additions & 0 deletions deploy/kubernetes-1.17/test-driver.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ SnapshotClass:
FromName: true
DriverInfo:
Name: hostpath.csi.k8s.io
SupportedSizeRange:
Min: 1Mi
Capabilities:
block: true
controllerExpansion: true
Expand Down
5 changes: 3 additions & 2 deletions docs/example-snapshots-1.17-and-later.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Ensure your volumesnapshotclass was created during hostpath deployment:
> $ kubectl describe volumesnapshotclass
> ```
> Name: csi-hostpath-snapclass
> Namespace:
> Namespace:
> Labels: <none>
> Annotations: kubectl.kubernetes.io/last-applied-configuration:
> {"apiVersion":"snapshot.storage.k8s.io/v1beta1","deletionPolicy":"Delete","driver":"hostpath.csi.k8s.io","kind":"VolumeSnapshotClass","met...
Expand Down Expand Up @@ -89,7 +89,7 @@ use the volume snapshot class to dynamically create a volume snapshot:
> $ kubectl describe volumesnapshotcontent
> ```
> Name: snapcontent-1b461d4e-6279-4f1d-9910-61d35d80c888
> Namespace:
> Namespace:
> Labels: <none>
> Annotations: <none>
> API Version: snapshot.storage.k8s.io/v1beta1
Expand Down Expand Up @@ -126,6 +126,7 @@ use the volume snapshot class to dynamically create a volume snapshot:
## Restore volume from snapshot support
Follow the following example to create a volume from a volume snapshot:
Note that as the PVC size goes larger, the restore can be slower.
> $ kubectl apply -f examples/csi-restore.yaml
> `persistentvolumeclaim/hpvc-restore created`
Expand Down
1 change: 1 addition & 0 deletions pkg/hostpath/controllerserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,7 @@ func (cs *controllerServer) CreateVolume(ctx context.Context, req *csi.CreateVol
err = status.Errorf(codes.InvalidArgument, "%v not a proper volume source", volumeSource)
}
if err != nil {
glog.V(4).Infof("VolumeSource error: %v", err)
if delErr := deleteHostpathVolume(volumeID); delErr != nil {
glog.V(2).Infof("deleting hostpath volume %v failed: %v", volumeID, delErr)
}
Expand Down
2 changes: 2 additions & 0 deletions pkg/hostpath/hostpath.go
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,9 @@ func loadFromSnapshot(size int64, snapshotId, destPath string, mode accessType)
}

executor := utilexec.New()
glog.V(4).Infof("Command Start: %v", cmd)
out, err := executor.Command(cmd[0], cmd[1:]...).CombinedOutput()
glog.V(4).Infof("Command Finish: %v", string(out))
if err != nil {
return status.Errorf(codes.Internal, "failed pre-populate data from snapshot %v: %v: %s", snapshotId, err, out)
}
Expand Down
3 changes: 3 additions & 0 deletions pkg/hostpath/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,9 @@ func parseEndpoint(ep string) (string, string, error) {
}

func logGRPC(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (interface{}, error) {
if info.FullMethod == "/csi.v1.Identity/Probe" {
return handler(ctx, req)
}
glog.V(3).Infof("GRPC call: %s", info.FullMethod)
glog.V(5).Infof("GRPC request: %+v", protosanitizer.StripSecrets(req))
resp, err := handler(ctx, req)
Expand Down

0 comments on commit 9a4bfc1

Please sign in to comment.