VM Creation

Storage Setup
We use iSCSI LUNs to back the partitions for our VM cluster. Each VM has at least two LUNs for a root and a swap partition. Some VMs may have additional partitions for specific purposes.

Once you know how many and what size partitions you will need, see the SAN/iSCSI Administration guide for detailed instructions on configuring a LUN for each required partition. When you are done, you should have device nodes in /dev/mapper for each new volume

Filesystems
We currently use ext4 as the main filesystem for all of our VM partitions except for swap partitions (obviously). Create filesystems on each of the new VMs partitions now; then mount them on the host VM server.

Double-check that the device is writable; occasionally it gets locked RO for some unknown reason. If this dosen't work you may need to recreate the device nodes

VM Installation
We maintain a prebuilt base VM along with an excludes file that can be used to very quickly install a new VM without having to go through the normal Gentoo install process. Use the following commands to copy the stage64 image to the new VM. If you need the kernel sources (only if you need to compile 3rd party modules such as AFS)

VM Postinstall
There are a few postinstall steps that need to be completed on the copied image before it is ready to run. First, chroot into the new VM and set the root password.

If you have any additional partitions beyond root and swap, add them to /etc/fstab.

Configure the system's new identity in various files and make sure that no part of stage64's identity was copied over.

Finally, exit the chroot and unmount all of the VM's partitions.

Libvirt VM Definition
Copy the stage64 XML configuration file to create the new VM's configuration; then edit it as detailed below. Set name, partitions, kernel, memory, and networking as appropriate Mac address is derrived from the IPv4 Address of the system

Load the new VM's configuration into libvirt and then start the new VM.