<commit_before>// Module included in the following assemblies:
//
// * cnv/cnv_users_guide/cnv-importing-vmware-vm.adoc
[id='Importing_vmware_vm_or_template_{context}']
= Importing a VMware virtual machine or template

You can import a VMware virtual machine or template using the virtual machine wizard.

.Prerequisites

* You must create a VDDK image, push it to a private container repository, and add it to the `v2v-vmware` ConfigMap.
* You must power off the VMware virtual machine before importing it.

.Procedure

. In the {CNVProductName} web console, click *Workloads* -> *Virtual Machines*.
. Click *Create Virtual Machine* and select *Import with Wizard*.
. In the *General* screen, perform the following steps:
.. Select *VMware* from the *Provider* list.
.. Select *Connect to New Instance* or a saved vCenter instance from the *vCenter instance* list.

** If you select *Connect to New Instance*, fill in the *vCenter hostname*, *Username*, and *Password*.
** If you select a saved vCenter instance, the  wizard connects to the vCenter instance using the saved credentials.

.. Select a virtual machine or a template to import from the *VM or Template to Import* list.
.. Select an operating system.
.. Select an existing flavor or *Custom* from the *Flavor* list.
+
If you select *Custom*, specify the *Memory (GB)* and the *CPUs*.
.. Select a *Workload Profile*.
.. If the virtual machine name is already being used by another virtual machine in the namespace, update the name.
.. Click *Next*.

. In the *Networking* screen, perform the following steps:

.. Click the Options menu {kebab} of a network interface and select *Edit*.
.. Enter a valid network interface name.
+
The name can contain lowercase letters (`a-z`), numbers (`0-9`), and hyphens (`-`), up to a maximum of 253 characters. The first and last characters must be alphanumeric. The name must not contain uppercase letters, spaces, periods (`.`), or special characters.

.. Select the network interface model.
.. Select the network definition.
.. Select the network interface type.
.. Enter the MAC address.
.. Click *Save* and then click *Next*.

. In the *Storage* screen, perform the following steps:

.. Click the Options menu {kebab} of a disk and select *Edit*.
+
.. Enter a valid name.
+
The name can contain lowercase letters (`a-z`), numbers (`0-9`), and hyphens (`-`), up to a maximum of 253 characters. The first and last characters must be alphanumeric. The name must not contain uppercase letters, spaces, periods (`.`), or special characters.

.. Select the interface type.
.. Select the storage class.
+
If you do not select a storage class, {CNVProductName} uses the default storage class to create the virtual machine.

.. Click *Save* and then click *Next*.

. In the *Advanced* screen, enter the *Hostname* and *Authorized SSH Keys* if you are using `cloud-init`.
. Click *Next*.

. Review your settings and click *Create Virtual Machine*.
+
A *Successfully created virtual machine* message and a list of resources created for the virtual machine are displayed. The powered off virtual machine appears in *Workloads* -> *Virtual Machines*.

. Click *See virtual machine details* to view the dashboard of the imported virtual machine.
+
If an error occurs, perform the following steps:

.. Click *Workloads* -> *Pods*.
.. Click the Conversion Pod, for example, `kubevirt-v2v-conversion-rhel7-mini-1-27b9h`.
.. Click *Logs* and check for error messages.<commit_msg>Correcting VM YAML for cloud-init<commit_after>// Module included in the following assemblies:
//
// * cnv/cnv_users_guide/cnv-importing-vmware-vm.adoc
[id='Importing_vmware_vm_or_template_{context}']
= Importing a VMware virtual machine or template

You can import a VMware virtual machine or template using the virtual machine wizard.

.Prerequisites

* You must create a VDDK image, push it to a private container repository, and add it to the `v2v-vmware` ConfigMap.
* You must power off the VMware virtual machine before importing it.

.Procedure

. In the {CNVProductName} web console, click *Workloads* -> *Virtual Machines*.
. Click *Create Virtual Machine* and select *Import with Wizard*.
. In the *General* screen, perform the following steps:
.. Select *VMware* from the *Provider* list.
.. Select *Connect to New Instance* or a saved vCenter instance from the *vCenter instance* list.

** If you select *Connect to New Instance*, fill in the *vCenter hostname*, *Username*, and *Password*.
** If you select a saved vCenter instance, the  wizard connects to the vCenter instance using the saved credentials.

.. Select a virtual machine or a template to import from the *VM or Template to Import* list.
.. Select an operating system.
.. Select an existing flavor or *Custom* from the *Flavor* list.
+
If you select *Custom*, specify the *Memory (GB)* and the *CPUs*.
.. Select a *Workload Profile*.
.. If the virtual machine name is already being used by another virtual machine in the namespace, update the name.
.. Click *Next*.

. In the *Networking* screen, perform the following steps:

.. Click the Options menu {kebab} of a network interface and select *Edit*.
.. Enter a valid network interface name.
+
The name can contain lowercase letters (`a-z`), numbers (`0-9`), and hyphens (`-`), up to a maximum of 253 characters. The first and last characters must be alphanumeric. The name must not contain uppercase letters, spaces, periods (`.`), or special characters.

.. Select the network interface model.
.. Select the network definition.
.. Select the network interface type.
.. Enter the MAC address.
.. Click *Save* and then click *Next*.

. In the *Storage* screen, perform the following steps:

.. Click the Options menu {kebab} of a disk and select *Edit*.
+
.. Enter a valid name.
+
The name can contain lowercase letters (`a-z`), numbers (`0-9`), and hyphens (`-`), up to a maximum of 253 characters. The first and last characters must be alphanumeric. The name must not contain uppercase letters, spaces, periods (`.`), or special characters.

.. Select the interface type.
.. Select the storage class.
+
If you do not select a storage class, {CNVProductName} uses the default storage class to create the virtual machine.

.. Click *Save* and then click *Next*.

. In the *Advanced* screen, enter the *Hostname* and *Authorized SSH Keys* if you are using `cloud-init`.
+
You must xref:../../cnv/cnv_users_guide/cnv-edit-vms.adoc#cnv-editing-vm-yaml-web_cnv-edit-vms[edit the virtual machine's YAML configuration] after importing it:

.. In the `cloudInitNoCloud` stanza, under `userData`, change `ssh-authorized-keys` to `ssh_authorized_keys`:
+
[source,yaml]
----
- cloudInitNoCloud:
    userData: |
      #cloud-config
      name: default
      hostname: myhostname
      ssh-authorized-keys:
----

.. Restart the virtual machine.
+
See link:https://bugzilla.redhat.com/show_bug.cgi?id=1786350[BZ#1786350] for details.

. Click *Next*.

. Review your settings and click *Create Virtual Machine*.
+
A *Successfully created virtual machine* message and a list of resources created for the virtual machine are displayed. The powered off virtual machine appears in *Workloads* -> *Virtual Machines*.

. Click *See virtual machine details* to view the dashboard of the imported virtual machine.
+
If an error occurs, perform the following steps:

.. Click *Workloads* -> *Pods*.
.. Click the Conversion Pod, for example, `kubevirt-v2v-conversion-rhel7-mini-1-27b9h`.
.. Click *Logs* and check for error messages.
{'fraction_non_alphanumeric': 0.0971611355457817, 'fraction_numerical': 0.006397441023590564, 'mean_word_length': 3.986046511627907, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '349315', 'n_tokens_mistral': 2127, 'n_tokens_neox': 2060, 'n_words': 1011}