$ virtctl image-upload --pvc-name=<upload-fedora-pvc> --pvc-size=<2Gi> --image-path=</images/fedora.qcow2>
You can upload a disk image that is stored locally by using the virtctl
command-line utility.
Install
the kubevirt-virtctl
package
You may need to define a StorageClass or prepare CDI scratch space for this operation to complete successfully.
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 |
✓ QCOW2** |
✓ QCOW2 |
✓ QCOW2* |
✓ QCOW2* |
KubeVirt (RAW) |
✓ RAW |
✓ RAW |
✓ RAW |
✓ RAW* |
✓ RAW* |
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
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.
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.
Identify the following items:
File location of the VM disk image you want to upload
Name and size required for the resulting PVC
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 |
To verify that the PVC was created, view all PVC objects:
$ oc get pvc