Re-queue SnapshotContents that are readyToUse: false
SnapshotContents with readyToUse: false should be periodically requeued with exp. backoff until the CSI driver confirms the snapshot is ready.
This commit is contained in:
@@ -198,6 +198,98 @@ func TestSyncContent(t *testing.T) {
|
||||
errors: noerrors,
|
||||
test: testSyncContent,
|
||||
},
|
||||
{
|
||||
name: "1-7: Just created un-ready snapshot should be requeued",
|
||||
// A new snapshot should be created
|
||||
initialContents: withContentStatus(newContentArray("content1-7", "snapuid1-7", "snap1-7", "sid1-7", defaultClass, "", "volume-handle-1-7", retainPolicy, nil, &defaultSize, true),
|
||||
nil),
|
||||
expectedContents: withContentAnnotations(withContentStatus(newContentArray("content1-7", "snapuid1-7", "snap1-7", "sid1-7", defaultClass, "", "volume-handle-1-7", retainPolicy, nil, &defaultSize, true),
|
||||
&crdv1.VolumeSnapshotContentStatus{SnapshotHandle: toStringPointer("snapuid1-7"), RestoreSize: &defaultSize, ReadyToUse: &False}),
|
||||
map[string]string{}),
|
||||
expectedEvents: noevents,
|
||||
expectedCreateCalls: []createCall{
|
||||
{
|
||||
volumeHandle: "volume-handle-1-7",
|
||||
snapshotName: "snapshot-snapuid1-7",
|
||||
driverName: mockDriverName,
|
||||
snapshotId: "snapuid1-7",
|
||||
parameters: map[string]string{
|
||||
utils.PrefixedVolumeSnapshotNameKey: "snap1-7",
|
||||
utils.PrefixedVolumeSnapshotNamespaceKey: "default",
|
||||
utils.PrefixedVolumeSnapshotContentNameKey: "content1-7",
|
||||
},
|
||||
creationTime: timeNow,
|
||||
readyToUse: false,
|
||||
size: defaultSize,
|
||||
},
|
||||
},
|
||||
errors: noerrors,
|
||||
expectRequeue: true,
|
||||
expectSuccess: true,
|
||||
test: testSyncContent,
|
||||
},
|
||||
{
|
||||
name: "1-8: Un-ready snapshot that remains un-ready should be requeued",
|
||||
// An un-ready snapshot already exists, it will be refreshed
|
||||
initialContents: withContentAnnotations(withContentStatus(newContentArray("content1-8", "snapuid1-8", "snap1-8", "sid1-8", defaultClass, "", "volume-handle-1-8", retainPolicy, nil, &defaultSize, true),
|
||||
&crdv1.VolumeSnapshotContentStatus{SnapshotHandle: toStringPointer("snapuid1-8"), RestoreSize: &defaultSize, ReadyToUse: &False}),
|
||||
map[string]string{}),
|
||||
expectedContents: withContentAnnotations(withContentStatus(newContentArray("content1-8", "snapuid1-8", "snap1-8", "sid1-8", defaultClass, "", "volume-handle-1-8", retainPolicy, nil, &defaultSize, true),
|
||||
&crdv1.VolumeSnapshotContentStatus{SnapshotHandle: toStringPointer("snapuid1-8"), RestoreSize: &defaultSize, ReadyToUse: &False}),
|
||||
map[string]string{}),
|
||||
expectedEvents: noevents,
|
||||
expectedCreateCalls: []createCall{
|
||||
{
|
||||
volumeHandle: "volume-handle-1-8",
|
||||
snapshotName: "snapshot-snapuid1-8",
|
||||
driverName: mockDriverName,
|
||||
snapshotId: "snapuid1-8",
|
||||
parameters: map[string]string{
|
||||
utils.PrefixedVolumeSnapshotNameKey: "snap1-8",
|
||||
utils.PrefixedVolumeSnapshotNamespaceKey: "default",
|
||||
utils.PrefixedVolumeSnapshotContentNameKey: "content1-8",
|
||||
},
|
||||
creationTime: timeNow,
|
||||
readyToUse: false,
|
||||
size: defaultSize,
|
||||
},
|
||||
},
|
||||
errors: noerrors,
|
||||
expectRequeue: true,
|
||||
expectSuccess: true,
|
||||
test: testSyncContent,
|
||||
},
|
||||
{
|
||||
name: "1-9: Un-ready snapshot that becomes ready should not be requeued",
|
||||
// An un-ready snapshot already exists, it will be refreshed
|
||||
initialContents: withContentAnnotations(withContentStatus(newContentArray("content1-9", "snapuid1-9", "snap1-9", "sid1-9", defaultClass, "", "volume-handle-1-9", retainPolicy, nil, &defaultSize, true),
|
||||
&crdv1.VolumeSnapshotContentStatus{SnapshotHandle: toStringPointer("snapuid1-9"), RestoreSize: &defaultSize, ReadyToUse: &False}),
|
||||
map[string]string{}),
|
||||
expectedContents: withContentAnnotations(withContentStatus(newContentArray("content1-9", "snapuid1-9", "snap1-9", "sid1-9", defaultClass, "", "volume-handle-1-9", retainPolicy, nil, &defaultSize, true),
|
||||
&crdv1.VolumeSnapshotContentStatus{SnapshotHandle: toStringPointer("snapuid1-9"), RestoreSize: &defaultSize, ReadyToUse: &True}),
|
||||
map[string]string{}),
|
||||
expectedEvents: noevents,
|
||||
expectedCreateCalls: []createCall{
|
||||
{
|
||||
volumeHandle: "volume-handle-1-9",
|
||||
snapshotName: "snapshot-snapuid1-9",
|
||||
driverName: mockDriverName,
|
||||
snapshotId: "snapuid1-9",
|
||||
parameters: map[string]string{
|
||||
utils.PrefixedVolumeSnapshotNameKey: "snap1-9",
|
||||
utils.PrefixedVolumeSnapshotNamespaceKey: "default",
|
||||
utils.PrefixedVolumeSnapshotContentNameKey: "content1-9",
|
||||
},
|
||||
creationTime: timeNow,
|
||||
readyToUse: true,
|
||||
size: defaultSize,
|
||||
},
|
||||
},
|
||||
errors: noerrors,
|
||||
expectRequeue: false,
|
||||
expectSuccess: true,
|
||||
test: testSyncContent,
|
||||
},
|
||||
}
|
||||
|
||||
runSyncContentTests(t, tests, snapshotClasses)
|
||||
|
Reference in New Issue
Block a user