This is a cache of https://docs.openshift.com/container-platform/4.2/cnv/cnv_users_guide/cnv-uploading-local-disk-images-virtctl.html. It is a snapshot of the page at 2024-11-23T02:40:46.042+0000.
Uploading local disk images by using the virtctl tool - Container-native virtualization <strong>user</strong>'s guide | Container-native virtualization | OpenShift Container Platform 4.2
×

You can upload a disk image that is stored locally by using the virtctl command-line utility.

Prerequisites

CDI supported operations matrix

This matrix shows the supported CDI operations for content types against endpoints, and which of these operations requires scratch space.

Content types HTTP HTTPS HTTP basic auth Registry Upload

KubeVirt(QCOW2)

✓ QCOW2
✓ GZ*
✓ XZ*

✓ QCOW2**
✓ GZ*
✓ XZ*

✓ QCOW2
✓ GZ*
✓ XZ*

✓ QCOW2*
□ GZ
□ XZ

✓ QCOW2*
✓ GZ*
✓ XZ*

KubeVirt (RAW)

✓ RAW
✓ GZ
✓ XZ

✓ RAW
✓ GZ
✓ XZ

✓ RAW
✓ GZ
✓ XZ

✓ RAW*
□ GZ
□ XZ

✓ RAW*
✓ GZ*
✓ XZ*

Archive+

✓ TAR

✓ TAR

✓ TAR

□ TAR

□ TAR

✓ Supported operation

□ Unsupported operation

* Requires scratch space

** Requires scratch space if a custom certificate authority is required

+ Archive does not support block mode DVs

Uploading a local disk image to a new PersistentVolumeClaim

You can use the virtctl CLI utility to upload a virtual machine disk image from a client machine to your cluster. Uploading the disk image creates a PersistentVolumeClaim (PVC) that you can associate with a virtual machine.

Prerequisites
  • A virtual machine disk image, in RAW, ISO, or QCOW2 format, optionally compressed by using xz or gz.

  • The kubevirt-virtctl package must be installed on the client machine.

  • The client machine must be configured to trust the OpenShift Container Platform router’s certificate.

Procedure
  1. Identify the following items:

    • File location of the VM disk image you want to upload

    • Name and size required for the resulting PVC

  2. Run the virtctl image-upload command to upload your VM image. You must specify the PVC name, PVC size, and file location. For example:

    $ virtctl image-upload --pvc-name=<upload-fedora-pvc> --pvc-size=<2Gi> --image-path=</images/fedora.qcow2>

    To allow insecure server connections when using HTTPS, use the --insecure parameter. Be aware that when you use the --insecure flag, the authenticity of the upload endpoint is not verified.

  3. To verify that the PVC was created, view all PVC objects:

    $ oc get pvc