Skip to main content
Version: 26.3

Clone VM Disks Across FlashArrays Using CDI

The CDI smart-clone strategy lets you prefill a DataVolume on a destination FlashArray with a golden image PVC hosted on a different, source FlashArray. PX-CSI uses FlashArray remote copy to transfer the snapshot asynchronously between arrays, so cloning is handled by the storage infrastructure rather than the cluster network.

Prerequisites​

Ensure that you have:

  • Portworx Operator 26.4.0 or later installed.
  • PX-CSI 26.3.0 or later installed, and both source and destination FlashArrays registered in the cluster.
  • Purity 6.6.1 or later running on both source and destination FlashArrays.
  • KubeVirt CDI installed on the cluster.
  • A replication network path exists between the source and destination FlashArray replication ports.
  • Array-to-array replication connectivity configured out of band (using purearray connect or the FlashArray management UI).
note

Cross-array cloning relies on the isRemote field in the PureSnapshot CRD spec, which marks a snapshot as having been transferred to a remote target array. PX-CSI uses this field to confirm that a snapshot is a remote snapshot before using it as a clone source. Ensure that the Portworx Operator has updated your PureSnapshot CRD to include this field before using this feature. For more information, see PureSnapshot CRD reference.

Set up cross-array cloning for CDI​

For each replication link (source array and destination array), create three Kubernetes objects: a StorageClass that routes provisioning to the destination array, a VolumeSnapshotClass that configures PX-CSI to use the remote-snapshot path, and a CDI StorageProfile that activates the smart-clone strategy for that link.

Create a StorageClass that routes volume provisioning to the destination array by using portworx.io/pure-array-id:

apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
name: <px-fa-to-arrayB> # link StorageClass for this replication path
provisioner: pxd.portworx.com
reclaimPolicy: Delete
volumeBindingMode: Immediate
allowVolumeExpansion: true
parameters:
backend: pure_block
portworx.io/pure-array-id: <destination-array-id> # routes provisioning to the destination FlashArray

Apply the StorageClass:

oc apply -f link-sc.yaml
oc get sc px-fa-to-arrayB

To find the array ID, run px csi list backend or check the FlashArray management UI. For more information, see Control volume placement using array IDs.

Create a VolumeSnapshotClass with the portworx.io/target-array-id parameter. When this parameter is present, PX-CSI routes CreateSnapshot through the remote-snapshot path to the specified array:

apiVersion: snapshot.storage.k8s.io/v1
kind: VolumeSnapshotClass
metadata:
name: <px-fa-to-arrayB-snapclass>
driver: pxd.portworx.com
deletionPolicy: Delete
parameters:
backend: pure_block
portworx.io/target-array-id: <destination-array-id> # must match the array ID in the link StorageClass

Apply the VolumeSnapshotClass:

oc apply -f link-vsc.yaml
oc get volumesnapshotclass <px-fa-to-arrayB-snapclass>

Configure the CDI StorageProfile​

CDI automatically creates a StorageProfile with the same name as each StorageClass. Patch the automatically created profile to point to the link VolumeSnapshotClass so that the CDI smart-clone planner uses the remote-snapshot path when this StorageClass is the clone target:

oc patch storageprofile <px-fa-to-arrayB> --type=merge -p \
'{"spec":{"snapshotClass":"<px-fa-to-arrayB-snapclass>","cloneStrategy":"snapshot"}}'

After you create these three objects, the replication link is ready for cloning. Tenants in any namespace can clone to the destination array by specifying the link StorageClass in their DataVolume.

Clone a VM disk across arrays​

After you set up the link objects, create a CDI DataVolume that references the source PVC and the link StorageClass.

  1. Create a DataVolume that points to the source PVC on the source array and uses the link StorageClass:

    apiVersion: cdi.kubevirt.io/v1beta1
    kind: DataVolume
    metadata:
    name: my-clone
    namespace: tenant-a
    spec:
    source:
    pvc:
    namespace: tenant-a
    name: my-golden-source # PVC on the source FlashArray
    storage:
    accessModes: [ReadWriteOnce]
    volumeMode: Filesystem
    resources:
    requests: { storage: 10Gi }
    storageClassName: <px-fa-to-arrayB> # link StorageClass selects the destination array

    Apply the DataVolume:

    oc apply -f clone-dv.yaml
  2. Track progress through the CDI smart-clone phases:

    oc -n tenant-a get dv my-clone -w \
    -o custom-columns='NAME:.metadata.name,PHASE:.status.phase,PROGRESS:.status.progress'
  3. Inspect the transient VolumeSnapshot that CDI creates during cloning:

    oc -n tenant-a get volumesnapshot \
    -o custom-columns='NAME:.metadata.name,CLASS:.spec.volumeSnapshotClassName,READY:.status.readyToUse'

    The READY column becomes true after the remote snapshot transfer completes. CDI then creates the destination PVC automatically.

In this topic: