Cloning a VM or using Gold image to provision VMs using ConVirt

Posted on Aug 8, 2009 by Jaydeep in HOWTO's, Knowledge Base | 0 Comments

"Can I clone a VM ?"

"I have spent time coming up with a perfect image (gold image), how can I use ConVirt to provision VMs from it ?"

As I heard quite a few similar queries, I thought it might be useful to have blog entry that explains it. Apart from some differences between VM Cloning and using a reference image, both boil down to having pre-cooked disk(s) that are ready for creating more VMs from it. It is assumed that the environment would use DHCP and other vm specific customizations would be carried out on first boot.

As ConVirt is built with very flexible provisioning scheme, it only takes few simple steps to achieve this.

1. Select an image from the image store that is similar to your reference disk.

e.g. Select a PV image if your disk contains a Xen PV image or select a Linux_CD_Install if you want to use HVM. We will select the Linux_CD_Install.

2. Use Create Like operation from the context menu after selecting the image. Give it a name say ‘Developer Desktop’

3. Now that you have an image, lets customize and associate it with the reference disk. For this:

  • Find the directory of the image under the image store. This would typically be /var/cache/convirt/image_store/image_name. In this case it would be /var/cache/convirt/image_store/Developer_Desktop
  • Copy the reference disk under this location. (Note: I have compressed it using gzip)
    e.g. cp /mnt/gold_images/dev_desktop.img.gz /var/cache/convirt/Developer_Desktop
    Note : If you are copying a disk from an existing Virtual Machine, make sure that it is shutdown so that the disk is in a consistent state.
  • Select the Developer Desktop image from ConVirt and select ‘Edit Settings’ (Fig 1)
  • In the dialog box, select the disk entry and double click it. It should popup the Disk Information dialog.
  • Select the "Clone from a reference Disk" option.
  • Enter the reference disk location. You can use the file selector to select the file. Now instead of using absolute path, it is recommended to use $IMAGE_STORE/$IMAGE/dev_desktop.img.gz
  • Use Disk Image as the Reference Disk Type.
  • Select appropriate format. – [.gz] in this case since the image is compressed using gzip.
  • Press OK.

If you have more disks repeat this step.

4. As we have selected the Linux_CD_Install image, we need couple of more adjustments.

  • Go to the Miscellaneous tab and change the boot parm to ‘c’. This way the VM will not try to boot from a CDROM. (Fig. 2)
  • Remove the cdrom disk from the disk list.
  • Make any other adjustments like memory, cpu etc.

5. Now that we have our own image, lets change the description to reflect that. Update title, author (in case something goes wrong, people know whom to catch :) ), and procedure specific to the image. You can select the image and choose Edit Description. (Fig. 3 and 4)

6. Thats it !!. You have your own image template that now you can provision for each Developer. Select the image and provision away.

Fig 1 : Specify Reference Disk Details

Disk Information: Specify reference disk, its type and format

Fig 2: Change the Boot Settings

Change Boot settings

Fig 3 : Change Description

Edit the description of the Image.

Fig 4 : New Description

Image with new description

Bookmark and Share

Comments Closed

Sorry, comments for this entry are closed at this time.