Custom Search
Showing posts with label Xen. Show all posts
Showing posts with label Xen. Show all posts

Wednesday, June 19, 2013

How to Import XEN Virtual Machine to Amazon EC2

How to Import XEN Virtual Machine to Amazon EC2

1)
Install ec2-api-tools_1.6
#wget http://launchpadlibrarian.net/111617788/ec2-api-tools_1.6.1.1-0ubuntu1_all.deb
#sudo dpkg -i ec2-api-tools_1.6.1.1-0ubuntu1_all.deb

2)
Check the Version of ec2-api-tools
#ec2-version
3)
Export Aws Access and Secret keys
#export AWS_ACCESS_KEY=XXXXXXXXXXXXXXXXXXXXX
#export AWS_SECRET_KEY=XXXXXXXXXXXXXXXXXXXXX

4)
Create EC2 Instance using RAW Disk
#ec2-import-instance win2k-r2-disk1.xm -f RAW -t m1.small -a x86_64 -b import-export -o $AWS_ACCESS_KEY -w $AWS_SECRET_KEY --region us-west-1

5)
Check the Progress of the task
#ec2-describe-conversion-tasks import-i-ffm2nty0 -O $AWS_ACCESS_KEY -W $AWS_SECRET_KEY --region us-west-1

6)
Resume task
#ec2-resume-import win2k-r2-disk1.xm -t import-i-ffm2nty0 -o $AWS_ACCESS_KEY -w $AWS_SECRET_KEY --region us-west-1

7)
Remove the image from S3, when the task completed
#ec2-delete-disk-image -t import-i-ffm2nty0 -o $AWS_ACCESS_KEY -w $AWS_SECRET_KEY --region us-west-1

Wednesday, March 20, 2013

How To Setup Xen Hypervisor on Ubuntu Virtual Machine

How To Setup Xen Hypervisor on Ubuntu Virtual Machine


How to Configure Network on Xen hypervisor running on Ubuntu Virtual Machine


How To Create PV Guest VM on Xen Hypervisor running on Ubuntu Virtual Machine


Sunday, March 10, 2013

How To Create a PV Guest VM on Ubuntu Virtual Machine with Xen hypervisor

How To Create a PV Guest VM on Ubuntu Virtual Machine with Xen hypervisor

Manually creating a PV Guest VM
=======================


In this section we will focus on Paravirtualized (or PV) guests.
PV guests are guests that are made Xen-aware and therefore can be optimized for Xen.

As a simple example we'll create a PV guest in LVM logical volume (LV) by doing a network installation of Ubuntu (other distros such as Debian, Fedora, and CentOS can be installed in a similar way).



1)
Install LVM

#sudo apt-get update
#sudo apt-get install lvm2


2)
Create Volume Group and Logical Volume.

#sudo mkdir /mnt/vmdisk
#sudo dd if=/dev/zero of=/mnt/vmdisk/mydisk1 bs=100M count=10
#sudo losetup /dev/loop1 /mnt/vmdisk/mydisk1
#sudo pvcreate /dev/loop1
#sudo vgcreate -s 512M myvolume-group1 /dev/loop1
#sudo lvcreate -L 512M -n mylogical_volume1 myvolume-group1
#ls /dev


3)
Get netboot images

#sudo mkdir -p /var/lib/xen/images/ubuntu-netboot
#cd /var/lib/xen/images/ubuntu-netboot
#sudo wget http://mirror.anl.gov/pub/ubuntu/dists/precise/main/installer-amd64/current/images/netboot/xen/initrd.gz
#sudo wget http://mirror.anl.gov/pub/ubuntu/dists/precise/main/installer-amd64/current/images/netboot/xen/vmlinuz


4)
Set up the initial guest configuration

#vim /etc/xen/ubuntu.cfg
name = "ubuntu"
memory = 256
disk = ['phy:/dev/myvolume-group1/mylogical_volume1,xvda,w']
vif = [' ']
kernel = "/var/lib/xen/images/ubuntu-netboot/vmlinuz"
ramdisk = "/var/lib/xen/images/ubuntu-netboot/initrd.gz"
extra = "debian-installer/exit/always_halt=true -- console=hvc0"


5)
Start the VM and connect to console (-c).

#sudo xm create -c /etc/xen/ubuntu.cfg

6)
List VMs

#sudo xm list

How to Configure Network on Ubuntu Virtual Machine with Xen hypervisor

How to Configure Network on Ubuntu Virtual Machine with Xen hypervisor

Network Configuration
================


This section describes how to set up linux bridging in Xen.
It assumes eth1 is both your primary interface to dom0 and the interface you want your VMs to use.
It also assumes you're using DHCP.

1)
Install Bridge utils

#sudo apt-get install bridge-utils

2)
Stop Network Manager

#sudo /etc/init.d/network-manager stop


3)
Edit Interface

#vim /etc/network/interfaces
auto lo
iface lo inet loopback

auto xenbr0
iface xenbr0 inet dhcp
bridge_ports eth1

auto eth1
iface eth1 inet dhcp


4)
Restart networking to enable xenbr0 bridge.

#sudo /etc/init.d/networking restart

How To Setup Ubuntu Virtual Machine with Xen Hypervisor

How To Setup Ubuntu Virtual Machine with Xen Hypervisor

* First setup Ubuntu 12.04 VM

Installing Xen
==========

1)
Install a 64-bit hypervisor

#sudo apt-get install xen-hypervisor-amd64

2)
Modify GRUB to default to booting Xen.

#sudo sed -i 's/GRUB_DEFAULT=.*\+/GRUB_DEFAULT="Xen 4.1-amd64"/' /etc/default/grub
#sudo update-grub



 
3)
Set the default toolstack to xm (aka xend).

#sudo sed -i 's/TOOLSTACK=.*\+/TOOLSTACK="xm"/' /etc/default/xen

4)
Reboot

#sudo reboot

5)
Verify that the installation has succeeded.

#sudo xm list

6)
Network Configuration
http://fosshelp.blogspot.com/2013/03/how-to-configure-network-on-ubuntu.html 

7)
Create a PV Guest VM 
http://fosshelp.blogspot.com/2013/03/how-to-create-pv-guest-vm-on-ubuntu.html 

 

Wednesday, May 9, 2012

how to install xen on CentOS 6

Installation of Xen on Centos 6 working


1)
# yum install bridge-utils

2)
# yum install http://au1.mirror.crc.id.au/repo/kernel-xen-release-6-3.noarch.rpm

3)
# yum install kernel-xen xen

4)
# vim vim /etc/grub.conf

4a) Before Edit

default=0
timeout=5
splashimage=(hd0,4)/boot/grub/splash.xpm.gz
hiddenmenu
title CentOS (2.6.32.57-1.el6xen.x86_64)
        root (hd0,4)
        kernel /boot/vmlinuz-2.6.32.57-1.el6xen.x86_64 ro root=UUID=12a3774f-45a5-4b9c-b08b-dad9b0654c2e rd_NO_LUKS rd_NO_LVM LANG=en_US.UTF-8 rd_NO_MD quiet SYSFONT=latarcyrheb-sun16 rhgb crashkernel=auto  KEYBOARDTYPE=pc KEYTABLE=us rd_NO_DM
        initrd /boot/initramfs-2.6.32.57-1.el6xen.x86_64.img
title CentOS (2.6.32-220.el6.x86_64)
        root (hd0,4)
        kernel /boot/vmlinuz-2.6.32-220.el6.x86_64 ro root=UUID=12a3774f-45a5-4b9c-b08b-dad9b0654c2e rd_NO_LUKS rd_NO_LVM LANG=en_US.UTF-8 rd_NO_MD quiet SYSFONT=latarcyrheb-sun16 rhgb crashkernel=auto  KEYBOARDTYPE=pc KEYTABLE=us rd_NO_DM
        initrd /boot/initramfs-2.6.32-220.el6.x86_64.img

4b) After Edit

default=0
timeout=5
splashimage=(hd0,4)/boot/grub/splash.xpm.gz
hiddenmenu
title CentOS (2.6.32.57-1.el6xen.x86_64)
        root (hd0,4)
        kernel /boot/xen.gz dom0_mem=1024M cpufreq=xen dom0_max_vcpus=1 dom0_vcpus_pin
        module /boot/vmlinuz-2.6.32.57-1.el6xen.x86_64 ro root=UUID=12a3774f-45a5-4b9c-b08b-dad9b0654c2e rd_NO_LUKS rd_NO_LVM LANG=en_US.UTF-8 rd_NO_MD quiet SYSFONT=latarcyrheb-sun16 rhgb crashkernel=auto  KEYBOARDTYPE=pc KEYTABLE=us rd_NO_DM
        module /boot/initramfs-2.6.32.57-1.el6xen.x86_64.img
title CentOS (2.6.32-220.el6.x86_64)
        root (hd0,4)
        kernel /boot/vmlinuz-2.6.32-220.el6.x86_64 ro root=UUID=12a3774f-45a5-4b9c-b08b-dad9b0654c2e rd_NO_LUKS rd_NO_LVM LANG=en_US.UTF-8 rd_NO_MD quiet SYSFONT=latarcyrheb-sun16 rhgb crashkernel=auto  KEYBOARDTYPE=pc KEYTABLE=us rd_NO_DM
        initrd /boot/initramfs-2.6.32-220.el6.x86_64.img

5)
vim /etc/sysconfig/selinux

# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
#     enforcing - SELinux security policy is enforced.
#     permissive - SELinux prints warnings instead of enforcing.
#     disabled - No SELinux policy is loaded.
#SELINUX=enforcing
SELINUX=disabled
# SELINUXTYPE= can take one of these two values:
#     targeted - Targeted processes are protected,
#     mls - Multi Level Security protection.
SELINUXTYPE=targeted


6)
Reboot into your new Xen kernel



7)
[root@localhost ~]# xm info

host                   : localhost.localdomain
release                : 2.6.32.57-1.el6xen.x86_64
version                : #1 SMP Tue Mar 20 10:23:34 EST 2012
machine                : x86_64
nr_cpus                : 2
nr_nodes               : 1
cores_per_socket       : 2
threads_per_core       : 1
cpu_mhz                : 2933
hw_caps                : bfebfbff:20100800:00000000:00000940:0008e3bd:00000000:00000001:00000000
virt_caps              :
total_memory           : 2009
free_memory            : 961
free_cpus              : 0
xen_major              : 4
xen_minor              : 1
xen_extra              : .2
xen_caps               : xen-3.0-x86_64 xen-3.0-x86_32p
xen_scheduler          : credit
xen_pagesize           : 4096
platform_params        : virt_start=0xffff800000000000
xen_changeset          : unavailable
xen_commandline        : dom0_mem=1024M cpufreq=xen dom0_max_vcpus=1 dom0_vcpus_pin
cc_compiler            : gcc version 4.4.6 20110731 (Red Hat 4.4.6-3) (GCC)
cc_compile_by          : mockbuild
cc_compile_domain      : crc.id.au
cc_compile_date        : Mon Feb 20 12:52:37 EST 2012
xend_config_format     : 4
[root@localhost ~]#


8)
[root@localhost ~]# ls /proc/xen/
capabilities  privcmd  xenbus  xsd_kva  xsd_port
[root@localhost ~]#

Wednesday, November 9, 2011

Eucalyptus Not enough resources (0 < 1: vm instances

Eucalyptus Not enough resources (0 < 1: vm instances

Step-1
======
root@saju:~# euca-describe-availability-zones verbose
AVAILABILITYZONE cluster 192.168.0.103
AVAILABILITYZONE |- vm types free / max cpu ram disk
AVAILABILITYZONE |- m1.small 0000 / 0000 1 192 2
AVAILABILITYZONE |- c1.medium 0000 / 0000 1 256 5
AVAILABILITYZONE |- m1.large 0000 / 0000 2 512 10
AVAILABILITYZONE |- m1.xlarge 0000 / 0000 2 1024 20
AVAILABILITYZONE |- c1.xlarge 0000 / 0000 4 2048 20
root@saju:~#


Step-2
======
root@saju:~#
root@saju:~# euca_conf --deregister-cluster cluster
SUCCESS: cluster 'cluster' successfully deregistered.
root@saju:~#


Step-3
======
root@saju:~#
root@saju:~#
root@saju:~# euca_conf --register-cluster cluster 192.168.0.103
Trying rsync to sync keys with "192.168.0.103"...The authenticity of host '192.168.0.103 (192.168.0.103)' can't be established.
ECDSA key fingerprint is dc:67:55:82:19:86:6e:26:54:49:57:ee:6e:98:77:b0.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '192.168.0.103' (ECDSA) to the list of known hosts.
done.
SUCCESS: new cluster 'cluster' on host '192.168.0.103' successfully registered.
root@saju:~#
root@saju:~#


Step-4
======
root@saju:~#
root@saju:~#
root@saju:~# euca_conf --no-rsync --discover-nodes
root@saju:~#
root@saju:~#


Step-5
======
root@saju:~#
root@saju:~#
root@saju:~# euca-describe-availability-zones verbose
AVAILABILITYZONE cluster 192.168.0.103
AVAILABILITYZONE |- vm types free / max cpu ram disk
AVAILABILITYZONE |- m1.small 0030 / 0030 1 192 2
AVAILABILITYZONE |- c1.medium 0024 / 0024 1 256 5
AVAILABILITYZONE |- m1.large 0012 / 0012 2 512 10
AVAILABILITYZONE |- m1.xlarge 0006 / 0006 2 1024 20
AVAILABILITYZONE |- c1.xlarge 0003 / 0003 4 2048 20
root@saju:~#
root@saju:~#
root@saju:~#

Step-5
======
Try Provision VM

Eucalyptus Not enough resources available: addresses (try --addressing private)

Eucalyptus Not enough resources available: addresses (try --addressing private)

1)Check Resources
------------------
root@saju:~# euca-describe-availability-zones verbose
AVAILABILITYZONE        cluster 192.168.0.111
AVAILABILITYZONE        |- vm types     free / max   cpu   ram  disk
AVAILABILITYZONE        |- m1.small     0030 / 0030   1    192     2
AVAILABILITYZONE        |- c1.medium    0024 / 0024   1    256     5
AVAILABILITYZONE        |- m1.large     0012 / 0012   2    512    10
AVAILABILITYZONE        |- m1.xlarge    0006 / 0006   2   1024    20
AVAILABILITYZONE        |- c1.xlarge    0003 / 0003   4   2048    20
root@saju:~#

2)Free up Resources
------------------
* Remove unwanted VMs and Disks



3)Restart Cloud controller
---------------------------
root@saju:~#
root@saju:~#
root@saju:~# service eucalyptus-cc restart
eucalyptus-cc start/running, process 27279
root@saju:~#
root@saju:~#


4)Check Resources again
------------------------
root@saju:~#
root@saju:~# euca-describe-availability-zones verbose
AVAILABILITYZONE        cluster 192.168.0.111
AVAILABILITYZONE        |- vm types     free / max   cpu   ram  disk
AVAILABILITYZONE        |- m1.small     0000 / 0000   1    192     2
AVAILABILITYZONE        |- c1.medium    0000 / 0000   1    256     5
AVAILABILITYZONE        |- m1.large     0000 / 0000   2    512    10
AVAILABILITYZONE        |- m1.xlarge    0000 / 0000   2   1024    20
AVAILABILITYZONE        |- c1.xlarge    0000 / 0000   4   2048    20
root@saju:~#
root@saju:~#
root@saju:~#

5)Check address
-----------------
root@saju:~# euca-describe-addresses
ADDRESS 192.168.0.21    available (admin)
ADDRESS 192.168.0.22    available (admin)
root@saju:~#
root@saju:~#

6)Release address
-----------------
root@saju:~# euca-release-address 192.168.0.21
ADDRESS 192.168.0.21
root@saju:~#
root@saju:~# euca-release-address 192.168.0.22
ADDRESS 192.168.0.22
root@saju:~#
root@saju:~#
root@saju:~#
root@saju:~# euca-describe-addresses
ADDRESS 192.168.0.21    nobody
ADDRESS 192.168.0.22    nobody
root@saju:~#
root@saju:~#


7)Try VM Provision
------------------------
End

Monday, September 5, 2011

how to find OpenStack Nova version

root@saju-M61PME-S2P:~# nova-manage shell python
Python 2.7.1+ (r271:86832, Apr 11 2011, 18:05:24)
[GCC 4.5.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
(InteractiveConsole)
>>>
>>> from nova import version
>>> version.version_string()
'2011.2'
>>> version.version_string_with_vcs()
u'2011.2-workspace:tarmac-20110415024701-a9bdb77vaatk99lh'
>>>