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

Virtctl image-upload returns 401 instead of 400 for PVC smaller than image

XMLWordPrintable

    • Quality / Stability / Reliability
    • 0.42
    • False
    • Hide

      None

      Show
      None
    • False
    • None
    • None

      Description of problem:

      When uploading a large image with virtctl image-upload to a DataVolume with a smaller PVC, virtctl sometimes returns a 401 error instead of the expected 400 “effective image size is larger than the reported available storage”. This happens even though the DV and upload pod are created and ready. 

      Version-Release number of selected component (if applicable):

      cnv-4.20 on bare-metal 

      How reproducible:

      20% 
      Occurs approximately 2 out of 10 attempts when uploading a large image to a small PVC. Intermittent behavior; sometimes the expected error is returned, sometimes a 401 Unauthorized is returned instead.

      Steps to Reproduce:

      Steps to Reproduce:
      
      
      1) Create a small DataVolume (e.g., 2Gi) with a hostpath CSI storage class:
      
      
      apiVersion: cdi.kubevirt.io/v1beta1
      kind: DataVolume
      metadata:
        name: upload-dv-test
        namespace: ahmad
      spec:
        pvc:
          accessModes:
            - ReadWriteOnce
          resources:
            requests:
              storage: 2Gi
          storageClassName: hostpath-csi-pvc-block
        source:
          upload: {}
      
      
      
      Start the image upload:
      
      
      2) virtctl image-upload dv upload-dv-test \
        --namespace=ahmad \
        --image-path=/home/cloud-user/ahmad/CentOS-Stream-GenericCloud-9-latest.x86_64.qcow2 \
        --size=2Gi \
        --insecure 

      Actual results:

      error: error uploading image after 5 retries: unexpected return value 401, 

      Expected results:

      Upload should fail with a 400 error, indicating that the image size is larger than the available PVC storage.
      example of expected output:
      
      error uploading image after 5 retries: unexpected return value 400, Saving stream failed: effective image size is larger than the reported available storage: virtual image size 10737418240 is larger than the reported available storage 2147483648. A larger PVC is required
      
      

      Additional info:

      we can try to reproduce using automated T2 test::test_print_response_body_on_error_upload_virtctl
      path: tests/storage/cdi_upload/test_upload_virtctl.py::test_print_response_body_on_error_upload_virtctl

              rh-ee-ahafe Ahmad Hafi
              rh-ee-ahafe Ahmad Hafi
              Natalie Gavrielov Natalie Gavrielov
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated: