Virtual Machines#
Production VMs#
We operate a Ganeti cluster of servers that can host KVM virtual guests. The VM guests use the same bootstrap and installation process as our real servers.#
Installation#
DNS
Ganeti associates virtual machines with DNS hostnames, so the first step is to add a hostname for the new VM to the DNS servers. Check that the name resolves before moving on the next step.#
Create initial VM
Connect to the cluster master node at gnt01.hep.wisc.edu
to create the virtual machine
instance using the command#
sudo gnt-instance -t drbd -s 50G -o raw-image+default --no-install exampleVM
By default, the VM instances have 1 virtual CPU and 1 gigabyte of RAM allocated. To override the
default, add the argument, for example, -B vcpus=2,memory=4G
. The size (given by -s) of
the instance disk may vary; the baseline SL6 install needs a minimum of 50G, but other installs may
use more or less.#
NOTES: In certain situations, the arguments --no-ip-check
and
--no-name-check
may be useful, as they tell Ganeti, respectively, not to check whether
the IP address is already in use and not to check whether the DNS hostname is assigned. We do not
use Ganeti’s OS management scripts, so choosing raw-image+default as the OS type and passing the
–no-install argument results in an empty virtual machine ready for kickstarting.#
After the creation of the virtual machine instance completes, run#
sudo gnt-instance info exampleVM
and make note of three items that Ganeti has assigned to the instance: 1) the MAC address, 2) the primary node and 3) the console connection address.#
DHCP
Configure the DHCP server using the MAC address that Ganeti assigned to the virtual machine.#
Puppet
Kickstart
Follow the steps to set up a Kickstart installation.#
Start VM
On your local machine, connect to the primary node for the VM via ssh with#
ssh -L 5900:127.0.0.1:11043 hostname
where the string after 5900: is the console connection address noted earlier using gnt-instance and the hostname is the VM’s primary node.#
To start the VM, on the Ganeti cluster master node run the command#
sudo gnt-instance startup exampleVM
When the gnt-instance command completes, start the VNC viewer (on your local machine) and connect to localhost (as follows)#
vncviewer localhost
If everything worked according to plan, you should see the BIOS of the VM connect to the DHCP server, then the pxeboot and kickstart process should begin and output information to the console.#
The VM should kickstart, reboot, run firstboot scripts, restart again and then be fully configured.#
Note : For a fresh kickstart startup the VM with the boot from network option. Otherwise, the VM will boot from the disk (default) with the existing OS on it (instead of a fresh kickstart). #
sudo gnt-instance startup -H boot_order=network exampleVM
Networking#
Kickstart may fail if the host system is using a wireless interface on a network that uses a captive portal. DNS lookups may also fail if the guest’s virtual network interface is in NAT mode – switching to bridged mode should allow kickstart to proceed. Once the guest is installed and booted, either NAT or bridge mode should work.#
Backup#
Each VM is mirrored on a secondary node via DRBD. If the VM’s primary node fails and the VM is down, to restore it quickly, connect to gnt01 and run#
sudo gnt-instance failover exampleVM
Then consult the Ganeti manual on restoring a failed node.#
Desktop VMs#
While production VMs should run on the dedicated VM servers, it can be useful to have one or more temporary VMs to develop or test new services. Most VM managers (QEMU, VMWare, VirtualBox) can boot a testing VM using a Scientific Linux installation ISO and a VM kickstart configuration.#
VirtualBox provides an easy-to-use GUI for OS X, Windows and Linux. To start a testing VM with VirtualBox, follow the new machine wizard (Machine > New menu) using the default options and the following template:#
- Operating system:
linux
- Version:
Linux 2.6 (64 bit)
- Virtual disk size:
16 GB
Start the newly defined machine by clicking on it (or Machine > Start). When the First Run Wizard prompts for the installation media, point it to the installation ISO you downloaded earlier. The VM will then boot the ISO; enter the following at the kernel prompt:#
linux ks=http://ks01.hep.wisc.edu/ks/vm
The installation will then proceed and, after it completes, the VM will restart.
After the firstboot sequence is complete, the system will autologin as the vm
user with sudo rights.#