@@ -147,7 +147,7 @@ func (ctrl *csiSnapshotController) syncSnapshot(snapshot *crdv1.VolumeSnapshot)
|
||||
}
|
||||
}
|
||||
|
||||
// syncReadySnapshot checks the snapshot which has been bound to snapshot content succesfully before.
|
||||
// syncReadySnapshot checks the snapshot which has been bound to snapshot content successfully before.
|
||||
// If there is any problem with the binding (e.g., snapshot points to a non-exist snapshot content), update the snapshot status and emit event.
|
||||
func (ctrl *csiSnapshotController) syncReadySnapshot(snapshot *crdv1.VolumeSnapshot) error {
|
||||
if snapshot.Spec.SnapshotContentName == "" {
|
||||
@@ -268,7 +268,7 @@ func (ctrl *csiSnapshotController) getMatchSnapshotContent(snapshot *crdv1.Volum
|
||||
// deleteSnapshotContent starts delete action.
|
||||
func (ctrl *csiSnapshotController) deleteSnapshotContent(content *crdv1.VolumeSnapshotContent) {
|
||||
operationName := fmt.Sprintf("delete-%s[%s]", content.Name, string(content.UID))
|
||||
glog.V(5).Infof("Snapshotter is about to delete volume snapshot and the operation named %s", operationName)
|
||||
glog.V(5).Infof("Snapshotter is about to delete volume snapshot content and the operation named %s", operationName)
|
||||
ctrl.scheduleOperation(operationName, func() error {
|
||||
return ctrl.deleteSnapshotContentOperation(content)
|
||||
})
|
||||
@@ -553,7 +553,7 @@ func (ctrl *csiSnapshotController) createSnapshotOperation(snapshot *crdv1.Volum
|
||||
}
|
||||
|
||||
if err != nil {
|
||||
// Save failed. Now we have a storage asset outside of Kubernetes,
|
||||
// Save failed. Now we have a snapshot asset outside of Kubernetes,
|
||||
// but we don't have appropriate volumesnapshot content object for it.
|
||||
// Emit some event here and controller should try to create the content in next sync period.
|
||||
strerr := fmt.Sprintf("Error creating volume snapshot content object for snapshot %s: %v.", snapshotKey(snapshot), err)
|
||||
@@ -771,8 +771,8 @@ func (ctrl *csiSnapshotController) GetSnapshotClass(className string) (*crdv1.Vo
|
||||
|
||||
class, err := ctrl.classLister.Get(className)
|
||||
if err != nil {
|
||||
glog.Errorf("failed to retrieve snapshot class %s from the API server: %q", className, err)
|
||||
return nil, fmt.Errorf("failed to retrieve snapshot class %s from the API server: %q", className, err)
|
||||
glog.Errorf("failed to retrieve snapshot class %s from the informer: %q", className, err)
|
||||
return nil, fmt.Errorf("failed to retrieve snapshot class %s from the informer: %q", className, err)
|
||||
}
|
||||
|
||||
return class, nil
|
||||
|
@@ -293,7 +293,7 @@ func (ctrl *csiSnapshotController) contentWorker() {
|
||||
}
|
||||
if !found {
|
||||
// The controller has already processed the delete event and
|
||||
// deleted the volume from its cache
|
||||
// deleted the content from its cache
|
||||
glog.V(2).Infof("deletion of content %q was already processed", key)
|
||||
return false
|
||||
}
|
||||
@@ -435,7 +435,7 @@ func (ctrl *csiSnapshotController) deleteSnapshot(snapshot *crdv1.VolumeSnapshot
|
||||
ctrl.contentQueue.Add(snapshotContentName)
|
||||
}
|
||||
|
||||
// deleteContent runs in worker thread and handles "snapshot deleted" event.
|
||||
// deleteContent runs in worker thread and handles "content deleted" event.
|
||||
func (ctrl *csiSnapshotController) deleteContent(content *crdv1.VolumeSnapshotContent) {
|
||||
_ = ctrl.contentStore.Delete(content)
|
||||
glog.V(4).Infof("content %q deleted", content.Name)
|
||||
|
@@ -234,7 +234,7 @@ func TestCreateSnapshotSync(t *testing.T) {
|
||||
initialContents: nocontents,
|
||||
expectedContents: nocontents,
|
||||
initialSnapshots: newSnapshotArray("snap7-1", classNonExisting, "", "snapuid7-1", "claim7-1", false, nil, nil, nil),
|
||||
expectedSnapshots: newSnapshotArray("snap7-1", classNonExisting, "", "snapuid7-1", "claim7-1", false, newVolumeError("Failed to create snapshot: failed to retrieve snapshot class non-existing from the API server: \"volumesnapshotclass.snapshot.storage.k8s.io \\\"non-existing\\\" not found\""), nil, nil),
|
||||
expectedSnapshots: newSnapshotArray("snap7-1", classNonExisting, "", "snapuid7-1", "claim7-1", false, newVolumeError("Failed to create snapshot: failed to retrieve snapshot class non-existing from the informer: \"volumesnapshotclass.snapshot.storage.k8s.io \\\"non-existing\\\" not found\""), nil, nil),
|
||||
initialClaims: newClaimArray("claim7-1", "pvc-uid7-1", "1Gi", "volume7-1", v1.ClaimBound, &classEmpty),
|
||||
initialVolumes: newVolumeArray("volume7-1", "pv-uid7-1", "pv-handle7-1", "1Gi", "pvc-uid7-1", "claim7-1", v1.VolumeBound, v1.PersistentVolumeReclaimDelete, classEmpty),
|
||||
expectedEvents: []string{"Warning SnapshotCreationFailed"},
|
||||
@@ -258,7 +258,7 @@ func TestCreateSnapshotSync(t *testing.T) {
|
||||
initialContents: nocontents,
|
||||
expectedContents: nocontents,
|
||||
initialSnapshots: newSnapshotArray("snap7-3", "", "", "snapuid7-3", "claim7-3", false, nil, nil, nil),
|
||||
expectedSnapshots: newSnapshotArray("snap7-3", "", "", "snapuid7-3", "claim7-3", false, newVolumeError("Failed to create snapshot: failed to retrieve snapshot class from the API server: \"volumesnapshotclass.snapshot.storage.k8s.io \\\"\\\" not found\""), nil, nil),
|
||||
expectedSnapshots: newSnapshotArray("snap7-3", "", "", "snapuid7-3", "claim7-3", false, newVolumeError("Failed to create snapshot: failed to retrieve snapshot class from the informer: \"volumesnapshotclass.snapshot.storage.k8s.io \\\"\\\" not found\""), nil, nil),
|
||||
initialClaims: newClaimArray("claim7-3", "pvc-uid7-3", "1Gi", "volume7-3", v1.ClaimBound, &classEmpty),
|
||||
initialVolumes: newVolumeArray("volume7-3", "pv-uid7-3", "pv-handle7-3", "1Gi", "pvc-uid7-3", "claim7-3", v1.VolumeBound, v1.PersistentVolumeReclaimDelete, classEmpty),
|
||||
initialStorageClasses: []*storage.StorageClass{diffDriverStorageClass},
|
||||
|
Reference in New Issue
Block a user