1
0
mirror of https://github.com/openshift/openshift-docs.git synced 2026-02-06 06:46:26 +01:00
Files
openshift-docs/modules/virt-creating-configmap.adoc
Avital Pinnick 6e487808cc update
2020-11-03 10:49:55 +00:00

179 lines
4.9 KiB
Plaintext

// Module included in the following assemblies:
//
// * virt/virtual_machines/importing_vms/virt-importing-rhv-vm.adoc
[id="virt-creating-configmap_{context}"]
= Creating a ConfigMap for importing a VM
You can create a ConfigMap to map the Red Hat Virtualization (RHV) virtual machine operating system to an {VirtProductName} template if you want to override the default `vm-import-controller` mapping or to add additional mappings.
The default `vm-import-controller` ConfigMap contains the following RHV operating systems and their corresponding common {VirtProductName} templates.
[cols="1,1", options="header"]
.Operating system and template mapping
|===
|RHV VM operating system |{VirtProductName} template
|`rhel_6_9_plus_ppc64` |`rhel6.9`
|`rhel_6_ppc64` |`rhel6.9`
|`rhel_6` |`rhel6.9`
|`rhel_6x64` |`rhel6.9`
|`rhel_7_ppc64` |`rhel7.7`
|`rhel_7_s390x` |`rhel7.7`
|`rhel_7x64` |`rhel7.7`
|`rhel_8x64` |`rhel8.1`
|`sles_11_ppc64` |`opensuse15.0`
|`sles_11` |`opensuse15.0`
|`sles_12_s390x` |`opensuse15.0`
|`ubuntu_12_04` |`ubuntu18.04`
|`ubuntu_12_10` |`ubuntu18.04`
|`ubuntu_13_04` |`ubuntu18.04`
|`ubuntu_13_10` |`ubuntu18.04`
|`ubuntu_14_04_ppc64` |`ubuntu18.04`
|`ubuntu_14_04` |`ubuntu18.04`
|`ubuntu_16_04_s390x` |`ubuntu18.04`
|`windows_10` |`win10`
|`windows_10x64` |`win10`
|`windows_2003` |`win10`
|`windows_2003x64` |`win10`
|`windows_2008R2x64` |`win2k8`
|`windows_2008` |`win2k8`
|`windows_2008x64` |`win2k8`
|`windows_2012R2x64` |`win2k12r2`
|`windows_2012x64` |`win2k12r2`
|`windows_2016x64` |`win2k16`
|`windows_2019x64` |`win2k19`
|`windows_7` |`win10`
|`windows_7x64` |`win10`
|`windows_8` |`win10`
|`windows_8x64` |`win10`
|`windows_xp` |`win10`
|===
.Procedure
. In a web browser, identify the REST API name of the RHV VM operating system by navigating to `\http://<RHV_Manager_FQDN>/ovirt-engine/api/vms/<VM_ID>`. The operating system name appears in the `<os>` section of the XML output, as shown in the following example:
+
[source,xml]
----
...
<os>
...
<type>rhel_8x64</type>
</os>
----
. View a list of the available {VirtProductName} templates:
+
[source,terminal]
----
$ oc get templates -n openshift --show-labels | tr ',' '\n' | grep os.template.kubevirt.io | sed -r 's#os.template.kubevirt.io/(.*)=.*#\1#g' | sort -u
----
+
.Example output
[source,terminal]
----
fedora31
fedora32
...
rhel8.1
rhel8.2
...
----
. If an {VirtProductName} template that matches the RHV VM operating system does not appear in the list of available templates, create a template with the {VirtProductName} web console.
. Create a ConfigMap to map the RHV VM operating system to the {VirtProductName} template:
+
[source,yaml]
----
$ cat <<EOF | oc create -f -
apiVersion: v1
kind: ConfigMap
metadata:
name: os-configmap
namespace: default <1>
data:
guestos2common: |
"Red Hat Enterprise Linux Server": "rhel"
"CentOS Linux": "centos"
"Fedora": "fedora"
"Ubuntu": "ubuntu"
"openSUSE": "opensuse"
osinfo2common: |
"<rhv-operating-system>": "<vm-template>" <2>
EOF
----
<1> Optional: You can change the value of the `namespace` parameter.
<2> Specify the REST API name of the RHV operating system and its corresponding VM template as shown in the following example.
+
.ConfigMap example
[source,yaml]
----
$ cat <<EOF | oc apply -f -
apiVersion: v1
kind: ConfigMap
metadata:
name: os-configmap
namespace: default
data:
osinfo2common: |
"other_linux": "fedora31"
EOF
----
. Verify that the custom ConfigMap was created:
+
[source,terminal]
----
$ oc get cm -n default os-configmap -o yaml
----
ifeval::["{VirtVersion}" < "2.5"]
. Edit the `kubevirt-hyperconverged-operator.v{HCOVersion}.yaml` file:
+
[source,terminal,subs="attributes+"]
----
$ oc edit clusterserviceversion -n openshift-cnv kubevirt-hyperconverged-operator.v{HCOVersion}
----
. Update the following parameters of the `vm-import-operator` deployment manifest:
+
[source,yaml]
----
...
spec:
containers:
- env:
...
- name: OS_CONFIGMAP_NAME
value: os-configmap <1>
- name: OS_CONFIGMAP_NAMESPACE
value: default <2>
----
<1> Add `value: os-configmap` to the `name: OS_CONFIGMAP_NAME` parameter.
<2> Optional: You can add this value if you changed the namespace in the ConfigMap.
. Save the `kubevirt-hyperconverged-operator.v{HCOVersion}.yaml` file.
+
Updating the `vm-import-operator` deployment updates the `vm-import-controller` ConfigMap.
endif::[]
ifeval::["{VirtVersion}" >= "2.5"]
. Patch the `vm-import-controller-config` ConfigMap to apply the new ConfigMap:
+
[source,terminal]
----
$ oc patch configmap vm-import-controller-config -n openshift-cnv --patch '{
"data": {
"osConfigMap.name": "os-configmap",
"osConfigMap.namespace": "default" <1>
}
}'
----
<1> Update the namespace if you changed it in the ConfigMap.
endif::[]
. Verify that the template appears in the {VirtProductName} web console:
.. Click *Workloads* -> *Virtualization* from the side menu.
.. Click the *Virtual Machine Templates* tab and find the template in the list.