HPC @ Uni.lu

High Performance Computing in Luxembourg

Starting Virtual Machines on Chaos

It is now possible to start virtual machines on Chaos, however it is still experimental.

We wanted to support these features:

Start an interactive session

$ ssh chaos-cluster
(access-chaos) $ oarsub -I -l nodes=1,walltime=2:0:0

Compile Qemu 1.6.1

In your home directory, create a script named install_qemu.sh. This script will compile Qemu in $BUILDDIR and install it in $INSTALLDIR.

set +x


mkdir -p $INSTALLDIR

wget $URL
tar xvf $FILENAME

cd qemu-1.6.1

./configure --disable-rdma --enable-kvm --prefix=${INSTALLDIR}/usr \
            --sysconfdir=${INSTALLDIR}/etc --enable-docs --enable-mixemu \
            --libexecdir=${INSTALLDIR}/usr/lib/qemu --disable-gtk \
            --enable-linux-aio --localstatedir=${INSTALLDIR}/var \

make install

Execute it:

(node) $ chmod +x install_qemu.sh
(node) $ ./install_qemu.sh

Eventually, you can build a module with this easyconfig instead. Create a file named qemu-1.6.1.eb and containing these lines:

name = 'qemu'
version = '1.6.1'

homepage = 'http://www.qemu.org/'
description = "qemu-0.16.1: CPU emulator using dynamic translation"

sources = [SOURCE_TAR_BZ2]
source_urls = ['http://wiki.qemu.org/download/']

toolchain = {'version': 'dummy', 'name': 'dummy'}

configopts = "--disable-rdma --enable-kvm --disable-rdma --enable-docs "
configopts += "--enable-mixemu --disable-gtk --enable-linux-aio --enable-virtfs"

sanity_check_paths = {
    'files': ['bin/qemu-x86_64'],
    'dirs': [],

moduleclass = 'tools'

Then build it

(node) $ module load EasyBuild/1.10.0
(node) $ eb qemu-1.6.1.eb

And load it :)

(node) $ module load qemu/1.6.1-20131016

Generate a new VM

On an external Debian/Ubuntu System, generate a qcow2 image with vmdebootstrap and transfer it to the cluster. In this example, we create a disk file of 3GB containing a debian system, and we enable DHCP.

# apt-get install debootstrap extlinux qemu-kvm parted mbr kpartx python-cliapp
# git clone http://git.gitorious.org/vmdebootstrap/vmdebootstrap.git
# ./vmdebootstrap --image debian_ref.qcow2 --size 3g --log test.log \
  --log-level debug --verbose --mirror http://debian.mirror.root.lu/debian \
  --package=openssh-server --serial-console --enable-dhcp --root-password=hpc

$ scp debian.qcow2 chaos-cluster:

Eventually, you can directly copy the VM available in my home directory: /home/users/hcartiaux/debian_ref.qcow2. The root password is simply hpc.

Start your VM

Copy the file in /tmp

(node) $ cp ~/debian_ref.qcow2 /tmp/debian_ref.qcow2

Create a directory /tmp/share, which will be shared with the VM. According to my tests, directories located in an NFS mount point will be shared in read only.

(node) $ mkdir /tmp/share

Start your VM with this command:

(node) $ $INSTALLDIR/usr/bin/qemu-system-x86_64 --enable-kvm -nographic -hda /tmp/debian_ref.qcow2 \
 -m 512 -smp 4 -net nic,model=virtio -net user -redir tcp:4222::22 \
 -fsdev local,security_model=mapped,id=fsdev0,path=/tmp/share \
 -device virtio-9p-pci,id=fs0,fsdev=fsdev0,mount_tag=hostshare

Or, if you have compiled Qemu with easybuild:

(node) $ module load qemu/1.6.1-20131016
(node) $ qemu-system-x86_64 --enable-kvm -nographic -hda /tmp/debian_ref.qcow2 \
 -m 512 -smp 4 -net nic,model=virtio -net user -redir tcp:4222::22 \
 -fsdev local,security_model=mapped,id=fsdev0,path=/tmp/share \
 -device virtio-9p-pci,id=fs0,fsdev=fsdev0,mount_tag=hostshare

For more convenience, use screen

SSH into the VM

(node) $ ssh root@localhost -p 4222

          root@localhost's password: 
          Linux debian 3.2.0-4-amd64 #1 SMP Debian 3.2.46-1 x86_64
          The programs included with the Debian GNU/Linux system are free software;
          the exact distribution terms for each program are described in the
          individual files in /usr/share/doc/*/copyright.
          Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
          permitted by applicable law.
          Last login: Wed Oct 16 13:50:32 2013 from

Mount the shared directory

(VM) # mkdir /tmp/host_files
(VM) # mount -t 9p -o trans=virtio,version=9p2000.L hostshare /tmp/host_files

(VM) # df
       Filesystem  1K-blocks    Used Available Use% Mounted on
       hostshare   128550388 3121768 125428620   3% /tmp/host_files