Uploaded image for project: 'OpenShift Virtualization'
  1. OpenShift Virtualization
  2. CNV-41559

VMRestore webhook shouldn't check snapshot exist

XMLWordPrintable

    • Icon: Story Story
    • Resolution: Unresolved
    • Icon: Normal Normal
    • None
    • None
    • None
    • 5
    • False
    • Hide

      None

      Show
      None
    • False
    • None
    • CNV-38613 - 2024 Code Quality
    • No
    • ---
    • ---
    • Storage Core Sprint 254

      In webhooks we want to prevent failing requests when they are raceful.

      Currently when creating the restore we check in the webhook a function called: validateSnapshot

      1. we check that the snapshot exists. This is racy instead we should allow the restore to be created and show in the conditions that the snapshot doesnt exist yet.

      2. I believe we should keep the get of the snapshot, return in case it doesnt exist, but if it exists we should check if the snapshot is in failed state since failed phase is permanent and no point in creating restore if snapshot is failed.

      3. We should remove the check of 'readyToUse' since this state is changeable and racy.

      4. And lastly in the same function we also check: sourceTargetVmsAreDifferent.

      This is also racy since its possible that the target VM currently doesnt exist, but will exist a second later. 

            skagan@redhat.com Shelly Kagan
            skagan@redhat.com Shelly Kagan
            Ying Cui Ying Cui
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: