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

Need to add validation for pvc/network/volumeNameTemplate to follow DV/interface/VM name rules

XMLWordPrintable

    • Quality / Stability / Reliability
    • 5
    • False
    • Hide

      None

      Show
      None
    • True

      Description of problem:

      1. Create cold migration plan with pvcNameTemplate:
      {{if eq .DiskIndex .RootDiskIndex}}C{{else if eq .DiskIndex 1}}E{{else if eq .DiskIndex 2}}F{{else if eq .DiskIndex 3}}G{{else}}data{{end}}-{{.DiskIndex}}
      
      Plan failed in Initialization phase, as it doesn't following the DV name rule
      -----------------------------------------------------
      DataVolume.cdi.kubevirt.io "C-07jwmc" is invalid: [metadata.generateName: Invalid value: "C-0": a lowercase RFC 1123 subdomain must consist of lower case alphanumeric characters, '-' or '.', and must start and end with an alphanumeric character (e.g. 'example.com', regex used for validation is '[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*')
      
      2. Create warm migration plan with networkNameTemplate with dot
      {{if eq .NetworkType "pod"}}pod{{else}}multus-{{.NetworkNamespace}}.{{.NetworkName}}_{{.NetworkIndex}}{{end}}
      
      Plan failed in VirtualMachineCreation phase, as it doesn't follow the interface name rule
      -----------------------------------------------------
      admission webhook "virtualmachine-validator.kubevirt.io" denied the request: Network interface name can only contain alphabetical characters, numbers, dashes (-) or underscores (_), Network interface name can only contain alphabetical characters, numbers, dashes (-) or underscores (_), must not contain dots, must not contain dots, must not contain dots, must not contain dots
      
      3. Create warm migration plan with volumeNameTemplate with dot '.'/underscores '_', plan failed in VirtualMachineCreation phase
      {{.PVCName}}.{{.VolumeIndex}} or {{.PVCName}}_{{.VolumeIndex}} -----------------------------------------------------------------
      admission webhook "virtualmachine-validator.kubevirt.io" denied the request: must not contain dots, must not contain dots, must not contain dots, must not contain dots
      -----------------------------------------------------------------
      admission webhook "virtualmachine-validator.kubevirt.io" denied the request: a lowercase RFC 1123 label must consist of lower case alphanumeric characters or '-', and must start and end with an alphanumeric character (e.g. 'my-name', or '123-abc', regex used for validation is '[a-z0-9]([-a-z0-9]*[a-z0-9])?')

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

      MTV 2.8.0-29 (IIB: 937321) with CNV 4.18.1

      How reproducible:

      Always

      Steps to Reproduce:

      1. Create a cold migration to migrate VM: mtv-function-win2022-test from vSphere 8, set the Templates:

      pvcNameTemplate:
      {{if eq .DiskIndex .RootDiskIndex}}C{{else if eq .DiskIndex 1}}E{{else if eq .DiskIndex 2}}F{{else if eq .DiskIndex 3}}G{{else}}data{{end}}-{{.DiskIndex}}
      
      networkNameTemplate:
      {{if eq .NetworkType "pod"}}pod{{else}}multus-{{.NetworkNamespace}}-{{.NetworkName}}-{{.NetworkIndex}}{{end}}
      
      volumeNameTemplate:
      {{.PVCName}}-{{.VolumeIndex}}

      2. Start the migration plan, Initialize phase hit error:

      3. Create a warm migration plan to migrate vm with networkNameTemplate with dot

      if eq .NetworkType "pod"}}pod{{else}}multus-{{.NetworkNamespace..NetworkName_.NetworkIndexend

      4. Start the migration plan, VirtualMachineCreation phase failed as it doesn't follow the interface name rule

      5. The same error happened when the volumeNameTempate with dot

      Actual results:

      In step2,4.5: Migration plan failed with error

      Expected results:

      In step2,4,5: validate the pvcNameTemplate/networkNameTemplate/volumeNameTemplate to follow the DV/interface name rules, and migration plan succeeded

      Additional info:

       

              yzamir@redhat.com Yaacov Zamir
              chhu@redhat.com Chenli Hu
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Created:
                Updated:
                Resolved: