Skip to content

Commit

Permalink
Add a "tests" directory with intial set of simple scripts, and Libvir…
Browse files Browse the repository at this point in the history
…t XMLs for

reference.

    tests/
    ├── libvirt-xmls-for-l1-l2
    │   ├── nested-guest.xml
    │   └── regular-guest.xml
    ├── nested-vmx-tests.rst
    └── scripts
        ├── create-nested-guest.bash
        └── create-regular-guest.bash
  • Loading branch information
kashyapc committed May 10, 2013
1 parent 611668a commit b14ed98
Show file tree
Hide file tree
Showing 5 changed files with 338 additions and 0 deletions.
56 changes: 56 additions & 0 deletions tests/libvirt-xmls-for-l1-l2/nested-guest.xml
@@ -0,0 +1,56 @@
<!--
WARNING: THIS IS AN AUTO-GENERATED FILE. CHANGES TO IT ARE LIKELY TO BE
OVERWRITTEN AND LOST. Changes to this xml configuration should be made using:
virsh edit nested-guest
or other application using the libvirt API.
-->

<domain type='kvm'>
<name>nested-guest</name>
<uuid>02ea8988-1054-b08b-bafe-cfbe9659976c</uuid>
<memory unit='KiB'>2097152</memory>
<currentMemory unit='KiB'>2097152</currentMemory>
<vcpu placement='static'>2</vcpu>
<os>
<type arch='x86_64' machine='pc-i440fx-1.4'>hvm</type>
<boot dev='hd'/>
</os>
<features>
<acpi/>
<apic/>
<pae/>
</features>
<clock offset='utc'/>
<on_poweroff>destroy</on_poweroff>
<on_reboot>restart</on_reboot>
<on_crash>restart</on_crash>
<devices>
<emulator>/usr/bin/qemu-kvm</emulator>
<disk type='file' device='disk'>
<driver name='qemu' type='qcow2' cache='none'/>
<source file='/home/test/vmimages/nested-guest.qcow2'/>
<target dev='vda' bus='virtio'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
</disk>
<controller type='usb' index='0'>
<address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
</controller>
<controller type='pci' index='0' model='pci-root'/>
<interface type='bridge'>
<mac address='52:54:00:65:c4:e6'/>
<source bridge='virbr0'/>
<model type='virtio'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
</interface>
<serial type='pty'>
<target port='0'/>
</serial>
<console type='pty'>
<target type='serial' port='0'/>
</console>
<input type='tablet' bus='usb'/>
<memballoon model='virtio'>
<address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/>
</memballoon>
</devices>
</domain>
60 changes: 60 additions & 0 deletions tests/libvirt-xmls-for-l1-l2/regular-guest.xml
@@ -0,0 +1,60 @@
<!--
WARNING: THIS IS AN AUTO-GENERATED FILE. CHANGES TO IT ARE LIKELY TO BE
OVERWRITTEN AND LOST. Changes to this xml configuration should be made using:
virsh edit regular-guest
or other application using the libvirt API.
-->

<domain type='kvm'>
<name>regular-guest</name>
<uuid>4ed9ac0b-7f72-dfcf-68b3-e6fe2ac588b2</uuid>
<memory unit='KiB'>6291456</memory>
<currentMemory unit='KiB'>6291456</currentMemory>
<vcpu placement='static'>4</vcpu>
<os>
<type arch='x86_64' machine='pc-i440fx-1.4'>hvm</type>
<boot dev='hd'/>
</os>
<features>
<acpi/>
<apic/>
<pae/>
</features>
<cpu mode='custom' match='exact'>
<model fallback='allow'>Haswell</model>
<feature policy='require' name='vmx'/>
</cpu>
<clock offset='utc'/>
<on_poweroff>destroy</on_poweroff>
<on_reboot>restart</on_reboot>
<on_crash>restart</on_crash>
<devices>
<emulator>/usr/bin/qemu-kvm</emulator>
<disk type='file' device='disk'>
<driver name='qemu' type='qcow2' cache='none'/>
<source file='/home/test/vmimages/regular-guest.qcow2'/>
<target dev='vda' bus='virtio'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
</disk>
<controller type='usb' index='0'>
<address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
</controller>
<controller type='pci' index='0' model='pci-root'/>
<interface type='bridge'>
<mac address='52:54:00:80:c1:34'/>
<source bridge='br0'/>
<model type='virtio'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
</interface>
<serial type='pty'>
<target port='0'/>
</serial>
<console type='pty'>
<target type='serial' port='0'/>
</console>
<input type='tablet' bus='usb'/>
<memballoon model='virtio'>
<address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/>
</memballoon>
</devices>
</domain>
76 changes: 76 additions & 0 deletions tests/nested-vmx-tests.rst
@@ -0,0 +1,76 @@
nVMX Tests
==========
This write up outlines the test setup and details to benchmark nested
virtualization test with Intel.

Terminology
-----------
L0 - Host Hypervisor
L1 - Guest Hypervisor
L2 - Nested Guest


Test environment
----------------
Test environment details:

- L0, L1, L2 -- All running minimal (@core only) RHEL7 / Fedora with
latest kernel.
- L0 -- 4 pCPUs, 20GB RAM
- L1 -- 4 vCPUs, 4GB RAM
- L2 -- 2 vCPUs, 2GB RAM

- Networking:
- L1 uses L0's standard linux bridge device - br0
- L2 uses Libvirt's default bridge - virbr0

- Storage:
- L1 uses a RAW disk or QCOW2 (with preallocation=metadata,
& fallocate).
- L2 uses a qcow2/v3 disk.

- With cache=none

- Ensure serial console is enabled on L1 & L2 kernel command line
- "console=tty0 console=ttyS0,115200"


Tests
=====
Once the nested guest (L2) is up and running, the below tests can be run
to demonstrate the current state of it:

1. CPU Intensive tests
----------------------
- `kernbench` - A complile-type benchmark that compiles the Linux kernel
multiple times.

- Compile libguestfs.

2. I/O Intensive tests
----------------------
- Test I/O activity inside L2 guests (Thanks to RWMJ):

For example::

$ find / -exec md5sum {} \; > /dev/null
$ find / -xdev -exec md5sum {} \; > /dev/null

- Run `netperf` on L1 & L2

3. Libguestfs tests in nVMX setup
---------------------------------
- On L0 & L1, run the below command. Note that the command needs to be run
multiple times to get a hot cache::

$ time guestfish -a /dev/null run'

4. Live migration of a guest hypervisor
---------------------------------------
- FIXME

5. Multiple nested guests
-------------------------
- Run multiple nested guests


72 changes: 72 additions & 0 deletions tests/scripts/create-nested-guest.bash
@@ -0,0 +1,72 @@
#!/bin/bash
#
# Copyright (C) 2012 Red Hat Inc.
# Author <kashyap.cv@gmail.com>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.

#Let's create a minimal kickstart file with serial console enabled
#NOTE for F16 serial console login w/o any line-breaks, disable plymouth service and reboot the vm -- $ ln -s /dev/null /etc/systemd/system/plymouth-start.service

cat << EOF > fed.ks
install
text
reboot
lang en_US.UTF-8
keyboard us
network --bootproto dhcp
rootpw testpwd
firewall --enabled --ssh
selinux --enforcing
timezone --utc America/New_York
bootloader --location=mbr --append="console=tty0 console=ttyS0,115200 rd_NO_PLYMOUTH serial text"
zerombr
clearpart --all --initlabel
autopart
%packages
@core
%end
EOF


#Disk Image location
diskimage=/home/test/vmimages/nested-guest.qcow2

#Create the qcow2 disk image with preallocation and 'facllocate'(which pre-allocates all the blocks to a file) it for max. performance
echo "Creating qcow2 disk image.."
qemu-img create -f qcow2 -o preallocation=metadata $diskimage 50G
fallocate -l `ls -al $diskimage | awk '{print $5}'` $diskimage
echo `ls -lash $diskimage`


#Create the nested-guest
virt-install --connect=qemu:///system \
--network=bridge:virbr0 \
--initrd-inject=./fed.ks \
--extra-args="ks=file:/fed.ks console=tty0 console=ttyS0,115200 serial rd_NO_PLYMOUTH" \
--name=nested-guest \
--disk path=$diskimage,format=qcow2,cache=none \
--ram 2048 \
--vcpus=2 \
--check-cpu \
--accelerate \
--os-type linux \
--os-variant fedora18 \
--cpuset auto \
--hvm \
--location=http://download.fedoraproject.org/pub/fedora/linux/releases/18/Fedora/x86_64/os \
--nographics

74 changes: 74 additions & 0 deletions tests/scripts/create-regular-guest.bash
@@ -0,0 +1,74 @@
#!/bin/bash
#
# Copyright (C) 2013 Red Hat, Inc.
# Author <kchamart@redhat.com>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#Let's create a minimal kickstart file with serial console enabled

#NOTE For serial console login w/o any line-breaks, disable plymouth service and reboot the vm -- $ ln -s /dev/null /etc/systemd/system/plymouth-start.service

#Ensure to have /export/vmimgs directory or change the path below

cat << EOF > fed.ks
install
text
reboot
lang en_US.UTF-8
keyboard us
network --bootproto dhcp
rootpw testpwd
firewall --enabled --ssh
selinux --enforcing
timezone --utc America/New_York
bootloader --location=mbr --append="console=tty0 console=ttyS0,115200 rd_NO_PLYMOUTH serial text"
zerombr
clearpart --all --initlabel
autopart
%packages
@core
%end
EOF


#Disk Image location
diskimage=/home/test/vmimages/regular-guest-f18.qcow2
#diskimage=/export/vmimgs/regular-guest-f18.qcow2

#Create the qcow2 disk image with preallocation and 'facllocate'(which pre-allocates all the blocks to a file) it for max. performance
echo "Creating qcow2 disk image.."
qemu-img create -f qcow2 -o preallocation=metadata $diskimage 150G
fallocate -l `ls -al $diskimage | awk '{print $5}'` $diskimage
echo `ls -lash $diskimage`

#Create the regular-guest
virt-install --connect=qemu:///system \
--network=bridge:br0 \
--initrd-inject=./fed.ks \
--extra-args="ks=file:/fed.ks console=tty0 console=ttyS0,115200 serial rd_NO_PLYMOUTH" \
--name=regular-guest-f18 \
--disk path=$diskimage,format=qcow2,cache=none \
--ram 4096 \
--vcpus=4 \
--check-cpu \
--accelerate \
--os-type linux \
--os-variant fedora18 \
--cpuset auto \
--hvm \
--location=http://download.fedoraproject.org/pub/fedora/linux/releases/18/Fedora/x86_64/os \
--nographics

0 comments on commit b14ed98

Please sign in to comment.