You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
= Importing a virtual machine image into an object with DataVolumes
6
+
= Importing a virtual machine image into a PersistentVolumeClaim by using a DataVolume
7
7
8
-
To create a virtual machine from an imported image, specify the image location
9
-
in the `VirtualMachine` configuration file before you create the virtual machine.
8
+
You can import a virtual machine image into a PersistentVolumeClaim (PVC) by using a DataVolume.
9
+
10
+
The virtual machine image can be hosted at an HTTP or HTTPS endpoint, or the image can be built into a container disk and stored in a container registry.
11
+
12
+
To create a virtual machine from an imported virtual machine image, specify the image or container disk endpoint in the `VirtualMachine` configuration file before you create the virtual machine.
10
13
11
14
.Prerequisites
12
15
13
-
* Install the OpenShift CLI (`oc`).
14
-
* A virtual machine disk image, in RAW, ISO, or QCOW2 format, optionally
16
+
* You have installed the OpenShift CLI (`oc`).
17
+
* Your cluster has at least one available PersistentVolume.
18
+
* To import a virtual machine image you must have the following:
19
+
** A virtual machine disk image in RAW, ISO, or QCOW2 format, optionally
15
20
compressed by using `xz` or `gz`.
16
-
* An `HTTP` endpoint where the image is hosted, along with any authentication
17
-
credentials needed to access the data source.
18
-
* At least one available PersistentVolume.
21
+
** An HTTP endpoint where the image is hosted, along with any authentication
22
+
credentials needed to access the data source. For example: `http://www.example.com/path/to/data`
23
+
* To import a container disk you must have the following:
24
+
** A container disk built from a virtual machine image stored in your container image registry, along with any authentication credentials needed to access the data source. For example: `docker://registry.example.com/container-image`
19
25
20
26
.Procedure
21
27
22
-
. Identify an `HTTP` file server that hosts the virtual disk image that you want
23
-
to import. You need the complete URL in the correct format:
24
-
+
25
-
* `http://www.example.com/path/to/data`
26
-
27
-
. If your data source requires authentication credentials, edit the
28
+
. Optional: If your data source requires authentication credentials, edit the
28
29
`endpoint-secret.yaml` file, and apply the updated configuration to the cluster:
<1> The `HTTP` source of the image you want to import.
108
-
<2> The `secretRef` parameter is optional.
109
-
<3> The `certConfigMap` is required for communicating with servers that use self-signed certificates or certificates not signed by the system CA bundle. The referenced ConfigMap must be in the same namespace as the DataVolume.
110
-
<4> Specify `type: dataVolume` or `type: ""`. If you specify any other value for `type`, such as `persistentVolumeClaim`, a warning is displayed, and the virtual machine does not start.
108
+
<1> The source type to import the image from. This example uses a HTTP endpoint. To import a container disk from a registry, replace `http` with `registry`.
109
+
<2> The source of the virtual machine image you want to import. This example references a virtual machine image at an HTTP endpoint. An example of a container registry endpoint is `url: "docker://kubevirt/fedora-cloud-container-disk-demo:latest"`.
110
+
<3> The `secretRef` parameter is optional.
111
+
<4> The `certConfigMap` is required for communicating with servers that use self-signed certificates or certificates not signed by the system CA bundle. The referenced ConfigMap must be in the same namespace as the DataVolume.
112
+
<5> Specify `type: dataVolume` or `type: ""`. If you specify any other value for `type`, such as `persistentVolumeClaim`, a warning is displayed, and the virtual machine does not start.
111
113
112
114
. Create the virtual machine:
113
115
+
@@ -129,7 +131,7 @@ import is complete.
129
131
====
130
132
131
133
.Verification steps
132
-
. The importer Pod downloads the image from the specified URL and stores it on the provisioned PV. View the status of the importer Pod by running the following command:
134
+
. The importer Pod downloads the virtual machine image or container disk from the specified URL and stores it on the provisioned PV. View the status of the importer Pod by running the following command:
133
135
+
134
136
[source,terminal]
135
137
----
@@ -140,10 +142,10 @@ $ oc get pods
140
142
+
141
143
[source,terminal]
142
144
----
143
-
$ oc describe dv <data-label> <1>
145
+
$ oc describe dv <datavolume-name> <1>
144
146
----
145
-
<1> The data label for the DataVolume specified in the virtual machine
146
-
configuration file.
147
+
<1> The name of the DataVolume as specified under `dataVolumeTemplates.metadata.name` in the virtual machine
148
+
configuration file. In the example configuration above, this is `fedora-dv`.
147
149
148
150
. To verify that provisioning is complete and that the VMI has started, try
149
151
accessing its serial console by running the following command:
Copy file name to clipboardExpand all lines: modules/virt-preparing-container-disk-for-vms.adoc
+1-8Lines changed: 1 addition & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -9,19 +9,12 @@ You must build a container disk with a virtual machine image and push it to a co
9
9
10
10
.Prerequisites
11
11
12
-
* For RHEL users: You have root or sudo privileges on your local system to install `podman`.
12
+
* Install `podman` if it is not already installed.
13
13
14
14
* The virtual machine image must be either QCOW2 or RAW format.
15
15
16
16
.Procedure
17
17
18
-
. Install `podman` if it is not already installed:
19
-
+
20
-
[source,terminal]
21
-
----
22
-
$ sudo yum install podman -y
23
-
----
24
-
25
18
. Create a Dockerfile to build the virtual machine image into a container image. The virtual machine image must be owned by QEMU, which has a UID of `107`, and placed in the `/disk/` directory inside the container. Permissions for the `/disk/` directory must then be set to `0440`.
26
19
+
27
20
The following example uses the Red Hat Universal Base Image (UBI) to handle these configuration changes in the first stage, and uses the minimal `scratch` image in the second stage to store the result:
You can import an existing virtual machine image into your {product-title}
8
-
cluster. {VirtProductName} uses DataVolumes to automate the import of data and the
9
-
creation of an underlying PersistentVolumeClaim (PVC).
7
+
Use the Containerized Data Importer (CDI) to import a virtual machine image into a PersistentVolumeClaim (PVC) by using a DataVolume. You can attach a DataVolume to a virtual machine for persistent storage.
8
+
9
+
The virtual machine image can be hosted at an HTTP or HTTPS endpoint, or built into a container disk and stored in a container registry.
10
10
11
11
[IMPORTANT]
12
12
====
13
-
When you import a disk image into a PVC, the disk image is
14
-
expanded to use the full storage capacity that is requested in the PVC. To use
15
-
this space, the disk partitions and file system(s) in the virtual machine
16
-
might need to be expanded.
13
+
When you import a disk image into a PVC, the disk image is expanded to use the full storage capacity that is requested in the PVC. To use this space, the disk partitions and file system(s) in the virtual machine might need to be expanded.
17
14
18
-
The resizing procedure varies based on the operating system installed on the VM.
19
-
Refer to the operating system documentation for details.
15
+
The resizing procedure varies based on the operating system installed on the virtual machine. Refer to the operating system documentation for details.
20
16
====
21
17
22
18
== Prerequisites
@@ -25,7 +21,11 @@ Refer to the operating system documentation for details.
25
21
xref:../../../virt/virtual_machines/importing_vms/virt-tls-certificates-for-dv-imports.adoc#virt-adding-tls-certificates-for-authenticating-dv-imports_virt-tls-certificates-for-dv-imports[included in a ConfigMap]
26
22
in the same namespace as the DataVolume and referenced in the DataVolume configuration.
27
23
28
-
* You may need to xref:../../../virt/virtual_machines/virtual_disks/virt-preparing-cdi-scratch-space.adoc#virt-defining-storageclass-in-cdi-configuration_virt-preparing-cdi-scratch-space[define a StorageClass or prepare CDI scratch space]
24
+
* To import a container disk:
25
+
** You might need to xref:../../../virt/virtual_machines/virtual_disks/virt-using-container-disks-with-vms.adoc#virt-preparing-container-disk-for-vms_virt-using-container-disks-with-vms[prepare a container disk from a virtual machine image] and store it in your container registry before importing it.
26
+
** If the container registry does not have TLS, you must xref:../../../virt/virtual_machines/virtual_disks/virt-using-container-disks-with-vms.adoc#virt-disabling-tls-for-registry_virt-using-container-disks-with-vms[add the registry to the `cdi-insecure-registries` ConfigMap] before you can import a container disk from it.
27
+
28
+
* You might need to xref:../../../virt/virtual_machines/virtual_disks/virt-preparing-cdi-scratch-space.adoc#virt-defining-storageclass-in-cdi-configuration_virt-preparing-cdi-scratch-space[define a StorageClass or prepare CDI scratch space]
* xref:../../../virt/virtual_machines/importing_vms/virt-importing-virtual-machine-images-datavolumes.adoc#virt-importing-virtual-machine-images-datavolumes[Import the container disk into persistent storage for a virtual machine].
19
+
14
20
* xref:../../../virt/virtual_machines/virt-create-vms.adoc#virt-create-vms[Create a virtual machine] that uses
0 commit comments