Workflows: Red Hat OpenShift Virtualization with NetApp ONTAP

Contributors kulkarnn netapp-dorianh Download PDF of this page

VM cloning

Cloning an existing VM in OpenShift is achieved with the support of NetApp Trident’s Volume CSI cloning feature. CSI volume cloning allows for creation of a new PVC using an existing PVC as the data source by duplicating its PV. After the new PVC is created, it functions as a separate entity and without any link to or dependency on the source PVC.

VM Cloning architecture

There are certain restrictions with CSI volume cloning to consider:

  1. Source PVC and destination PVC must be in the same project.

  2. Cloning is supported within the same storage class.

  3. Cloning can be performed only when source and destination volumes use the same VolumeMode setting; for example, a block volume can only be cloned to another block volume.

VMs in an OpenShift cluster can be cloned in two ways:

  1. By shutting down the source VM

  2. By keeping the source VM live

By Shutting down the source VM

Cloning an existing VM by shutting down the VM is a native OpenShift feature that is implemented with support from NetApp Trident. Complete the following steps to clone a VM.

  1. Navigate to Workloads > Virtualization > Virtual Machines and click the ellipsis next to the virtual machine you wish to clone.

  2. Click Clone Virtual Machine and provide the details for the new VM.

    clone vm
  3. Click Clone Virtual Machine; this shuts down the source VM and initiates the creation of the clone VM.

  4. After this step is completed, you can access and verify the content of the cloned VM.

By keeping the source VM live

An existing VM can also be cloned by cloning the existing PVC of the source VM and then creating a new VM using the cloned PVC. This method does not require you to shut down the source VM. Complete the following steps to clone a VM without shutting it down.

  1. Navigate to Storage → PersistentVolumeClaims` and click the ellipsis next to the PVC that is attached to the source VM.

  2. Click Clone PVC and furnish the details for the new PVC.

    clone pvc
  3. Then click Clone. This creates a PVC for the new VM.

  4. Navigate to Workloads > Virtualization > Virtual Machines and click Create > With YAML.

  5. In the spec > template > spec > volumes section, attach the cloned PVC instead of the container disk. Provide all other details for the new VM according to your requirements.

    - name: rootdisk
      persistentVolumeClaim:
        claimName: rhel8-short-frog-rootdisk-28dvb-clone
  6. Click Create to create the new VM.

  7. After the VM is created successfully, access and verify that the new VM is a clone of the source VM.