Monday, December 17, 2012

macvtap

http://hekate.homeip.net/2011/06/kvm-macvtap-interface-bridging/

New Autotest usage


1)  get autotest git recursively.

git clone --recursive git://github.com/autotest/autotest.git

2)  cd autotest/client/tests/virt

3) cd kvm  or cd libvirt

4) ./get_started.py

5) change tests.cfg which is in cfg folder

6) cd autotest/client/tests/virt

7) export AUTOTEST_PATH= 
                                            for ex: /home/autotest

8) ./run -t kvm --verbose

    or

   ./run -t libvirt --verbose

Please use ./run -h for more help. 

Monday, June 11, 2012

Great article on git by nvie. http://nvie.com/posts/a-successful-git-branching-model/

Sunday, April 15, 2012

Perf KVM

Perf KVM in RHEL6.1:
===================

Thanks to supriya kannery for documenting perf kvm

RPM
=====
[root @]# rpm -qa | grep perf
perf-2.6.32-131.0.15.el6.x86_64

Preparation:
==========
Before running perf kvm in host, need to save files /proc/modules and /proc/kallsyms from guest into host.
One of the easiest methods is as follows:

> start VM with host portforwarding
start guest

> Login to the guest and save modules and kallsyms
cat /proc/modules > /tmp/modules
cat /proc/modules > /tmp/kallsyms
>> From host get the above two files.
scp -P 5555 root@localhost:/tmp/kallsyms guest-kallsyms
scp -P 5555 root@localhost:/tmp/modules guest-modules

Note: if directly scp from /proc/modules, zero sized files are copied. Hence first save /proc/xx into locate files in guest and then copy to host.

Start recording events in guest and host
===========================
perf kvm --host --guest --guestkallsyms=guest-kallsyms --guestmodules=guest-modules record -a -o perf.data

Output will be stored in perf.data.kvm if both --host and --guest are specified. If only --host is specified the file will be named perf.data.host and if only --guest is specified file will be named perf.data.guest

On pressing Ctl+C or SIGINT perf stops recording.

Report the events:
===============
perf kvm --host --guest --guestkallsyms=guest-kallsyms --guestmodules=guest-modules report -i perf.data --force

Note: without using --force I couldn't collect report even though the recorded file and report was generated using same userid or root. This might be a bug to be looked at. But for now, reporting works with --force option.

Sample results:
[root]# perf kvm --host --guest --guestmodules=guest-modules report -i perf.data.kvm --force > analyse
[root]# cat analyse
# Events: 7K cycles
#
# Overhead Command Shared Object Symbol
# ........ ............ ................. .....................................
#
95.06% vi vi [.] 0x48287
0.61% init [kernel.kallsyms] [k] intel_idle
0.36% vi libc-2.12.so [.] _wordcopy_fwd_aligned
0.32% vi libc-2.12.so [.] __strlen_sse42
0.14% swapper [kernel.kallsyms] [k] intel_idle
0.13% init [kernel.kallsyms] [k] uhci_irq
0.11% perf [kernel.kallsyms] [k] generic_exec_single
0.11% init [kernel.kallsyms] [k] tg_shares_up
0.10% qemu-kvm [kernel.kallsyms] [k] tg_shares_up


[root]# perf report --sort comm,dso -i perf.data.kvm --force > highlevel
[root]# cat highlevel
# Events: 7K cycles
#
# Overhead Command Shared Object
# ........ ............ .................
#
95.06% vi vi
1.55% init [kernel.kallsyms]
0.75% vi [kernel.kallsyms]
0.69% vi libc-2.12.so
0.50% perf [kernel.kallsyms]
0.30% swapper [kernel.kallsyms]
0.19% ps [kernel.kallsyms]
0.17% qemu-kvm [kernel.kallsyms]
0.09% events/5 [kernel.kallsyms]
0.09% events/1 [kernel.kallsyms]
0.09% events/24 [kernel.kallsyms]
0.08% ps libc-2.12.so
0.08% events/25 [kernel.kallsyms]
0.07% kondemand/8 [kernel.kallsyms]
0.07% kondemand/23 [kernel.kallsyms]
0.07% perf libc-2.12.so
0.07% watchdog/26 [kernel.kallsyms]
0.01% kondemand/15 [kernel.kallsyms]
0.01% ksoftirqd/18 [kernel.kallsyms]
0.01% perf [nfs]
0.01% ps libproc-3.2.8.so
0.01% qemu-kvm [unknown]
0.01% qemu-kvm qemu-kvm
0.00% sleep [kernel.kallsyms]
0.00% awk [kernel.kallsyms]

Thursday, May 5, 2011

KVM Autotest

Autotest is a framework for fully automated testing. It is designed primarily to +test the Linux kernel, though it is useful for many other functions such as +qualifying new hardware. It's an open-source project under the GPL and is used +and developed by a number of organizations,including Google, IBM, Red Hat, and +many others.

The KVM-Autotest system is a client test for the autotest framework. Its main purpose is to serve as an automated regression testing tool for KVM developers, and for doing regular automated testing of KVM (provided you use it with the server testing infrastructure).

How to setup KVM Autotest
---------------------------------

Please find below steps to setup KVM Autotest.

1. Get autotest git
git clone git://github.com/autotest/autotest.git

2. Packages required.
yum install qemu-kvm qemu-kvm-tools syslinux

3. cd autotest/client/tests/kvm

4. ./get_started.py

Recommend to select "N" for all. It does basic setup to get started.

5. mkdir /tmp/kvm_autotest_root/isos/linux

6. mount your required iso here.

mount -t nfs < your iso> /tmp/kvm_autotest_root/isos/linux

7. get md5sum, md5sum_1M of your iso.

md5sum

dd if= bs=1M count=1| md5sum

or

./autotest/client/tools/cd_hash.py


8. cd autotest/client/tests/kvm

Here 3 files needs to be changed

1. tests.cfg
2. edit guest-os.cfg
3. base.cfg

tests.cfg:

qemu_binary = /usr/bin/qemu-kvm
qemu_img_binary = /usr/bin/qemu-img
only raw
only virtio_net
only virtio_blk
only smp2
only no_pci_assignable
only smallpages
only RHEL.6.64
only unattended_install.cdrom, boot, shutdown


base.cfg

You can make change base.cfg as per your requirement.
for ex: nics, network_mode = tap/user, script = qemu-ifup/qemu-ifup-ipv6, ..... etc.
I recommend to try with Redhat guest once, before ubuntu.
edit iso name, md5sum, md5sum_1m in .

guest-os.cfg

ex:

- 6.64:
no setup
nic_hotplug:
modprobe_module =
block_hotplug:
modprobe_module =
image_name = rhel6-64
unattended_install:
unattended_file = unattended/RHEL-6-series.ks
#floppy = images/rhel60-64/ks.vfd
cdrom_unattended = images/rhel61-64/ks.iso
kernel = images/rhel61-64/vmlinuz
initrd = images/rhel61-64/initrd.img
unattended_install.cdrom:
cdrom_cd1 = isos/linux/RHEL-6.0-x86_64-DVD.iso../.
md5sum_cd1 = f7141396c6a19399d63e8c195354317d
md5sum_1m_cd1 = b060eeef63e2c8700db54ae02056e80c

9. run ../../common_lib/cartesian_config.py control --verbose


if your setup is fine, dictionaries will get generated.

10. run your basic guest install test:

../../bin/autotest control --verbose


For more details:

http://www.linux-kvm.org/page/KVM-Autotest

Tuesday, July 27, 2010

Virtualization new era starts with KVM...

KVM (Kernel-based Virtual Machine) has been accepted by kernel gurus such as Linus Torvalds and Andrew Morton for inclusion in version 2.6.20 of the Linux kernel, developers said earlier this week. The system consists of a loadable kernel module and a user component, and is licensed under the GNU General Public License.

KVM links: KVM website, KVM whitepaper, Qumranet,

KVM is a patch to the Linux kernel that is more like VServer, Solaris containers, or microkernels [see footnote], where the OS still sits directly on the hardware. Some aspects of the current KVM release (mostly pulled from their FAQ):

  • KVM guest OSs appear as a process and can be managed with top, kill, etc.
  • KVM requires either a VT capable Intel processor or an SVM capable AMD processor (which is a currently a big limitation for grid providers but this will become less and less of an issue as older clusters are phased out).
  • Uses QEMU for guest instantiation, but is not an emulator itself
  • Runs Windows 32bit already (with no apci)
  • I have yet to figure out if it relies on these kernel enhancements for OS level virtualization
  • The current implementation should probably be seen as a preview, Fraser Campbell reports that it was “decidedly slow” when he tried it.

Tuesday, June 22, 2010

memory ballooning

Memory ballooning allows you to have your guest dynamically change it’s memory usage by evicting unused memory during runtime. This is a useful feature because it reduces the impact your guest can have on memory usage of your host by giving up unused memory back to the host.

Certain guests (only Linux at the moment) have a balloon driver, so the host can have the guest allocate a certain amount of memory which the guest won't be able to use anymore and it can then be freed on the host.

Below command gives the information regarding free memory. Using balloon command you can change guest machine to change it’s memory allocation to the specified amount in MB which is 800MB in the below example.

(qemu) info balloon

The syntax for the command to actually perform memory ballooning is as follows.

(qemu) balloon 800