Installing KVM on Ubuntu 10.04

2011.07.03 18:14

Check full-virtualization support on CPU
># egrep -c '(vmx|svm)' /proc/cpuinfo

Install KVM
># sudo apt-get install qemu-kvm libvirt-bin ubuntu-vm-builder bridge-utils virt-manager

Verify Installation 
># virsh list

Install guest OS using virt-manager
* used the ISO file for the installation


># virt-manager

Accessing the guest OS via console
># vim /etc/init/ttyS0.conf

Enable real-network on the guest OS




References
1.
2.
3.  
저작자 표시
신고

'linux > virtualization' 카테고리의 다른 글

Installing KVM on Ubuntu 10.04  (0) 2011.07.03
Sample VM Xen config file in CentOS  (0) 2011.06.29
Hypervisor (Xen & KVM) Pinning  (0) 2011.05.30
Enable para-virtualized driver for network/disk in KVM  (0) 2011.05.16
Resize Xen image file  (0) 2011.03.23
Running 32-bit DomU on 64-bit Dom0  (0) 2011.03.22

Frank kenshin579 linux/virtualization install, KVM

Sample VM Xen config file in CentOS

2011.06.29 04:22
 name = "xptemplate"
uuid = "4d9f36dd-ea42-4a08-afd3-3546b24edbfe"
maxmem = 1024
memory = 512
vcpus = 1
builder = "hvm"
kernel = "/usr/lib/xen/boot/hvmloader"
boot = "c"
pae = 1
acpi = 0
apic = 0
localtime = 0
on_poweroff = "destroy"
on_reboot = "restart"
on_crash = "restart"
device_model = "/usr/lib64/xen/bin/qemu-dm"
sdl = 0
vnc = 1
vncunused = 1
keymap = "en-us"
#disk = [ "file:/mnt/vine_data/vinem_xptemplate-20080707.img,xvda,w" ]
disk = [ "file:/mnt/vine_data/vinem_xptemplate-20080707.img,hda,w" ]
#vif = [ "mac=00:16:3E:41:7C:23,bridge=xenbr0,script=vif-bridge" ]
vif = [ "mac=00:16:3E:41:7C:23,type=ioemu,bridge=xenbr0" ]
serial = "pty"
usbdevice='tablet'




저작자 표시
신고

'linux > virtualization' 카테고리의 다른 글

Installing KVM on Ubuntu 10.04  (0) 2011.07.03
Sample VM Xen config file in CentOS  (0) 2011.06.29
Hypervisor (Xen & KVM) Pinning  (0) 2011.05.30
Enable para-virtualized driver for network/disk in KVM  (0) 2011.05.16
Resize Xen image file  (0) 2011.03.23
Running 32-bit DomU on 64-bit Dom0  (0) 2011.03.22

Frank kenshin579 linux/virtualization xen config file

Hypervisor (Xen & KVM) Pinning

2011.05.30 13:51
Xen
># xm vcpu-list
># xm vcpu-pin green1 0-2

KVM
># taskset 0x00000003 qemu-system-x86_64 -hda green1.img -m 2048
># ps -eo pid,comm  | grep qemu
7532 qemu-system-x86

Current affinity mask
># taskset -p 7532

List current affinity list
># taskset -c -p 7532

Modify an already running KVM process
># taskset -p 0x00000001 7532

Can I using virsh command to pin core in KVM??

References
1. Pinning KVM, http://www.linux-kvm.com/content/tip-running-your-vm-specific-cpus
2. Xen VCPU Pinning Defaults Aren't Ideal, http://www.thefraggle.com/2009/09/01/xen-vcpu-pinning-defaults-arent-ideal/ 
3.  
저작자 표시
신고

'linux > virtualization' 카테고리의 다른 글

Installing KVM on Ubuntu 10.04  (0) 2011.07.03
Sample VM Xen config file in CentOS  (0) 2011.06.29
Hypervisor (Xen & KVM) Pinning  (0) 2011.05.30
Enable para-virtualized driver for network/disk in KVM  (0) 2011.05.16
Resize Xen image file  (0) 2011.03.23
Running 32-bit DomU on 64-bit Dom0  (0) 2011.03.22

Frank kenshin579 linux/virtualization CPU cache effects, CPU pinning, KVM, Xen

Enable para-virtualized driver for network/disk in KVM

2011.05.16 21:28
Here is a manual way to configure para-virtulized driver for network in KVM.

Missing virtio option.
     <interface type='bridge'>
      <mac address='54:52:00:55:55:37'/>
      <source bridge='br0'/>
      <target dev='vnet0'/>
    </interface>

># virsh shutdown green15
># virsh dumpxml green15 > green15.xml
Edit the green15.xml and add the following line
     <interface type='bridge'>
      <mac address='54:52:00:55:55:37'/>
      <source bridge='br0'/>
      <target dev='vnet0'/>
      <model type='virtio'/>
    </interface>

># virsh define green15.xml
># virsh start green15

Testing
green15># netserver

remote># netperf -H green15 -l 20 -f K


References
1.  KVM, Virt-manager and virtio, http://www.linux-archive.org/fedora-linux-management-tools/192301-kvm-virt-manager-virtio.html
2. Using KVM para-virtualized drivers for existing devices, http://docs.redhat.com/docs/en-US/Red_Hat_Enterprise_Linux/6/html/Virtualization/form-Virtualization-Installing_the_KVM_Windows_para_virtualized_drivers-Using_KVM_para_virtualized_drivers_for_existing_devices.html
3.
저작자 표시
신고

Frank kenshin579 linux/virtualization block device, KVM, network device, virtio

Resize Xen image file

2011.03.23 14:09

># dd if=/dev/zero bs=1M count=4096 >> root.img
># e2fsck -f root.img
># resize2fs root.img

># xm create green10.cfg
># xm console green10
># df -h


References
1.  Howto: Resize Xen Loop Disk Image, http://mediakey.dk/~cc/howto-resize-xen-loop-disk-image/
저작자 표시
신고

Frank kenshin579 linux/virtualization dd, xen image resize

Running 32-bit DomU on 64-bit Dom0

2011.03.22 13:54
OS (infi8): Ubuntu 9.04 64-bit
VMware (ubuntu) : Ubuntu 9.04 (32-bit)

If these two files were in the http://ftp.debian.org/debian/pool/main/l/linux-2.6 repository, then I would have to do the hard way, but it seems I don't have much choice. So here is the steps. 

linux-modules-2.6.26-2-xen-686_2.6.26-15_i386.deb
sudo dpkg -i linux-image-2.6.26-2-xen-686_2.6.26-15_i386.deb

From the vmware
># wget https://launchpad.net/~canonical-kernel-team/+archive/ppa/+buildjob/2324925/+files/linux-image-2.6.24-29-xen_2.6.24-29.88_i386.deb
># dpkg -i linux-image-2.6.24-29-xen_2.6.24-29.88_i386.deb
># mkinitramfs -o /boot/initrd.img-2.6.24-29-xen 2.6.24-29-xen
># scp initrd.img-2.6.24-29-xen System.map-2.6.24-29-xen vmlinuz-2.6.24-29-xen root@infi8:/boot

># sudo xen-create-image --arch=i386 --hostname=green14  --ip=192.168.1.24 --dist=jaunty \
 --mirror=http://ftp.daum.net/ubuntu  --partitions=green \
 --force --boot --passwd --role udev

># ssh green14
># uname -a



Current problems:
># xm console green14
No console prompt!!
I already tried modifying /etc/event.d/hvc0 file like how I have done (#2). But, it does not work. 


References
1.  Running 32-bit xenU sessions on a 64-bit CentOS xen0, http://www.jms1.net/xen/32bit-on-64bit.shtml
2. Installing Xen on Ubuntu 9.04 with binary package, http://kenshin579.tistory.com/entry/Installing-Xen-on-Ubuntu-904-w-binary-package
저작자 표시
신고

Frank kenshin579 linux/virtualization 32-bit dom0, 64-bit dom0, Xen

OpenNebula Installation and Usage on Ubuntu 9.04

2011.03.09 16:32

System Info:
OS: Ubuntu 9.04 64-bit
Xen: 3.3
OpenNebula, NFS server: cloud
Managed Systems (Xen): infi5, infi6, infi7, infi8

Preparation
>> Manager (OpenNebula, Storage (NFS) Server)
1. Compile source code
># tar -xvzf opennebula-2.0.1.tar.gz
># apt-get install ruby sqlite3 libsqlite3-dev libsqlite3-ruby1.8 libxml2-dev scons rake flex bison
># cd opennebula-2.0.1
># ./install.sh -d /srv/cloud/one

2. Configure SSH 
># ssh-keygen -t rsa -P '' -f ~/.ssh/id_rsa
># ssh-copy-id -i /root/.ssh/id_rsa.pub root@infi5
># ssh-copy-id -i /root/.ssh/id_rsa.pub root@infi6
...
># ssh-copy-id -i /root/.ssh/id_rsa.pub root@infi8

3. NFS server
># apt-get install nfs-kernel-server
># vim /etc/exports
 /mnt/iso            192.168.1.0/24(rw,sync)
/srv/cloud/one/var  192.168.1.0/24(rw,no_root_squash,sync)

># /etc/init.d/nfs-kernel-server restart

>> On Clusters
1. Xen installation
* Just follow #2 instruction

># vim /etc/sudoers
%admin ALL=(ALL) ALL
%xen    ALL=(ALL) NOPASSWD: /usr/sbin/xm *
%xen    ALL=(ALL) NOPASSWD: /usr/sbin/xentop *

2. Needed packages for OpenNebula
># apt-get install ruby mkisofs

3. NFS client
># apt-get install nfs-client
># vim /etc/fstab
client:/srv/cloud/one/var /srv/cloud/one/var nfs defaults 0 2
># mount -a

4. Misc.
># vim /etc/modprobe.d/local-loop
options loop max-loop=64


OpenNebula Configuration
1. Basic Configuration
># vim /srv/cloud/one/etc/oned.conf
 OST_MONITORING_INTERVAL = 600

VM_POLLING_INTERVAL      = 600

VM_DIR=/srv/cloud/one/var

IM_MAD = [
    name       = "im_xen",
    executable = "one_im_ssh",
    arguments  = "xen" ]

VM_MAD = [
    name       = "vmm_xen",
    executable = "one_vmm_ssh",
    arguments  = "xen",
    default    = "vmm_ssh/vmm_ssh_xen.conf",
    type       = "xen" ]

TM_MAD = [
    name       = "tm_nfs",
    executable = "one_tm",
    arguments  = "tm_nfs/tm_nfs.conf" ]

># vim ~/.bashrc
export ONE_LOCATION=/srv/cloud/one
export ONE_AUTH=/srv/cloud/one/.one/one_auth

># vim /srv/cloud/one/.one/one_auth
oneadmin:oneadmin

># vim etc/vmm_ssh/vmm_ssh_xen.conf
* To take this effect, you need to restart the opennebula daemon
#DISK   = [ driver = "tap:aio:" ]
DISK   = [ driver = "file:" ]

># one stop; one start

2. Add Physical Machines
># onehost create infi5 im_xen vmm_xen tm_nfs
># onehost create infi6 im_xen vmm_xen tm_nfs
># onehost create infi7 im_xen vmm_xen tm_nfs

Contextualizing VM images
># mount /home/xen/domains/green2/root.img /mnt/iso -o loop
># vim /mnt/iso/etc/rc.local
 mount -t iso9660 /dev/sdc /mnt
 
if [ -f /mnt/context.sh ]; then
  . /mnt/init.sh
fi
 
umount /mnt
 
exit 0

># mkdir /srv/cloud/one/vm_config
># vim init.sh
 #!/bin/bash

echo "Executing init.sh..."

if [ -f /mnt/context.sh ]; then
    . /mnt/context.sh
fi

cp -f /mnt/hosts /etc

echo "Reconfiguring network settings..."
hostname $HOSTNAME

echo "Setting local ipaddress: $LOCAL_IPADDR"
LOCAL_IPADDR=`grep $HOSTNAME.snu.ac.kr /etc/hosts | awk '{print $1}'`
ifconfig eth0 $LOCAL_IPADDR netmask 255.255.255.0 broadcast 192.168.1.255 up
#ifconfig eth0 $IP_PUBLIC

route add default gw 192.168.1.1


5.  Create VM Image
># vim green.image.template
* You can just use any xen image that you create. I just used one image that I created it using xen-create-image cmd.
 NAME          = "Green VM"
PATH          = /home/xen/domains/green2/root.img
PUBLIC        = YES
DESCRIPTION   = "Green VM Image"

># oneimage register green.image.template

4. Create Virtual Network
># vim green.network.template
 NAME = "Public"
TYPE = FIXED

#We have to bind this network to ''virbr1'' for Internet Access
#BRIDGE = vbr1
#BRIDGE = virbr0
BRIDGE = eth0

LEASES = [IP=192.168.1.164, MAC=00:16:3E:9A:99:8A]
LEASES = [IP=192.168.1.165, MAC=00:16:3E:9A:99:8B]
LEASES = [IP=192.168.1.166]
LEASES = [IP=192.168.1.167]
LEASES = [IP=192.168.1.168]

># onevnet create green.network.template



3. Create Virtual Machine Instances
># vim green.vm.template
 NAME = "green1"
CPU    = 1
MEMORY = 512

# --- kernel & boot device ---

OS = [
    kernel = "/boot/vmlinuz-2.6.26-2-xen-amd64",
    initrd = "/boot/initrd.img-2.6.26-2-xen-amd64",
    root = "xvda2",
    boot = "xvda"
    ]

DISK = [
    image = "Green VM",
    target = "xvda2",
    readonly = "no"
    ]

DISK = [ type   = swap,
        size   = 512]

NIC    = [ NETWORK = "Public" ]
#NIC    = [ NETWORK = "Private network" ]

# FEATURES=[ acpi="no" ]

#GRAPHICS = [
    #type    = "vnc",              
    #listen  = "1.2.3.4",
    #port    = "5902"  ]

CONTEXT = [
    hostname = "$NAME",
    ip_public = "$NIC[IP, NETWORK=\"Public\"]",
    files  = "/srv/cloud/one/vm_config/init.sh",
    target = "sdc"
    ]


># onevm create green.vm.template


References
4. 
저작자 표시
신고

Frank kenshin579 linux/virtualization opennebula, Ubuntu 9.04

  1. Le ministre de l'Intérieur Brice Hortefeux, http://www.moncleroutletespain.com/ moncler online, condamné en juin 2010 pour avoir tenu des propos jugés "outrageants" envers les personnes d'origine arabe, http://www.moncleroutletespain.com/ moncler chaquetas, sera rejugé le 9 juin, http://www.moncleroutletespain.com/ http://www.moncleroutletespain.com/, a décidé mercredi la cour d'appel de Paris, http://www.moncleroutletespain.com/ moncler españa.Related articles:


    http://slds2.tistory.com/1093 http://slds2.tistory.com/1093

    http://iustudio.tistory.com/494 http://iustudio.tistory.com/494

How to perform live xen migration

2011.03.08 21:35
xen hypervisor provides live migration. the capabilities to migrate guest VM to different physical machine lively. 
It is important that VM image is stored in the central storage in order to perform live migration. 

Physical machines: cloud, infi8
Virtual machines: green1, green2

1. using xm 
A. Offline mode
* In this mode, the VM will be stopped on the original host and restarted on the destination host. 
># xm migrate green1

B. Live mode
* In this mode, the VM will be migrated to the destination host without stopping the VM. 
># xm migrate --live green1

Configuration
># vim /etc/xend-config.sxp
(xend-relocation-server yes)
(xend-relocation-port 8002)
(xend-relocation-address '')
(xend-relocation-hosts-allow '')

># make sure the dedicated port is opened for the migration.
># lsof -i :8002

># /etc/init.d/xend restart

Live migration test (let's measure the migration time)
># xm create green2
># time xm migrate --live green2 infi8

VM Image size: 6GB
RAM size: 512MB, 1024MB, 2048MB, 4096MB, 8192MB




2. using libvirtd 
2. 
저작자 표시
신고

Frank kenshin579 linux/virtualization libvirtd, live migration, offline migration, Xen, XM

  1. And now, http://www.discounttomssshoes.com/ toms - womens black metallic herringbone classic shoes, you can book the whole travel experience online in a little minute of your time.The groups have excellent values and special rates in many popular travel destinations around the world.Holy land Tours, Adventure tours for team building, Vegas entertainment packages and many more are available if you want a special theme, http://www.discounttomssshoes.com/ cheaphighlandbotas. They are just few clicks away from you, http://www.discounttomssshoes.com/ people wearing toms botas.You can do price comparisons in the net which is the best part here. Also, you can see all of the accomodations right from your computer.With the use of internet, you can also find a free concierge services that can do all of the clicking and booking for you and send you the itinerary, http://www.discounttomssshoes.com/ denim toms. Just tell them where you want to go, what do you want to do, http://www.discounttomssshoes.com/ toms calculus 101 shoes, and swha la!you're on your way, http://www.discounttomssshoes.com/ cheap toms shoes women. An old fashion style but with high-tech sense.Why missing out the opportunity of this amazing group travel trip? Remember, this will create all the memories you will be cherishing the rest of youor life.
    Related articles:


    http://devmsn.com/forum.php?mod=viewthread&tid=6696087 http://devmsn.com/forum.php?mod=viewthread&tid=6696087

    http://www.celticmysticaljourneys.com/register-sacred-sites-france-essene-initiations-2013#comment-56795 http://www.celticmysticaljourneys.com/register-sacred-sites-france-essene-initiations-2013#comment-56795

    http://yigrowww.tkcs.com.tw/discuz/viewthread.php?tid=2375397&extra= http://yigrowww.tkcs.com.tw/discuz/viewthread.php?tid=2375397&extra=

Installing Xen on Ubuntu 9.04 w/ binary package.

2011.02.23 11:08

OS: Ubuntu 9.04 server (64-bit)

Installing Xen on Ubuntu 9.04
># apt-get install ubuntu-xen-server

1. Get the xen binary packages from the following web sites:
* It seems that the package is no longer exists in the ftp server (2011/02/23)
># sudo dpkg -i linux-modules-2.6.26-2-xen-amd64_2.6.26-21_amd64.deb 
># sudo dpkg -i linux-image-2.6.26-2-xen-amd64_2.6.26-21_amd64.deb

After the xen kernel package installation, it should update the grub boot loader automatically, but
just in case, here is an example. 

># vi /boot/grub/menu.lst
title   Xen 3.3 / Ubuntu 9.04, kernel 2.6.26-2-xen-amd64
root    (hd0,0)
kernel    /boot/xen-3.3.gz
module    /boot/vmlinuz-2.6.26-2-xen-amd64 root=UUID=6259683d-02ee-4b29-a3ce-a74c90384c6e ro console=tty0
module    /boot/initrd.img-2.6.26-2-xen-amd64
quiet

># reboot

Installing a virtual machine (domU)
* using xen-create-image to create a VM, 
># vim /etc/xen-tools/xen-tools.conf
size   = 4Gb      # Disk image size.
memory = 512Mb    # Memory size
swap   = 512Mb      # Swap size
fs     = ext3            # use the EXT3 filesystem for the disk image.
dist   = jaunty         # Default distribution to install.
image  = sparse     # Specify sparse vs. full disk images.

gateway   = 192.168.1.1
netmask   = 255.255.255.0
broadcast = 192.168.1.255

Bug fix (making sure that the console is showed up when executing xm console)
* Ensuring a getty on /dev/hvc0
># cd /usr/lib/xen-tools/
># ln -s edgy.d jaunty.d
># vim jaunty.d/30-disable-gettys
 #
#  Remove the links for upstart
#
rm ${prefix}/etc/event.d/tty[!1]
cat ${prefix}/etc/event.d/hvc0 | sed "s/tty1/hvc0/" > ${prefix}/etc/event.d/hvc0

># vim /etc/xen-tools/partitions.d/green
[root]
size=2G
type=ext3
mountpoint=/
options=sync,errors=remount-ro

[swap]
size=512M
type=swap

># sudo xen-create-image --hostname=green4 --ip=192.168.1.167 --dist=jaunty \
 --mirror=http://kr.archive.ubuntu.com/ubuntu --arch=amd64 --partitions=green \
 --force --boot --passwd --role udev

># xm console green4

References.
1. 
저작자 표시
신고

Frank kenshin579 linux/virtualization Binary, Ubuntu 9.04, Xen

Installing Xen4.0 & Xenoprofile on Centos 5 - Not tried (2011/01/11)

2011.01.11 16:50
Please refer to the following references for more information. I haven't tried this yet. 

References
1. How to setup Xen4 and pvops 2.6.32.x on CentOS 5.5, http://ppadala.net/blog/tag/centos/
2. Using Xenoprofile with CentOS 5, http://comp.uark.edu/~ewe/CentOS5_oprofile.html
3. 
저작자 표시
신고

Frank kenshin579 linux/virtualization Xen 4.0, xenoprofile

Installing Xen 3.2 and Xenoprofile on Debian 5.0.7 - Not quite (2011/01/12)

2011.01.11 15:02
Install Xen 
># apt-get install xen-hypervisor-3.2-1-amd64 xen-linux-system-2.6.26-2-xen-amd64 linux-image-2.6.26-2-xen-amd64 linux-modules-2.6.26-2-xen-amd64 linux-headers-2.6.26-2-xen-amd64 linux-headers-2.6.26-2-common-xen xen-tools

Since we are going to use image-based VM, let's increase the limit on loop device. 
># vim /etc/modules
loop max_loop=64

Next, we need to config the xen
># vim /etc/xen/xend-config.sxp
...
(network-script network-bridge)
#(network-script network-dummy)
(vif-script vif-bridge)
...

># reboot
># ifconfig

Installing VM
Need to edit xen-tools.conf
># vim /etc/xen-tools/xen-tools.conf
...
dir = /home/xen
dist = lenny
gateway = 1921.68.1.1
netmask = 255.255.255.0
broadcast = 192.168.1.255
serial_device = hvc0
disk_device = xvda
...
># mkdir /home/xen

># vim /etc/xen-tools/partitions.d/green
[root]
size=2G
type=ext3
mountpoint=/
options=sync,errors=remount-ro

[swap]
size=512M
type=swap

># sudo xen-create-image --hostname=green1 --ip=192.168.1.164  --size=2Gb  --memory=512Mb  --arch=amd64 --partitions=green  --force --boot --passwd --role udev

Installing Xenoprofile from source code. 

After the xenoprofile installation
># opcontrol --init

Make sure that active_domains and passive_domains are listed. 
># find /dev/oprofile

Now it's time to test Xenoprofile
* We need to have xen-syms and vmlinux so let's just build a xen package from scratch.
Building debian packages from source
1. linux-image-*-xen to get the vmlinuz file
># apt-get build-dep linux-image-2.6.26-2-xen-amd64
># apt-get source linux-image-2.6.26-2-xen-amd64

We need to add more PROFILE options to .config
* I thought by doing this would enable hardware performance counter, but I just realized that I need to patch kernel to support hardware performance counters. This left as future work. No time at the moment!!
So currently the system only supports timer interrupt. 

># vim arch/x86/Kconfig
...
### Arch settings
config X86
    def_bool y
    select HAVE_UNSTABLE_SCHED_CLOCK
    select HAVE_IDE
    select HAVE_OPROFILE
    select PANEL_PROFILE
    select HAVE_KPROBES
...

#modified
config OPROFILE_IBS
    def_bool y

config BRANCH_PROFILE_NONE
    def_bool y

config EVENT_PROFILE
    def_bool y

># dpkg-buildpackage -uc -B

># cp ~/src/linux-2.6-2.6.26/debian/build/build_amd64_xen_amd64/vmlinux /boot/vmlinux-`uname -r`

2. trying to get the xen-syms file
># apt-get build-dep xen-hypervisor-3.2-1-amd64
># apt-get source -b xen-hypervisor-3.2-1-amd64
># cp ~/src/xen-3-3.2.1/debian/build/build-hypervisor_amd64_amd64/xen/xen-syms /boot/xen-syms-`uname -r`

Profiling from dom0 just for testing
* oprofile-0.9.5 with xen patch does not work on this system. Just use the binary format. 
dom0># apt-get install oprofile
dom0># opcontrol --init
dom0># opcontrol --start --vmlinux=/boot/vmlinux-2.6.26-2-xen-amd64
dom0># stress -t 10 -c 1
dom0># opcontrol --dump
dom0># opcontrol --shutdown
dom0># opreport -lt1


Active Profiling
Copy two images to DomUs
># scp /boot/xen-syms-2.6.26-2-xen-amd64 green1:/boot
># scp /boot/xen-syms-2.6.26-2-xen-amd64 green2:/boot

># scp /boot/vmlinux-2.6.26-2-xen-amd64 green1:/boot
># scp /boot/vmlinux-2.6.26-2-xen-amd64 green2:/boot

Initialize
dom0># opcontrol --reset
dom2># opcontrol --reset
dom3># opcontrol --reset

Start OProfile in all domU
dom0># opcontrol --start-daemon --event=CPU_CLK_UNHALTED:6000 --xen=/boot/xen-syms-2.6.26-2-xen-amd64 --vmlinux=/boot/vmlinux-2.6.26-2-xen-amd64  --active-domains=1,2
dom2># opcontrol --start --xen=/boot/xen-syms-2.6.26-2-xen-amd64 --vmlinux=/boot/vmlinux-2.6.26-2-xen-amd64
dom3># opcontrol --start --event=CPU_CLK_UNHALTED:6000 --xen=/xen-syms-2.6.26-2-xen-amd64 --vmlinux=/boot/
vmlinux-2.6.26-2-xen-amd64
Start profiling 
dom0># opcontrol --start

Run experiments to be profiled
dom2># ./loop

Stop profiling
dom0># opcontrol --stop

Shutdown OProfile daemon
dom0># opcontrol --shutdown
dom2># opcontrol --shutdown
dom3># opcontrol --shutdown

dom0># opreport -lt1
error: no sample files found: profile specification too strict 
I am not sure why this is the case. 



Passive Profiling
It seems like opcontrol doesn not have --passive-domains options. I have oprofile 0.9.6 version. 

dom0># opcontrol --reset
dom0># opcontrol --start-daemon --event=CPU_CLK_UNHALTED:6000 --xen=/boot/xen-syms-4.0.1-rc3 --vmlinux=/boot/vmlinux-2.6.31.12-xen  --passive-domains=2,3 --passive-images=/boot/vmlinux-2.6.31.12-xen,/boot/vmlinux-2.6.31.12-xen

dom0># opcontrol --start

Run experiments to be profiled

dom0># opcontrol --stop
dom0># opcontrol --shutdown
dom0># opreport -lt1


References
2. Virtulization with Xen on Debian Lenny (5.0, AMD64), http://www.howtoforge.com/virtualization-with-xen-on-debian-lenny-amd64
3. Virtulization with Xen 3.3.1 on Debian Etch (4.0), http://www.howtoforge.com/virtualization-with-xen-3.3.1-on-debian-etch
4. Apt, dpkg Quick Reference Sheet, http://www.cyberciti.biz/ref/apt-dpkg-ref.html
8. 
저작자 표시
신고

Frank kenshin579 linux/virtualization debian 5, xen 3.2, xenoprofile

XenOprofile, OProfile on Ubuntu 10.04 - Unsuccessful (2011/01/11)

2011.01.10 17:05

OProfile - a system-wide and process profiler
Profiling runs in the background and data are collected at any time. It makes use of the hardware performance counters.

opcontrol : starting and stopping the OProfile daemon and providing setup parameters. 
opreport : gives image and symbol-based profile summaries for the whole system  or a process

Installation
># sudo apt-get install oprofile

Check for profile support in the kernel
># cat /boot/config-`uname -r` | grep PROFILE

The following command tells OProfile that we don't have an uncompressed kernel and it assign all kernel samples to a black-box called "no-vmlinux". With the uncompressesd kernel, it's possible to get a breakdown of what is happening inside of your kernel in more detail. 
># opcontrol --no-vmlinux
--no-vmlinux : indicates that we are not interested in recording samples for the kernel.

Basic Usage
To clean previous samples
># opcontrol --reset

To configure and start OProfile
># opcontrol --setup --no-vmlinux --event=CPU_CLK_UNHALTED:6000
Measuring CPU_CLK_UNHALTED events with a sample recorded for every 6000 events.

># opcontrol --start

Run my benchmark
># ./cpu -a 15 -n 1

># opcontrol --shutdown
># opreport -lt1
-t1: sets a threshold at 1% so that we don't see every symbol.
-l: shows you side each process
What is the meaning of the samples here in the output??

List all probable events
># opcontrol --list-events

It's possible to sample more events at a time. I think...
># opcontrol --setup --no-vmlinux --event=CPU_CLK_UNHALTED:6000 --event=LLC_MISSES:6000

Using OProfile, can we distinguish whether the application is CPU, memory, disk, network-intensive?
What kinds of metrics should I use?

XenOProfile
We are require to build Xenoprof from source code with Xen patch. 
First we need to get the source. 
># tar -xzvf oprofile-0.9.5.tar.gz; cd oprofile-0.9.5
># patch -p1 < oprofile-0.9.5-xen.patch
># ./configure --with-kernel-support
configure: error: liberty library not found
># apt-get install binutils-dev
># ./configure --with-kernel-support
># make
># make install

In case you are getting the following error, change the sh shell to bash. 
># opcontrol --help
/usr/local/bin/opcontrol: 567: Syntax error: Bad for loop variable
># vim /usr/local/bin/opcontrol
#!/bin/bash
#
# opcontrol is a script to control OProfile
# opcontrol --help and opcontrol --list-events have info
#
# Copyright 2002
# Read the file COPYING

It should work now. 
># opcontrol --help


Active vs. Passive Profiling
Xennoprofile supports both active and passive mode for domain profiling. In the passive mode, the results indicate which domain is running at sample time, but don't get much deeper information. It's useful to get a quick look at which domains are used in the system. 

In active mode, each domain U needs to have its own instance of OProfile running, but it provides much better granularity than passive mode. Only paravirtualized domains can run in active mode. 

For Xen build, I just followed the instruction at this site. 

Active Profiling
Dom0 controls the profiler. DomU green1 and green2 are active domains. 
># cp /usr/src/build/400/xen-4.0.1rc3/debian/build/result/boot/xen-syms-4.0.1-rc3  /boot/
># cp /usr/src/linux-source-2.6.31.12-xen/vmlinux /boot/vmlinux-2.6.31.12-xen

Copy two images to DomUs
># scp /boot/xen-syms-4.0.1-rc3 green1:/boot
># scp /boot/xen-syms-4.0.1-rc3 green2:/boot

># scp /boot/vmlinux-2.6.31.12-xen green1:/boot
># scp /boot/vmlinux-2.6.31.12-xen green2:/boot

># scp -rp /lib/modules/`uname -r` green1:/lib/modules
># scp -rp /lib/modules/`uname -r` green2:/lib/modules

Initialize
dom0># opcontrol --reset
dom2># opcontrol --reset
dom3># opcontrol --reset

Start OProfile in all domU
dom0># opcontrol --start-daemon --event=CPU_CLK_UNHALTED:6000 --xen=/boot/xen-syms-4.0.1-rc3 --vmlinux=/boot/vmlinux-2.6.31.12-xen  --active-domains=2,3
dom2># opcontrol --start --xen=/boot/xen-syms-4.0.1-rc3 --vmlinux=/boot/vmlinux-2.6.31.12-xen 
dom3># opcontrol --start --event=CPU_CLK_UNHALTED:6000 --xen=/boot/xen-syms-4.0.1-rc3 --vmlinux=/boot/vmlinux-2.6.31.12-xen 

Start profiling 
dom0># opcontrol --start

Run experiments to be profiled
dom2># ./loop

Stop profiling
dom0># opcontrol --stop

Shutdown OProfile daemon
dom0># opcontrol --shutdown
dom2># opcontrol --shutdown
dom3># opcontrol --shutdown

dom0># opreport -lt1
error: no sample files found: profile specification too strict 
I am not sure why this is the case. 

Passive Profiling
It seems like opcontrol doesn not have --passive-domains options. I have oprofile 0.9.6 version. 

dom0># opcontrol --reset
dom0># opcontrol --start-daemon --event=CPU_CLK_UNHALTED:6000 --xen=/boot/xen-syms-4.0.1-rc3 --vmlinux=/boot/vmlinux-2.6.31.12-xen  --passive-domains=2,3 --passive-images=/boot/vmlinux-2.6.31.12-xen,/boot/vmlinux-2.6.31.12-xen
It seems like the file, /dev/oprofile/passive_domains, is not there. What is the problem?
Solution is not known at the moment. Does anybody know?

dom0># opcontrol --start

Run experiments to be profiled

dom0># opcontrol --stop
dom0># opcontrol --shutdown
dom0># opreport -lt1

References
1. OProfile: Profiling in Linux for Fun and Profit, http://lbrandy.com/blog/2008/11/oprofile-profiling-in-linux-for-fun-and-profit/
4. Xenoprof sourceforget.net, http://xenoprof.sourceforge.net
6. Xen 4.0을 우분투 10.04서버 위에 설치하기, http://blog.relip.org/category/%EA%B0%80%EC%83%81%ED%99%94/Xen
7. 
저작자 표시
신고

Frank kenshin579 linux/virtualization oprofile, Xen, xenprofile

  1. It’s a great tip on Do It yourself stuff. Thanks!

Workload Characterization for VM and process in Non-virtualized Environment

2011.01.07 17:10

We want to characterize or understand the behavior of a virtual machine (VM). Is it a CPU-intensive or I/O-intensive VM?
We are going to use the following tools such as xentop and pidstat. 

Let's see which metrics would be appropriate to use to identify the characteristics of VM. 

VIRTUALIZED ENVIRONMENT
<<VM Monitor Test Framework>>
Monitoring
1. XenTop
When do we have to monitor dom0 and domU ??
source is available under tools/xenstat/xentop/xentop.c
2. XenTop
># xentop -b -d 1 -i 2


NON-VIRTUALIZED ENVIRONMENT
<<PS Monitor Test Framework>>
Monitoring
1. top/ps/pidstat - CPU, Memory
* fork로 생성된 child processes에 대해서는 어떻게 되는가? 여기에도 포함이 되는지? 
># ps -p <pid> -o pid,pcpu,pmem,comm
 PID %CPU %MEM COMMAND
19328  100  0.0        loop

It seems like pidstat shows memory access as well (?) and since this command shows the stats based on the name of process so I think I should rather use this instead of top or ps command. 

># pidstat -C stress 1
01:56:17 PM       PID   %user %system    %CPU   CPU  Command
01:56:18 PM     20849    5.94   93.07   99.01     3  stress
01:56:18 PM     20850    3.96   97.03  100.99     0  stress

># pidstat -r -C stress 1
01:56:37 PM       PID  minflt/s  majflt/s     VSZ    RSS   %MEM  Command
01:56:38 PM     20849 223570.30      0.00  268388  75420   1.05  stress
01:56:38 PM     20850 223525.74      0.00  268388  75420   1.05  stress

2. pidstat/iotop - Disk
># apt-get install sysstat
># pidstat -d -p 19744
or 
># pidstat -C stress -d 1
01:43:37 PM       PID   kB_rd/s   kB_wr/s kB_ccwr/s  Command
01:43:38 PM     19744      0.00      0.00  43089.11  stress
01:43:39 PM     19744      0.00      0.00  48640.00  stress
01:43:40 PM     19744      0.00      0.00 139405.94  stress

3. nethogs - Network
># nethogs -t | grep 18644
Waiting for first packet to arrive (see sourceforge.net bug 1019381)
sshd: ykoh@pts/0/18644/1001 1928 216
sshd: ykoh@pts/0/18644/1001 3696 324
sshd: ykoh@pts/0/18644/1001 5624 540
sshd: ykoh@pts/0/18644/1001 7392 702


Benchmarking
<<VM Monitor Test Framework>>
Preparation
* do.sh script executes given commands on all VMs

1. SPECcpu
Build the spec benchmarks
># scripts/do.sh runspec --config=vm.cfg --action=build --tune=base all
># scripts/do.sh runspec --config=vm.cfg --size=test --tune=base --noreportable --iterations=1 all

1. Measuring CPU/Memory Performance with SPECcpu
># 

2. Measuring Disk Performance with iozone and bonnie++
3. Measuring Network Performance with netperf and httperf
4. Measuring with Application Benchmark - POV-Ray 
* This is part of SPECcpu so just skip this. 


References
2. XenMon QoS Monitoring and Performance Profiling Tool, HP Development Company, 2005
5. 

저작자 표시
신고

Frank kenshin579 linux/virtualization benchmarks, nethogs, pidstat, xen monitoring, xenmon, xentop

Installing Xen on Ubuntu 10.04

2011.01.06 18:32
I used to be able to install Xen on 9.04 with binary format seamlessly somewhat. But after upgrading to 10.04, I am not sure whether the installation would work seamless as it was on 9.04. 
There are many tutorials on installing Xen 4.0 on 10.04 by compiling source codes, but I just want to install xen with the binary to make it simpler. 

Let me try with installing older version on 10.04. Here we go....

Install Xen 3.0.3(?) from binary (tried - no luck)
># sudo apt-get install ubuntu-xen-server


Add jaunty distribution to sources.list
># vim /etc/apt/sources.list
deb http://kr.archive.ubuntu.com/ubuntu/ jaunty main restricted universe multiverse
deb-src http://kr.archive.ubuntu.com/ubuntu/ jaunty main restricted universe multiverse
># apt-get update

># apt-get install ubuntu-xen-server
It seems like there is a bug. 

I can't find solutions for this so I guess I just have to install xen from source. From here on, I am following #2 guideline. 

Installing Xen 4.0 from source
># mkdir xen4x; cd xen4x
># wget -q -O - \

1. To build xen-hypervisor 
># debian/bin/packageXen40x.sh

2. To install build binary files
For xen packages,
># sudo dpkg --purge --force-depends python-xml
># sudo dpkg -i /usr/src/build-lucid/python-xml/python-xml_0.8.4-10.1ubuntu2*.deb
># cd /usr/src/build-lucid
># sudo dpkg --purge --force-depends libxen4-dev libxen4 python-xen-4.0 xen-docs-4.0 xen-hypervisor-4.0 xen-utils-4.0
># sudo dpkg -i libxen4-dev_4.0.1-0ubuntu2_amd64.deb libxen4_4.0.1-0ubuntu2_amd64.deb python-xen-4.0_4.0.1-0ubuntu2_amd64.deb xen-docs-4.0_4.0.1-0ubuntu2_all.deb xen-hypervisor-4.0_4.0.1-0ubuntu2_amd64.deb xen-utils-4.0_4.0.1-0ubuntu2_amd64.deb


3. To build xen-kernel 
># head debian/bin/kpkgXenKernel.sh

#!/bin/bash -x
# ./kpkg2XenKernel.sh
# Use:
# ./kpkg2XenKernel.sh  stable-2.6.31.x 100402212843  #or# ./remakeXenKernel.sh stable-2.6.31.x f3d5fe8050
# ./kpkg2XenKernel.sh  stable-2.6.32.x 100430201127  #or# ./remakeXenKernel.sh stable-2.6.32.x 4dd582f35f
# ./kpkg2XenKernel.sh  stable-2.6.32.x 100517202304  #or# ./remakeXenKernel.sh stable-2.6.32.x ba739f9abd
# ./kpkg2XenKernel.sh  stable-2.6.33.x               # picks up the last commit
# TWEAKCONFIG=yes ./kpkg2XenKernel.sh  stable-2.6.32.x  # Configuration before the build of the last commit

Select the appropriate kernel
># debian/bin/kpkgXenKernel.sh stable-2.6.32.x

Install and config grub config. 
># dpkg -i linux-image-2.6.32.27-xen_101210011616_amd64.deb linux-headers-2.6.32.27-xen_101210011616_amd64.deb
># ls /lib/modules
># mkinitramfs -o /boot/initrd.img-2.6.32.27-xen 2.6.32.27-xen

Edit grub configuration 
* Make sure to add the following line.
># vim /boot/grub/menu.lst
...
module      /boot/initrd.img-2.6.32.27-xen
...

># reboot

 ** 2.6.32.27 DOES NOT WORK T.T **

Let me try with 2.6.31.x
># debian/bin/kpkgXenKernel.sh  stable-2.6.31.x 100402212843

Install and config grub config. 
># dpkg -i linux-headers-2.6.31.12-xen_100402212843_amd64.deb linux-image-2.6.31.12-xen_100402212843_amd64.deb
># ls /lib/modules
># mkinitramfs -o /boot/initrd.img-2.6.31.12-xen 2.6.31.12-xen

Edit grub configuration 
* Make sure that the following line is included. 
># vim /boot/grub/menu.lst
...
module      /boot/initrd.img-2.6.31.12-xen
...

># reboot

** 2.6.31.12 WORKS **

Let's try installing a VM, then...
># apt-get install xen-tools_4.2-1_all.deb

># vim /etc/xen-tools/partitions.d/green
[root]
size=2G
type=ext3
mountpoint=/
options=sync,errors=remount-ro

[swap]
size=512M
type=swap

># sudo xen-create-image --hostname=green1 --ip=192.168.1.164  --gateway=192.168.1.1 --netmask=255.255.255.0  --broadcast=192.168.1.255 --dist=lucid  --mirror=http://kr.archive.ubuntu.com/ubuntu --size=2Gb  --memory=512Mb  --arch=amd64 --partitions=green  --force --boot --passwd --role udev --dir /home/xen




Installing a VM with virt-manager
* At the moment, I am not sure how to fix this. 






References
저작자 표시
신고

Frank kenshin579 linux/virtualization ubutnu 10.04, Xen 4.0