Uploaded image for project: 'Migration Toolkit for Virtualization'
  1. Migration Toolkit for Virtualization
  2. MTV-2671

Migration from RHV to OpenShift Virtualization is failing with error "Running and RunStrategy are mutually exclusive"

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • 2.9.2
    • 2.8.5
    • Controller
    • Important

      Description of problem:

      Created a virtual machine with "Operating System" type "Linux" in RHV, the inventory cache of forklift have other_linux as OS type:

      # oc exec -c inventory forklift-controller-7f56fc46ff-5crp5 -- sh -c 'export token=`cat /var/run/secrets/kubernetes.io/serviceaccount/token`;curl -k -X GET -H "Authorization: Bearer $token" https://127.0.0.1:8443/providers/ovirt/87d83c9c-39da-498f-901b-f2e4ee381e14/vms/b1526bfc-509e-47c2-938f-94dc8705a24b' 2>/dev/null  |jq '.osType'
      
      "other_linux"

       
      This will not match any cluster preference and fallback to template selection:

      {"level":"info","ts":"2025-06-05 05:56:35.421","logger":"plan|6nw2f","msg":"Building VirtualMachine without a VirtualMachinePreference.","plan":{"name":"nijin-mtv","namespace":"openshift-mtv"},"migration":"openshift-mtv/nijin-mtv-rt6kx","vm":" id:b1526bfc-509e-47c2-938f-94dc8705a24b name:'nijin-mtv' ","err":"couldn't find a corresponding preference"}

      For template selection, it will search for templates with label rhel8.1 for this case as per https://github.com/kubev2v/forklift/blob/v2.8.3/pkg/controller/plan/adapter/ovirt/builder.go#L571-L572 
       
      That will be rhel8 templates and in OpenShift Virtualization < 4.18, these templates have "running" in spec:

      oc get template rhel8-server-medium -o yaml |yq '.objects[0].spec'
      dataVolumeTemplates:
        - apiVersion: cdi.kubevirt.io/v1beta1
          kind: DataVolume
          metadata:
      ...
      ...
      ...
                requests:
                  storage: 30Gi
      running: false                 <===
      template:
        metadata:
      ...
      ...
      
      

      Forklift then also sets runStrategy here https://github.com/kubev2v/forklift/blob/v2.8.3/pkg/controller/plan/kubevirt.go#L1470-L1475
       
      So the VM creation fails with following error:

              - description: Create VM.
                error:
                  phase: Running
                  reasons:
                    - 'admission webhook "virtualmachine-validator.kubevirt.io" denied the request: Running and RunStrategy are mutually exclusive'
                name: VirtualMachineCreation
                phase: Running
                progress:
                  completed: 0
                  total: 1
                started: "2025-06-05T05:56:34Z"
            restorePowerState: "On"
            started: "2025-06-05T05:51:23Z"

      Issue is not reproducible with 4.18 where in this version, templates have "runStrategy":

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

      Migration Toolkit for Virtualization Operator   2.8.5
      OpenShift Virtualization   4.17.11

      How reproducible:

      Always
      

      Steps to Reproduce:

      1. Create a VM with OS type "Linux" in RHV.
      2. Try migrating this VM using MTV.
      3. Migration fails
      

      Actual results:

      Migration from RHV to OpenShift Virtualization is failing with error "Running and RunStrategy are mutually exclusive"

      Expected results:

       

      Additional info:

       

              rh-ee-ehazan Elad Hazan
              rhn-support-nashok Nijin Ashok
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated:
                Resolved: