Cloning volumes from an existing PersistentVolumeClaim
If the source cloud-ready image is converted from a manually-created PersistentVolumeClaim and CSI Volume Cloning is supported in your cluster and storage, you can clone volumes from the existing cloud-ready image to create another cloud-ready image in the same namespace. The cloning option is much faster than copying volumes from an existing PersistentVolumeClaim; therefore, use this option if CSI cloning is available.
Before you begin, ensure requirements mentioned in Preparing for sandbox instances provisioning are
met. Note that the PersistentVolumeClaim to be used as the source must be created
manually by a developer or the cluster administrator, that is, a
PersistentVolumeClaim created by the Sandbox Operator automatically is not
supported as the source.
Cloning volumes from an existing PersistentVolumeClaim is the fastest way to
create a copy of a cloud-ready image for backup or use by another sandbox instance. Confirm with
your cluster administrator whether the CSI Volume Cloning is available for your cluster and the
storage. For more information about CSI Volume Cloning, see the Kubernetes documentation.
- If the source PersistentVolumeClaim is being used by a sandbox instance,
complete the following steps to delete the sandbox instance before you clone volumes.
- Shut down the z/OS® system running on the sandbox instance.
- (Optional) Save the
WaziSandboxSystemCustom Resource YAML file for the sandbox instance as backup. - Delete the sandbox instance. For more information, see Deleting a sandbox instance.
- Create a YAML file with the following template.
kind: PersistentVolumeClaim apiVersion: v1 metadata: # The name for the new PersistentVolumeClaim, must be unique in your # namespace name: my-sandbox-clone labels: # Copy any labels of the form "image.sandbox.wazi.ibm.com/*" from # the source claim ("my-sandbox-storage" in this example) image.sandbox.wazi.ibm.com/status: ready image.sandbox.wazi.ibm.com/type: complete image.sandbox.wazi.ibm.com/version: v1 spec: accessModes: - ReadWriteOnce resources: requests: # This must be same size or larger than the source claim # (the size of "my-sandbox-storage" in this example) storage: 300Gi # This must be same storage class as the source claim # (the storage class of "my-sandbox-storage" in this example) storageClassName: rook-ceph-block volumeMode: Filesystem dataSource: kind: PersistentVolumeClaim name: my-sandbox-storageTo complete the template, you need to check the source PersistentVolumeClaim from the Red Hat® OpenShift® web console or from the command line.
- Create the clone with one of the following ways.
- Run the
occommand, for example,oc apply -f your_clone.yaml.Or, run
kubectlcommand, for example,kubectl apply -f your_clone.yaml. - Use the Red Hat
OpenShift web console from the Administrator
perspective. Administrator privilege is required.
- Select the Administrator.
- Click .
- Click Create Persistent Volume Claim.
- Click Edit YAML.
- Copy and paste the contents of your modified YAML file over the template that is shown in the UI. Then, click Create.
- Run the