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

Controller crashes when converting Oracle Linux 7

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done-Errata
    • Icon: Normal Normal
    • 2.7.0
    • 2.6.6
    • Controller
    • None
    • False
    • None
    • True
    • Moderate

      While its not an officially supported Guest OS, the v2v conversion works fine, but an OS mapping logic makes the controller crash, breaking the system.

      The os mapping logic is fragile, splitting strings and not testing length before accessing specific positions. I believe this should be fixed regardless of the unsupported OS.

      Crashing the controller due to a plan having a migration with an unsupported OS is not nice, it breaks the system and other migrations.

      Please make this more robust:

      goroutine 439 [running]:
      sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).Reconcile.func1()
          /remote-source/app/vendor/sigs.k8s.io/controller-runtime/pkg/internal/controller/controller.go:116 +0x1e5
      panic({0x2ff8ec0?, 0xc001df5680?})
          /usr/lib/golang/src/runtime/panic.go:914 +0x21f
      github.com/konveyor/forklift-controller/pkg/controller/plan/adapter/ova.mapOs({0x0, 0x0})
          /remote-source/app/pkg/controller/plan/adapter/ova/ovfparser.go:118 +0x21f
      github.com/konveyor/forklift-controller/pkg/controller/plan/adapter/ova.GetOperationSystemFromConfig({0xc00367d500?, 0xc003739800?})
          /remote-source/app/pkg/controller/plan/adapter/ova/ovfparser.go:113 +0x3d
      github.com/konveyor/forklift-controller/pkg/controller/plan.(*KubeVirt).UpdateVmByConvertedConfig(0xc0002a6d38, 0xc002734b60, 0xc001b48480, 0xc000f2ac60)
          /remote-source/app/pkg/controller/plan/kubevirt.go:943 +0x3d5
      github.com/konveyor/forklift-controller/pkg/controller/plan.(*Migration).execute(0xc0002a6d20, 0xc002734b60)
          /remote-source/app/pkg/controller/plan/migration.go:1137 +0x1235e
      github.com/konveyor/forklift-controller/pkg/controller/plan.(*Migration).Run(0xc0002a6d20)
          /remote-source/app/pkg/controller/plan/migration.go:195 +0x285
      github.com/konveyor/forklift-controller/pkg/controller/plan.(*Reconciler).execute(0xc001423f20, 0xc004315c00)
          /remote-source/app/pkg/controller/plan/controller.go:428 +0x98b
      github.com/konveyor/forklift-controller/pkg/controller/plan.Reconciler.Reconcile({{{0x3697338, 0xc000666bc0}, {0x36b3100, 0xc000a20510}, {0x36a9e38, 0xc00055c120}}}, {0x36c2560?, 0xc0008d5ce8?}, {{{0xc003df2ec0, 0xd}, ...}})
          /remote-source/app/pkg/controller/plan/controller.go:257 +0x9de
      sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).Reconcile(0x36a8108?, {0x36a49f8?, 0xc001423ef0?}, {{{0xc003df2ec0?, 0xb?}, {0xc001715c20?, 0x0?}}})
          /remote-source/app/vendor/sigs.k8s.io/controller-runtime/pkg/internal/controller/controller.go:119 +0xb7
      sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).reconcileHandler(0xc0005e7180, {0x36a4a30, 0xc0006bc190}, {0x2e5f8a0?, 0xc0044f4880?})
          /remote-source/app/vendor/sigs.k8s.io/controller-runtime/pkg/internal/controller/controller.go:316 +0x3cc
      sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).processNextWorkItem(0xc0005e7180, {0x36a4a30, 0xc0006bc190})
          /remote-source/app/vendor/sigs.k8s.io/controller-runtime/pkg/internal/controller/controller.go:266 +0x1c9
      sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).Start.func2.2()
          /remote-source/app/vendor/sigs.k8s.io/controller-runtime/pkg/internal/controller/controller.go:227 +0x79
      created by sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).Start.func2 in goroutine 24
          /remote-source/app/vendor/sigs.k8s.io/controller-runtime/pkg/internal/controller/controller.go:223 +0x565 

      Here is the array acess without checking length after a split:

         116    func mapOs(xmlOs string) (os string) {
         117        split := strings.Split(xmlOs, "/")
         118        distro := split[3]                      <------------
         119        switch distro {
         120        case "rocky", "opensuse", "ubuntu", "fedora":
         121            os = distro
         122        default:
         123            os = split[3] + strings.Split(split[4], ".")[0]
         124        }
         125        os, ok := osV2VMap[os]
         126        if !ok {
         127            log.Info(fmt.Sprintf("Received %s, mapped to: %s", xmlOs, os))
         128            os = "otherGuest64"
         129        }
         130        return
         131    } 

      It should probably map to otherGuest64 if we have no official support, but not crash.

              mnecas@redhat.com Martin Necas
              rhn-support-gveitmic Germano Veit Michel
              Chenli Hu Chenli Hu
              Votes:
              1 Vote for this issue
              Watchers:
              6 Start watching this issue

                Created:
                Updated:
                Resolved: