Preparing your VMs
GRUB Config
A couple of things which are relevant to deterministic time-trave:
- It's always useful to keep three boot configurations around: i) TT Xen + TT Linux; ii) TT Xen + non-TT Linux; iii) Plain non-Xen Linux. This becomes useful when you break the boot of your dom0, or even Xen.
- I use a couple of unusual Xen boot params.
watchdog=1
enables a watchdog timer in Xen, this is helpful to debug your system when everything but NMIs gets stuck.sync_console=1
forces synchronous console behavior -- this is useful to make sure that all console messages appear on the screen before the crash. Finally, I limit the number of dom0's CPUs to 1, and the size of its memory to 500MB.
Your grub config should look similar to the one below:
Guest VM Configuration
Several things are specific to configuring and running time-traveling VMs:
- At the moment, we have to keep the amount of memory in a guest VM small. The reason for that is a performance issue, which severely affects the boot time of a guest VM, which freezes everything for a noticeable period of time.
- Disk configuration has several parameters which our codebase inherits from out previous project (xenvg,/dev/sdb/lvm_1,3G). Similar,
time_travel
option is required only for backward compatibility. - Deterministic time-travel relies on shadow memory to virtualize machine memory for the time-traveling VM. The goal here is to make sure that the time-traveling VM sees the same set of pages across original and replay runs. To enable it we need the
auto_translated_physmap
feature.
The following is an example of a domU configuration file (this is clientA.conf
, which we use in our time-travel invocation examples):
Preparing VMs Images
We create guest VM images with a simple copy technique. Essentially, we copy content of a dom0 file system into the guest's file system. This can be done with the following steps:
Create a 3GB file for the guest file system:
Set up a loop device for the file we've created:
Create a file system:
Mount guest and host file systems, and copy files from host to guest. At the end create all necessary directories:
Make sure you edit guest's /etc/fstab
to have a proper root mount:
Simple RAM-based image
If you want to experiment with time-travel, the best way is probably start with a RAM-based Linux -- you can run networking experiments, but at the same time you do not have to wait for a slow disk-based distribution to boot. You can download this minimal busybox-based RAM Linux, and boot it with the VM configuration file below (use root/root to log in):
The config file expects that you put the initrd file in /boot/initrd-busybox-based-ram-linux.img, and that you enable NAT networking as described below.
Simple Disk-based image
Creating Custom initrd Images
Unpack an existing initrd:
Repack (from initrd folder do):
Disk snapshots with LVM
Create a new LVM volume:
Before starting a time-traveling VM, create an LVM snapshot. Of course, make sure that your VM configuration file is edited to start off the snapshot (e.g. /dev/xenvg/snap1):
After finishing the original run, delete the snapshot:
And of course create a snapshot again with the command above before starting the replay run.
Networking
Xen takes care of most of network configuration issues. You have several options which you are described here:
We typically use bridged, or NAT.
- NAT:
- Enable NAT in the /etc/xen/xend-config.sxp. Uncomment the following lines (make sure you disable the bridged networking):
(network-script network-nat)(vif-script vif-nat)- Add the following line to your guest VM config:
vif = [ 'ip=10.0.0.1' ] - Bridged networking:
- Enable the bridged networking in the /etc/xen/xend-config.sxp, basically add the following lines (make sure you disable NAT):
(network-script network-bridge)(vif-script vif-bridge)- Add the following line to your guest VM config: