Description of problem: VM import from VMware to RHV via api, using "name" for the source storage, causes a crash: VM import remain in 5%. VM import resource report validation completed. VM import controller log report: "panic: runtime error: invalid memory address or nil pointer dereference [recovered] panic: runtime error: invalid memory address or nil pointer dereference [signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x1ebe93b] goroutine 1394 [running]: k8s.io/apimachinery/pkg/util/runtime.HandleCrash(0x0, 0x0, 0x0)" Version-Release number of selected component (if applicable): CNV-2.5 Additional info: Source (VMware) storage name was used due to this doc bug: Bug 1884970 - [v2v][Doc][VMware to CNV VM import API] Storage Mapping: Source storage name should change to storage id Additional info - How it was tested: Secret: ------ cat <<EOF | oc create -f - --- apiVersion: v1 kind: Secret metadata: name: vmw-secret type: Opaque stringData: vmware: |- # API URL of the vCenter or ESXi host apiUrl: "https://<Vcenter IP address>/sdk" # Username provided in the format of username@domain. username: <username> password: <password> # The certificate thumbprint of the vCenter or ESXi host, in colon-separated hexidecimal octets. thumbprint: 31:14:.. EOF External mapping ---------------- cat <<EOF | oc create -f - apiVersion: v2v.kubevirt.io/v1beta1 kind: ResourceMapping metadata: name: example-vmware-resourcemappings namespace: default spec: vmware: networkMappings: - source: name: VM Network # map network name to network attachment definition target: name: pod type: pod storageMappings: - source: name: <VMware datastore name> <======== Here use a name instead of ID target: name: nfs EOF VM import create ---------------- cat <<EOF | oc create -f - apiVersion: v2v.kubevirt.io/v1beta1 kind: VirtualMachineImport metadata: name: vmware-import-1 namespace: default spec: providerCredentialsSecret: name: vmw-secret namespace: default # optional, if not specified, use CR's namespace resourceMapping: name: example-vmware-resourcemappings namespace: default targetVmName: vmw-import startVm: false source: vmware: vm: id: 42037aff-4d6f-cf89-7979-e98cbc406c0e EOF
Created attachment 1718741 [details] vm import resource yaml
Created attachment 1718742 [details] vm import controller log
https://github.com/kubevirt/vm-import-operator/pull/410 fixes the doc bug and allows Datastores to be mapped by Name as well.
verified on CNV version: 2.5.0-234 VM import works with both storage id or storage name
Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory (OpenShift Virtualization 2.5.0 Images), and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. https://access.redhat.com/errata/RHEA-2020:5127