@@ -21,7 +21,6 @@ import (
2121 "strings"
2222 "time"
2323
24- "github.com/golang/glog"
2524 crdv1 "github.com/kubernetes-csi/external-snapshotter/pkg/apis/volumesnapshot/v1alpha1"
2625 "k8s.io/api/core/v1"
2726 storagev1 "k8s.io/api/storage/v1"
@@ -560,27 +559,31 @@ func (ctrl *csiSnapshotController) checkandUpdateBoundSnapshotStatusOperation(sn
560559 var timestamp int64
561560 var size int64
562561 var readyToUse = false
562+ var driverName string
563+ var snapshotID string
563564
564565 if snapshot .Spec .Source == nil {
565- klog .V (5 ).Infof ("checkandUpdateBoundSnapshotStatusOperation: snapshot [%s] is pre-bound to content [%s]" , snapshot .Name , content .Name )
566+ klog .V (5 ).Infof ("checkandUpdateBoundSnapshotStatusOperation: checking whether snapshot [%s] is pre-bound to content [%s]" , snapshot .Name , content .Name )
566567 readyToUse , timestamp , size , err = ctrl .handler .GetSnapshotStatus (content )
567568 if err != nil {
569+ klog .Errorf ("checkandUpdateBoundSnapshotStatusOperation: failed to call get snapshot status to check whether snapshot is ready to use %q" , err )
568570 return nil , err
569571 }
572+ if content .Spec .CSI != nil {
573+ driverName , snapshotID = content .Spec .CSI .Driver , content .Spec .CSI .SnapshotHandle
574+ }
570575 } else {
571576 class , volume , _ , snapshotterCredentials , err := ctrl .getCreateSnapshotInput (snapshot )
572577 if err != nil {
573578 return nil , fmt .Errorf ("failed to get input parameters to create snapshot %s: %q" , snapshot .Name , err )
574579 }
575- var driverName string
576- var snapshotID string
577580 driverName , snapshotID , timestamp , size , readyToUse , err = ctrl .handler .CreateSnapshot (snapshot , volume , class .Parameters , snapshotterCredentials )
578581 if err != nil {
579- glog .Errorf ("checkandUpdateBoundSnapshotStatusOperation: failed to call create snapshot to check whether the snapshot is ready to use %q" , err )
582+ klog .Errorf ("checkandUpdateBoundSnapshotStatusOperation: failed to call create snapshot to check whether the snapshot is ready to use %q" , err )
580583 return nil , err
581584 }
582- klog .V (5 ).Infof ("checkandUpdateBoundSnapshotStatusOperation: driver %s, snapshotId %s, timestamp %d, size %d, readyToUse %t" , driverName , snapshotID , timestamp , size , readyToUse )
583585 }
586+ klog .V (5 ).Infof ("checkandUpdateBoundSnapshotStatusOperation: driver %s, snapshotId %s, timestamp %d, size %d, readyToUse %t" , driverName , snapshotID , timestamp , size , readyToUse )
584587
585588 if timestamp == 0 {
586589 timestamp = time .Now ().UnixNano ()
0 commit comments