retry content update if it was delete before snapshot
@@ -60,6 +60,8 @@ const (
vmSnapshotDeadlineExceededError = "snapshot deadline exceeded"
snapshotRetryInterval = 5 * time.Second
+
+ contentDeletionInterval = 5 * time.Second
)
func VmSnapshotReady(vmSnapshot *snapshotv1.VirtualMachineSnapshot) bool {
@@ -99,6 +101,10 @@ func shouldDeleteContent(vmSnapshot *snapshotv1.VirtualMachineSnapshot, content
return deleteContentPolicy(vmSnapshot) || !vmSnapshotContentReady(content)
}
+func vmSnapshotContentDeleting(content *snapshotv1.VirtualMachineSnapshotContent) bool {
+ return content != nil && content.DeletionTimestamp != nil
+}
+
func vmSnapshotDeleting(vmSnapshot *snapshotv1.VirtualMachineSnapshot) bool {
return vmSnapshot != nil && vmSnapshot.DeletionTimestamp != nil
}
@@ -276,6 +282,12 @@ func (ctrl *VMSnapshotController) updateVMSnapshotContent(content *snapshotv1.Vi
}
}
+ if vmSnapshotContentDeleting(content) {
+ log.Log.V(3).Infof("Content deleting %s/%s", content.Namespace, content.Name)
+ return contentDeletionInterval, nil
+
+ }
+
currentlyReady := vmSnapshotContentReady(content)
currentlyError := (content.Status != nil && content.Status.Error != nil) || vmSnapshotError(vmSnapshot) != nil
