Showing posts with label Virtualization. Show all posts
Showing posts with label Virtualization. Show all posts

Aug 19, 2013

KVM: How to find a guest VM's process ID (PID)

There are two ways to find VCPUs' PID.

Suppose the testing VM is named GUEST_X and it has 4 VCPUs.

Method A: 
If you are using libvirt to manage VMs.
You can type:

sudo grep pid /var/run/libvirt/qemu/GUEST_X.xml 

Then, you will see VCPUs' PID like this:
<domstatus state='running' reason='booted' pid='6556' >
<vcpu pid='6558'/ >
<vcpu pid='6559'/ >
<vcpu pid='6560'/ >
<vcpu pid='6561'/ >

Method B:
Alternatively, you can find the guest's main PID in user space by typing this:
ps aux | grep GUEST_X 
You will see something like this:
root     6556 0.1  0.0 136560  3472 ?        Sl   20:49   0:02 /usr/bin/kvm ...GUEST_X....(a long list of parameters)
Then, you can use ls to check the directories in
/proc/6556/task/
You will see directories like this
/proc/6556/task/6556/
/proc/6556/task/6558/
/proc/6556/task/6559/
/proc/6556/task/6560/
/proc/6556/task/6561/
where 6558~6561 are PIDs of this guest's VCPUs.


Ending picture today:
Niagara Falls view [courtesy of my dear wife - Claire Huang]

Mar 24, 2013

Error: Boot loader didn’t return any data

I have a Ubuntu 12.04 guest VM. Host machine is running Ubuntu 12.04 with Xen 4.1.

After installing a new kernel in guest VM and reboot. I got
Error: Boot loader didn’t return any data
After googling this, I found this pygrub seems have problems in parsing certain grub2 format.
I could not find any patches to fix this. Instead, I found some people workaround this problem by using grub, not grub2. Therefore, I follow the procedure in this post to replace grub2 with grub.
http://ubuntuforums.org/showthread.php?t=1330347

Problem solved!

References:
http://0x23.de/2012/05/xen-ubuntu-12-04-upgrade-boot-loader-didnt-return-any-data/
http://marcin.juszkiewicz.com.pl/2011/09/08/error-boot-loader-didnt-return-any-data/


Mar 11, 2013

Ubuntu12.04 libvirt virbr0 network bridge setup

Offical Ubuntu website provides a very good and thorough guide for installing Xen in Ubuntu.

But, I personally prefer libvirt for managing network bridges, not changing network configuration as stated in the official website. So, I install libvirt:
sudo apt-get install libvirt0
Then type

Use virt-install to create a Xen guest VM

Host environment: Ubuntu12.04+Xen4

I personally prefer virt-manager. But, virt-manager is not always available. So, This post demonstrates how to install a ubuntu 12.04 LTS using virt-install without graphical user interface.
sudo virt-install --name testVM --ram 512 --vcpus=1 --disk ~/testVM.img,size=8 --location http://archive.ubuntu.net/ubuntu/dists/precise/main/installer-amd64/

Feb 23, 2013

virt-manager / virt-install: unable to connect to 'localhost:8000': Connection refused

This should be a bug on Ubuntu 12.10 + Xen 4 + virt-manager. This problem also exists on Ubuntu12.04 LTS + Xen 4 + virt-install

Solution/Workaround:

In "/etc/xen/xend-config.sxp",

get xen-syms from building source on ubuntu

Step 1. 
apt-get source xen-hypervisor-4.1-amd64

Step 2. 
cd xen-4.1.3

Feb 22, 2013

My experience on installing xenoprof

Both xenoprof and oprofile website provides clear installation guideline.
So, this post shares the problems I had in the installation and the solutions.

Oprofile version: 0.9.5 (remember to patch xenoprof before you go on)
Ubuntu 12.10 with Xen 4

Feb 21, 2013

How to move a VM between hosts? (Not migrate)

Many posts talk about migration.
But, how do we move a VM from one host to another?
This sounds like an easy task but it is not easy to find an how-to on Internet.
So, let's start an easy how-to.