Transfer the QCOW2 image to the bastion server and upload it to OpenShift Virtualization.
Before you begin
Ensure that you have:
- A QCOW2 image file that is ready for upload
- Network connectivity between the z/VM management server and the bastion server
- The virtctl CLI tool installed on the bastion server
- Cluster admin access to the OpenShift Container Platform cluster
- Red Hat OpenShift Data Foundation or another storage class is configured
About this task
This phase transfers the disk image to the OpenShift Container Platform cluster and creates a Persistent Volume Claim (PVC) that can be used as a boot disk for a virtual machine.
Procedure
-
Transfer the QCOW2 image from the z/VM management server to the bastion server by running the following command:
scp image_name.qcow2 user@bastion_host:destination_path
-
Upload the image to OpenShift Virtualization by using virtctl.
If you are using Red Hat OpenShift Data Foundation, the PVC is created automatically during
upload:
virtctl image-upload pvc pvc_name \
--size=size \
--image-path=path_to_image \
--storage-class=storage_class \
--namespace=namespace \
--insecure
Parameters:
- pvc_name: Name for the new PVC
- --size: Size of the PVC
- --image-path: Path to the QCOW2 image file
- --storage-class: Storage class to use (for example,
ocs-storagecluster-ceph-rbd)
- --namespace: Namespace where the PVC is created
- --insecure: Skip TLS certificate verification (use only in trusted
environments)
Important: The size that is specified with --size must be at least
as large as the original disk to ensure all data fits in the PVC.
-
Alternatively, manually create a PVC and then upload the image.
- Create a YAML file for the PVC:
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: pvc_name
namespace: namespace
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: size
storageClassName: storage_class
- Apply the YAML file by running the following command:
oc apply -f pvc-yaml-file
- Upload the image to the PVC by running the following command:
virtctl image-upload pvc pvc_name \
--image-path=path_to_image \
--size=size \
--namespace=namespace
Results
The QCOW2 image is uploaded to OpenShift Virtualization and stored in a PVC that can be used as a boot disk for a virtual machine.