Friday, January 28, 2011

To add LVM partition Permanently

Disk Looks something like this :


[root@oid ~]# df -k
Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/hda1              1252632    409940    778032  35% /
/dev/hda7               505604    480539         0 100% /home
/dev/hda3              1019240    153740    812888  16% /var
/dev/sde1              6190664    147668   5728528   3% /tmp
/dev/hda5              2030736     35880   1890036   2% /oem
/dev/hda2              3050092   1291860   1600796  45% /usr
tmpfs                  3932160         0   3932160   0% /dev/shm
/dev/mapper/xen--vm-xen_prov
                     464455440    202872 440659608   1% /xen

1) Take a backup of /etc/fstab
#cp /etc/fstab /etc/fstab.orig

2) edit /etc/fstab with below line 

<partition as show in df output>     <monted on>   <filesystem> 
/dev/mapper/xen--vm-xen_prov    /xen            ext3    defaults        0 2


Thursday, January 27, 2011

Oracle VM Server adding Space on Vm Guest

I have a 1Terrabyte space on /FAW, out of which I want to use 500G for Guest OS.


1) First create a disk2.img file with 500G space on the Oracle VM server (Host OS)
# dd if=/dev/zero of=/FAW/vms/linux_vm/disk2.img bs=1 count=1024 seek=500G


2) Adding the same to your vm.cfg config file :


'file:/FMW/xen_vm/disk2.img,sdf,w',

3) After you Login to VM guest , now fisk with partition name you defined in the File
# fdisk /dev/sdf
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel. Changes will remain in memory only,
until you decide to write them. After that, of course, the previous
content won't be recoverable.

Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4) 
p
Partition number (1-4): 1
First cylinder (1-65270, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-65270, default 65270):
Using default value 65270

Command (m for help): p

Disk /dev/sdf: 536.8 GB, 536870913024 bytes
255 heads, 63 sectors/track, 65270 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sdf1               1       65270   524281243+  83  Linux


Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.
[root@linux1/]#

4) Now adding the disk to Logical Volume manager in the same Guest OS.


# hostname
linux1

# pvcreate /dev/sdf1    <==== this is creadted using fdisk after logging in to vm guest
  Physical volume "/dev/sdf1" successfully created


# vgcreate xen-vm /dev/sdf1
  Volume group "xen-vm" successfully created


# lvcreate  -L450G -nxen_prov xen-vm
  Logical volume "xen_prov" created


# lvscan
  ACTIVE            '/dev/xen-vm/xen_prov' [450.00 GB] inherit


# mkfs.ext3 /dev/xen-vm/xen_prov
mke2fs 1.39 (29-May-2006)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
58982400 inodes, 117964800 blocks
5898240 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=4294967296
3600 block groups
32768 blocks per group, 32768 fragments per group
16384 inodes per group
Superblock backups stored on blocks:
        32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
        4096000, 7962624, 11239424, 20480000, 23887872, 71663616, 78675968,
        102400000

Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 21 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.
bash#



After reboot of guest os, mount is gone rest all remains intact .


so :


Have to remount to see the partition:



[root@linux1 /]# mount /dev/xen-vm/xen_prov /xen
[root@linux1 /]# cd /xen
[root@linux1 xen]# df -h .
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/xen--vm-xen_prov
                      443G  199M  421G   1% /xen
[root@linux1 xen]#



Creating Soft Partitioning in Linux

Order :
  1. Create an image file
  2. Create a loopback device for the file
  3. Run pvcreate on the loopback device
  4. Run vgcreate on the "physical" volume
  5. Run lvcreate on the volume group
  6. Create a filesystem on the logical volume
  7. Mount the logical volume



1) Create an image file
===============
#dd if=/dev/zero of=/FAW/vms/linux_vm/disk2.img bs=1 count=1024 seek=500G

2)Create a loopback device for the file
===========================
#losetup -f /FAW/vms/linux_vm/disk2.img


# losetup -a
/dev/loop0: [fd01]:49160 (/FAW/vms/linux_vm/disk2.img)

3) Run pvcreate on the loopback device
===============================
# pvcreate /dev/loop0 (initialise disk created)
Physical volume "/dev/loop0" successfully created

4)Run vgcreate on the "physical" volume
===============================
#vgcreate xen-vm /dev/loop0
Volume group "xen-vm" successfully created

5) Run lvcreate on the volume group
============================
#lvcreate -L450G -nxen_prov xen-vm

Logical volume "xen_prov" created

6)Create a filesystem on the logical volume
===================================
#mkfs.ext3 /dev/xen-vm/xen_prov
mke2fs 1.39 (29-May-2006)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
58982400 inodes, 117964800 blocks
5898240 blocks (5.00%) reserved for the super user
First data block=0
......................
.........................................


7) Mount the logical volume
========================

mount /dev/xen-vm/xen_prov /FMW/xen_vm


Tuesday, January 25, 2011

Creating a physical disk from a File and adding to LVM

Creating disk to be used with VM for Xen:


I have a /FMW which is 1 terrabyte I want to allocate 500GB for a Virtual Disk for xen.

Below is the process I follow to create a 500 GB disk.

$[root@adcdap11 linux_vm]# cd /FMW

$[root@adcdap11 FMW]# df -h .
Filesystem            Size  Used Avail Use% Mounted on
/dev/sdb1             1.1T   24G 1019G   3% /FMW
[root@adcdap11 FMW]#

$cd /FMW/vms/linux_vm


$[root@adcdap11 linux_vm]# df -h .

Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/DomUVol-Linux_vm
                       50G   21G   26G  45% /FMW/vms/linux_vm

Creating a 500 GB File:

Below file can be created anywhere irrespective of space counts, you should have the required space where you mount it.

$[root@adcdap11 linux_vm]# dd if=/dev/zero of=/FMW/vms/linux_vm/disk2.img bs=1 count=1024 seek=500G
1024+0 records in
1024+0 records out
1024 bytes (1.0 kB) copied, 0.002059 seconds, 497 kB/s

Creating File System Type:
$[root@adcdap11 linux_vm]# mke2fs disk2.img   (i think this is not needed since we will creating a filesystem after LVM creation).

mke2fs 1.39 (29-May-2006)
disk2.img is not a block special device.
Proceed anyway? (y,n) y
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
65536000 inodes, 131072000 blocks
6553600 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=0
4000 block groups
32768 blocks per group, 32768 fragments per group
16384 inodes per group
Superblock backups stored on blocks:
        32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
        4096000, 7962624, 11239424, 20480000, 23887872, 71663616, 78675968,
        102400000

Writing inode tables: done
Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 22 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.
[root@adcdap11 linux_vm]#

Create a dir for mounting under /FMW which is 1 terabyte.
$mkdir /FMW/xen_vm

Mounting the image to 1 Terrabyte Filesystem

$[root@adcdap11 linux_vm]# mount -o loop disk2.img /FMW/xen_vm/



Df output :


df -h will list below
[root@adcdap11 xen_vm]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/sda2             9.7G  5.7G  3.5G  63% /
/dev/sda1             190M   45M  136M  25% /boot
/dev/sdb1             1.1T   24G 1019G   3% /FMW
tmpfs                 257M     0  257M   0% /dev/shm

/dev/mapper/DomUVol-Linux_vm
                       50G   29G   18G  62% /FMW/vms/linux_vm
/FMW/vms/linux_vm/disk2.img
                      493G   70M  468G   1% /FMW/xen_vm

[root@adcdap11 xen_vm]#



/FMW/vms/linux_vm/disk2.img
                      493G   70M  468G   1% /FMW/xen_vm


Now to be recognised by LVM Partition should be /dev/...



[root@adcdap11 ~]# losetup -f /FMW/vms/linux_vm/disk2.img

[root@adcdap11 ~]# losetup -a
/dev/loop0: [fd01]:49160 (/FMW/vms/linux_vm/disk2.img)


[root@adcdap11 ~]# pvcreate /dev/loop0  (initialise disk created)
  Physical volume "/dev/loop0" successfully created

[root@adcdap11 ~]# vgcreate xen-vm /dev/loop0  (create a volume group for disk)
  Volume group "xen-vm" successfully created


[root@adcdap11 ~]# lvcreate -L450G -nxen_prov xen-vm  (creating a logical volume with 450 gig space).
  Logical volume "xen_prov" created

[root@adcdap11 ~]# lvscan  (see now if it shows up)
  ACTIVE            '/dev/DomUVol/lvol0' [200.00 GB] inherit
  ACTIVE            '/dev/DomUVol/Linux_vm' [50.00 GB] inherit
  ACTIVE            '/dev/xen-vm/xen_prov' [450.00 GB] inherit


Now creating ext3 filesystem :

[root@adcdap11 ~]# mkfs.ext3 /dev/xen-vm/xen_prov
mke2fs 1.39 (29-May-2006)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
58982400 inodes, 117964800 blocks
5898240 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=0
3600 block groups
32768 blocks per group, 32768 fragments per group
16384 inodes per group
Superblock backups stored on blocks:
        32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
        4096000, 7962624, 11239424, 20480000, 23887872, 71663616, 78675968,
        102400000

Writing inode tables:   75/3600

Friday, January 21, 2011

To login to xen Virtual Machnine

Here are the most important Xen commands:  
 
xm create -c /path/to/config - Start a virtual machine. 
 
xm shutdown <name> - Stop a virtual machine. 
 
xm destroy <name> - 
Stop a virtual machine immediately without shutting it down. 
It's as if you switch off the power button. 
 
xm list - List all running systems.
 
xm console <name> - Log in on a virtual machine. 
 
xm help - List of all commands.

VNC connection on Xen Hypervisor.

Enable VNC in Xen config file:
/etc/xen/xend-config.sxp

---------------------
(vnc-listen '0.0.0.0')
(vncpasswd 'secret')


Make sure you restart xend service afterwards:
/etc/init.d/xend restart 

Connect to the VM via VNC
vnc-viewer xxx.xxx.xxx.xxx:0 

Starting Oracle Vm issues.

I got the below error while trying to start xen virtual os.


[root@adcdap11 linux_vm]# xm create vm.cfg
Using config file "./vm.cfg".
Error: Device 2064 (vbd) could not be connected. /FMW/vms/linux_vm/firststart.img  does not exist.

After I removed the contents of /etc/exports :

[root@adcdap11 linux_vm]# cat /etc/exports
/FMW    *(ro,no_root_squash)


[root@adcdap11 linux_vm]# > /etc/export

and recreated the vm.cfg file i was good.


[root@adcdap11 linux_vm]# xm create vm.cfg
Using config file "./vm.cfg".
Started domain LeanX (id=22)
[root@adcdap11 linux_vm]#

[root@adcdap11 linux_vm]# xm list
Name                                        ID   Mem VCPUs      State   Time(s)
Domain-0                                     0   512    16     r-----  12285.0
LeanX                                       22  6144    16     -b----      6.4

contents of vm.cfg file:;

[root@adcdap11 linux_vm]# cat vm.cfg
acpi = 1
apic = 1
bootloader = '/usr/bin/pygrub'
disk = ['file:/FMW/vms/linux_vm/DomU-5EL-U5-x86_64-1.0.3.img,hda,w',
'file:/FMW/vms/linux_vm/firststart.img,sdb,w',
#'phy:/dev/mapper/DomUVol-idm_d2,sdc,w',
'file:/FMW/vms/linux_vm/swap,sdd,w',
'file:/FMW/vms/linux_vm/tmp,sde,w',
]
localtime = 0
memory = 6144
name = 'LeanX'
ne2000 = 0
on_crash = 'preserve'
on_poweroff = 'destroy'
on_reboot = 'restart'
on_shutdown = 'shutdown'
pae = 1
sdl = 0
serial = 'pty'
superpages = 1
timer_mode = 2
vcpus = 16
vif = ['ip=10.232.145.108']
vif_other_config = []
vnc = 1



Wiki Oracle VM

XM Commands

Article is taken from 

http://www.techotopia.com/index.php/Managing_Xen_using_the_xm_Command-line_Tool
List which virtual machines are running right now.
# xm list

Start the vm. By convention we will always have a file called vm.cfg
# xm create vm.cfg

Kill the power to vm: vm01, i.e. a hard shutdown
# xm destroy vm01

Monitors a host and its domains in real time# xm top
Send the vm: vm01 the shutdown command, like doing a shutdown inside the vm
# xm shutdown vm01
Current status of the guest operating system is written to disk and removed from system memory
# xm suspend vm01
restore vm01 (any time including after a host system reboot)
# xm resume vm01

Not Finished:
add a disk to a running vm: xm block-attach <Domain Id> <Backend Device> <Frontend Device> <Mode>. Domain Id is got from xm list command under the id column,
# xm block-attach 3 phy:/dev/sr0 /dev/xvda2 r

Split / Join files

Sometime the files are too big to put on FAT32 thumbdrives. Use the split and cat commands here:

Split the file system.img into 3Gig chunks
# split --bytes=3000m system.img

Join up the files system.img.part1, system.img.part2, etc... into the file system.img
# cat system.img.part* > system.img

Make an extra Linux file system for your VM

Make a blank file 2 gigs large named stellent.img that will serve as our new disk # dd if=/dev/zero of=stellent.img bs=1M count=2048

Edit the configuration file (/etc/xen/vm03), like below, adding the second line, notice xvda goes to xvdb
disk = [ 'file:/OVS/running_pool/vm03/system.img,xvda,w', 'file:/OVS/running_pool/vm03/stellent.img,xvdb,w']

The above line may also look like, the following, in that case use hdb in place ov xvdb.
disk = [ 'file:/OVS/running_pool/ucm1/system.img,hda,w','file:/OVS/running_pool/ucm1/stellent.img,hdb,w' ]

(NOTE) don't think you can use 'hdc' (only a and b), so you can use a combo of hd and xvd!

The following instructions came from the following link, use it as a reference if these instructions don't make sense
http://www.linuxhomenetworking.com/wiki/index.php/Quick_HOWTO_:_Ch27_:_Expanding_Disk_Capacity#Expanding_Partitions_With_LVM

Here we created a new device, /dev/xvdb. Now we start up the vm and run fdisk
# fdisk /dev/xvdb

You'll get some error messages saying you don't have a valid partition table. Create a new partition, 'n', primary = 'p', partition number = '1', default first and last cylinders.

List this partition table 'p' now and notice the Id type is 83 or something. Change this to 8e. 't', '8e'. List the partition table 'p', again, notice the new Id type is 8e. Save partition table 'w'.

Create a physical volume from this device
# pvcreate /dev/xvdb1

Create the logical volume group from the physical device
# vgcreate lvm-oracledb /dev/xvdb1

Create the logical volume using 100% of the free space in the logical group lvm-oracledb
# lvcreate -l 100%FREE lvm-oracledb -n lvm0

Format the file system
# mkfs -t ext3 /dev/lvm-oracledb/lvm0

Create a mount point
# mkdir /oracledb

Add the following to /etc/fstab to automatically mount the volume when the computer starts up
/dev/lvm-oracledb/lvm0 /oracledb ext3 defaults 1 2
Mount the volume
# mount -a

DONE!!!

Remove a Disk (LVM)

Remove /etc/fstab entry
[root@vl-ucm1 ~]# vi /etc/fstab

Unmount the device, get device name with: lvdisplay
# umount /dev/lvm-stellent/lvm0

OR

[root@vl-ucm1 /]# ls /u01
downloads lost+found oracle
[root@vl-ucm1 /]# umount /u01
[root@vl-ucm1 /]# ls /u01
[root@vl-ucm1 /]#


If you get:
[root@vl-ucm1 /]# umount /dev/lvm-stellent/lvm0
umount: /u01: device is busy


Find out what is using the device with:
[root@vl-ucm1 /]# fuser -m /dev/lvm-stellent/lvm0
/dev/lvm-stellent/lvm0: 3557m 3620m 3621m 3622m 3623m 3624m 3625m 3626m 3627m
[root@vl-ucm1 /]# ps auxw| grep 3557
root 3557 0.0 0.5 10856 3104 ? Ss 10:55 0:00 /usr/sbin/httpd

[root@vl-ucm1 /]# service httpd stop
Stopping httpd: [ OK ]
[root@vl-ucm1 /]# umount /dev/lvm-stellent/lvm0
[root@vl-ucm1 /]# df -h

And you should no longer see the disk with 'df'

Remove any entries from /etc/httpd/conf/httpd.conf that refer to this disk.

use lvremove to remove the logical volume
[root@vl-ucm1 /]# lvremove /dev/lvm-stellent/lvm0
Do you really want to remove active logical volume "lvm0"? [y/n]: y
Logical volume "lvm0" successfully removed


use lgdisplay and lgremove to remove logical group
[root@vl-ucm1 /]# vgremove lvm-stellent
Volume group "lvm-stellent" successfully removed


use pvdisplay and pvremove to remove physical volume
[root@vl-ucm1 /]# pvremove /dev/hdb1
Labels on physical volume "/dev/hdb1" successfully wiped


remove partition with fdisk /dev/hdb, 'd', enter, 'w' = write partition and exit
# fdisk /dev/hdb

Remove the disk entry from the vm.cfg file, and restart the vm.


Shrink a LVM

Just create a new disk, copy over contents and delete old volume.

Creating Filesystem for New Guest OS using LVM

To initialise a disk inside LVM
root@linux:~# pvcreate /dev/sda1
  Physical volume "/dev/sda1" successfully created


To add initialised disk to volume group :
root@linux:~# vgcreate xen /dev/sda1


To scan physical voulumes under LVM :
root@Linux:~# pvscan


To scan all Volume Groups under LVM:
root@Linux:~# vgscan


Now  to create a Logical Volume under Volume Group :
root@Linux:~# lvcreate -L2048 -nlinux-xen xen
  Logical volume "linux-xen" created



To scan all Logical Volumes :
root@Linux:~# lvscan
  ACTIVE '/dev/xen/linux-xen' [2,00 GB] inherit



Now create a File system
root@Linux:~# mkfs.ext3 /dev/xen/linux-xen



Now Mount :
root@Linux:~# mount
/dev/xen/linux-xen /mnt/data1/

Check for filesytem in df command
root@Linux:~# df | grep data1
     2,0G 68M 1,9G 4% /mnt/data1



Thursday, January 20, 2011

Installing Guest OS in Xen using xen command

Edit vm.cfg to suit your locations/hostnames/ip address

[root@xenhost sample]# cat vm.cfg
acpi = 1
apic = 1
bootloader = '/usr/bin/pygrub'
disk = ['file:/FMW/vms/sample/DomU-5EL-U5-x86_64-1.0.3.img,hda,w',
'file:/FMW/vms/sample/firststart.img ,sdb,w',
#'phy:/dev/mapper/DomUVol-appohs_d2,sdc,w',
'file:/FMW/vms/sample/swap,sdd,w',
'file:/FMW/vms/sample/tmp,sde,w',
]
localtime = 0
memory = 6144
name = 'guest1'
ne2000 = 0
on_crash = 'preserve'
on_poweroff = 'destroy'
on_reboot = 'restart'
on_shutdown = 'shutdown'
pae = 1
sdl = 0
serial = 'pty'
superpages = 1
timer_mode = 2
vcpus = 16
vif = ['ip=192.168.10.10']
vif_other_config = []
vnc = 1
vncunused = 1
[root@adcdap11 sample]#

[root@adcdap11 sample]# xm new vm.cfg

[root@adcdap11 sample]# xm listName                                        ID   Mem VCPUs      State   Time(s)
Domain-0                                     0   512    16     r-----  11518.4
guest1                                          6144    16                 0.0
[root@adcdap11 sample]#
 







Installing Guest OS in Xen


 
virt-install supports only Http, Nfs and FTP protocols. 
[root@fedora7 ~]# virt-install
What is the name of your virtual machine? myXenGuest
 How much RAM should be allocated (in megabytes)? 300
 What would you like to use as the disk (path)? /home/nas/xenGuest.dsk
 How large would you like the disk (/home/nas/xenGuest.dsk) 
to be (in gigabytes)? 3
 Would you like to enable graphics support? (yes or no) yes
 What is the install location?
http://download.fedora.redhat.com/pub/fedora/linux/releases/7/Fedora/i386/os/
 

Starting install...
libvir: Xen Daemon error : GET operation failed: 
Retrieving file Fedora... 
434 kB 00:02 
Retrieving file vmlinuz.. 100% |=========================|
2.1 MB    00:11     
Retrieving file initrd.im 100% |=========================| 
5.4 MB    00:27     
libvir: Xen Daemon error : GET operation failed: 
Creating storage file...  100% |=========================|
3.0 GB    00:00     
Creating domain... 
0 B 00:06 

VNC Viewer Free Edition 4.1.2 for X - built Jun 11 2007 09:44:52
Copyright (C) 2002-2005 RealVNC Ltd.
See http://www.realvnc.com for information on VNC.

Thu Aug 30 12:01:33 2007
 CConn:       connected to host localhost port 5900
 CConnection: Server supports RFB protocol version 3.8
 CConnection: Using RFB protocol version 3.8

Thu Aug 30 12:01:34 2007
 TXImage:     Using default colormap and visual, TrueColor, depth 24.
 CConn:       Using pixel format depth 6 (8bpp) rgb222
 CConn:       Using ZRLE encoding

Set up Agent password for OVM server

 Agents are installed onve you have installed OVM Server.

Reset OVM-agent password for you to create Server Pool in web console.

[root@adcdap11 OVM-Manager]# service ovs-agent configure
;network access control by ip --
;rules := if addr.match(allow) and not addr.match(deny): return True
;pattern items delimited by comma and could be
;219.142.73.50   #single ip
;219.142.73.*    #range
;219.142.73.0/24 #range in CIDR format
;default to allow all, deny none
allow=*
allow=10.228.136.118
now allow=10.228.136.118

deny=
deny=
now deny=

;share_disk_pat --
;set the directories for searching sharable block devices
;directories should be seperated by ':'
;if not set, /dev/mpath/* will be used
share_disk_pat=/dev/mpath/*
share_disk_pat=
now share_disk_pat=/dev/mpath/*

would you like to modify password to communicate with agent (local)?[y/N]y
password:
again:

OVS Agent configuration done.

Tell agent to reload cache ...
Agent cache reloaded.
[root@adcdap11 OVM-Manager]#

Installing Virtual Manger (Web Console Management for OVM).

[root@host1 OVM-Manager]# ./runInstaller.sh
Welcome to Oracle VM Manager 2.2

Please enter the choice: [1|2|3]
1. Install Oracle VM Manager
2. Uninstall Oracle VM Manager
3. Upgrade Oracle VM Manager
1

Starting Oracle VM Manager 2.2 installation ...

The installation process detected an existing XE database. Do you want to use it? [1|2|3]
1. Use existing Oracle XE database on localhost
2. Remove the Oracle XE database and install a new one
3. Use an existing Oracle database in my network
1

Please enter the port of listener:1521

Please enter the password for database account 'SYS': xxxx
Checking the availability of the database ...

Set default database schema to 'OVS'.

Please enter the password for account 'OVS':xxxx
Confirm the password:xxxx


Please enter the default tablespace for user OVS(DEFAULT: USERS): <Just Enter>




Checking the availability of the tablespace USERS ...

Creating the Oracle VM Manager database schema ...Done

Installing the ovs-manager package (rpm) ...
Done

Installing the oc4j package (rpm) ...

Done

Please enter the password for account 'oc4jadmin': xxxx
Confirm the password: xxxx

Starting OC4J ... Done.
To access the OC4J Home Page and change the password go to http://127.0.0.1:8888/em

Deploying Oracle VM Manager application to OC4J container.



Creating connection pool ... Done
Creating data source ... Done
Deploying application help ... Done

Deploying application ... Done



Please enter the keystore password for the Web Service: xxxx
Confirm the password: xxxx

Setting keystore password for Web Service ... Done

Do you want to use HTTPS access for Oracle VM Manager (Y|n)?y

Configuring OC4J to use HTTPS ... Done
Stopping OC4J ... Done
Starting OC4J ... Done




Please enter the password for the default account 'admin': xxxx
Confirm the password: xxxx



Please enter the outgoing SMTP mail server(e.g. - mail.abc.com, mail.abc.com:25): adcdap11
Mail server checking, may need some time, please wait ...
Mail server 'adcdap11' check failed, enter Y to change the name and retry or N to keep hostname and continue(Y|n)?N


Setting the SMTP server to adcdap11 ...

Please enter an e-mail address for account 'admin':
E-mail address can't be null. Enter e-mail address:sriram.sreedhar@oracle.com

Updating e-mail address for account 'admin' to 'sriram.sreedhar@oracle.com' ...
Done

The console feature is not enabled by default.
For detailed setup, refer to Oracle VM Manager User's Guide

Installation of Oracle VM Manager completed successfully.

To access the Oracle VM Manager 2.2 home page go to:
  https://10.228.136.118:4443/OVS

To access the Oracle VM Manager web services WSDL page go to:
  https://10.228.136.118:4443/OVSWS/LifecycleService.wsdl
  https://10.228.136.118:4443/OVSWS/ResourceService.wsdl
  https://10.228.136.118:4443/OVSWS/PluginService.wsdl
  https://10.228.136.118:4443/OVSWS/ServerPoolService.wsdl
  https://10.228.136.118:4443/OVSWS/VirtualMachineService.wsdl
  https://10.228.136.118:4443/OVSWS/AdminService.wsdl

To access the Oracle VM Manager help page go to:
  https://10.228.136.118:4443/help/help


[root@host1 OVM-Manager]#

Extracting contents in .ISO image file.

[root@host1 sriram]# pwd
/FMW/sriram

[root@host1 sriram]# ls
Fedora-14-i686-Live-Desktop.iso  Oracle-VM-Manager.zip            test
OracleVM-Manager-2.2.0.iso       oracle-xe-10.2.0.1-1.0.i386.rpm  VMimage

[root@host1 sriram]# mkdir OVM-Manager
[root@host1 sriram]# cd OVM-Manager/


[root@host1 OVM-Manager]#  mount -o loop ../OracleVM-Manager-2.2.0.iso .

[root@host1 OVM-Manager]# cd ..


[root@host1 sriram]# cd OVM-Manager/
[root@adcdap11 OVM-Manager]# ls
EULA  LICENSE  readme.txt  runInstaller.sh  scripts  source  TRANS.TBL

Wednesday, January 19, 2011

Oracle VM Server

Some basics of Oracle VM Server:

Oracle VM Server includes an updated version of the underlying Xen™ hypervisor
technology, and the Oracle VM Agent. It also includes a Linux kernel with support for
a broad array of devices, file systems, and software RAID volume management. The
Linux kernel is run as dom0 to manage one or more domU virtual machines, each of
which could be Linux or Microsoft Windows.

Hypervisor:
Oracle VM Server is designed so that the hypervisor (also callled the Virtual Machine
Monitor, or VMM) is the only fully privileged entity in the system, and has an
extremely small footprint. It controls only the most basic resources of the system,
including CPU and memory usage, privilege checks, and hardware interrupts.

Domain:
A domain is a configurable set of resources, including memory, virtual CPUs, network
devices and disk devices, in which virtual machines run. A domain is granted virtual resources and can be started, stopped and restarted independently. Domains other than the management domain (dom0) are referred to as domU. These domains are unprivileged domains with no direct access to the hardware or device drivers. Each domU is started by Oracle VM Server in dom0.

Guest:
A guest is a virtualized operating system running within a domain. A guest operating system
may be paravirtualized or hardware virtualized. Multiple guests can run on the same
Oracle VM Server. A guest is a virtualized operating system running within a domain.

Paravirtualized or hardware virtualized
Oracle VM Server guest operating systems may run in one of two modes,
paravirtualized or hardware virtualized. In paravirtualized mode, the kernel of the
guest operating system is recompiled to be made aware of the virtual environment.
This allows the paravirtualized guest to run at near native speed, since most memory,
disk and network accesses are optimized for maximum performance.

If support for hardware virtualization is available (either Intel VT or AMD-V), the
guest operating system may run completely unmodified. This hardware virtualized
guest is carefully monitored and trapped by Oracle VM Server when any instruction is
executed which would violate the isolation with other guests or dom0.

Oracle VM Manager


The host machine on which Oracle VM Manager is installed is known as an
Oracle VM Manager host. It provides the interface where most of the virtual machine
management tasks are performed. Its main function is to forward operational commands
from users to other, possibly remote, servers and display their results.


Oracle VM Manager using the standard port of 8888 on a

host named example.com, use:
http://example.com:8888/OVS

To connect to Oracle VM Manager using the Secure Sockets Layer (SSL) port of 4443 on

a host named example.com, use:
https://example.com:4443/OVS

Oracle VM Agent
Oracle VM Manager communicates with Oracle VM Agent to create and manage
guests on an Oracle VM Server. Oracle VM Agent is installed and configured during
the installation of Oracle VM Server. You do not need to install Oracle VM Agent
separately. Oracle VM Agent is installed into:
/opt/ovs-agent-2.3

Sunday, January 16, 2011

Pack and Unpack commands on Weblogic.

Pack and unpack commands are used to create domins and templates from command line

These shell scripts are available in$MW_HOME/wlserver_[ver]/common/bin

 1)  Run pack.sh to bundle domain and templates from Machine1 (This will create jar file)
 2)  Copy jar file (created by using pack.sh command) from Machine1 to Machine2
 3) Use unpack.sh to create domain & managed server on Machine2

This will provide a similar identical domain in Machine2.




Syntax of the Pack Command
pack -domain=path_of_domain -template=path_of_jara_file_to_create -template_name=”template_name” [-template_author=”author”][-template_desc=”description”] [-managed=true|false][-log=log_file] [-log_priority=log_priority]
  • Default value for -managed is false
.
Syntax of the Unpack Command

unpack -template=path_of_jara_file -domain=path_of_domain_to_be_created [-user_name=username] [-password=password] [-app_dir=application_directory] [-java_home=java_home_directory] [-server_start_mode=dev|prod] [-log=log_file] [-log_priority=log_priority]

For more info

Friday, January 14, 2011

Understanding basics of Weblogic .

What is a domain in Weblogic ?
Domain is logical grouping of resources and services and consist of Administration Server, Managed Server and cluster.  There can only be one administration Server in domain and zero to N Managed Server.

What is Administration Server ?
Administration Server is WebLogic Server instance that maintains configuration data for a domain. You can deploy your application on administration Server but it is recommended to create managed Server and deploy your application in managed server and leave Administration domain for configuration and maintenance.

—There will always be atleast one Administration Server in a domain.

What is Managed Server ?

Servers that are managed by Administration server , apart from main admin server are all Managed Servers.

What is a Weblogic Cluster ?
Group of WebLogic Managed Server Instances that work together to provide high availability and scalability for applications is called cluster.


Good explanation on Weblogic the way it works. 





 Also check here for more info :

Thursday, January 13, 2011

Create your own WLST commands

You can create your own WLST commands

Example

create a testFile.py file with below,
def mycmd():

    print 'Hello'

copy it in below location:

$WL_HOME/wlserver_10.3/common/wlst/lib


Go to wlst command line:
$WL_HOME/wlserver_10.3/common/bin

bash-3.00$ ./wlst.sh

Run below :
wls:/offline> testFile.mycmd()
Hello

Creating a .war (webarchive) file out of .jsp

bash-3.00$ jar cvf test9.war test9.jsp
adding: META-INF/ (in=0) (out=0) (stored 0%)
adding: META-INF/MANIFEST.MF (in=56) (out=56) (stored 0%)
adding: test9.jsp (in=159) (out=131) (deflated 17%)
Total:
------
(in = 203) (out = 501) (deflated -146%)
bash-3.00$

Note: .war files are web archive files which are used to deploy in Web App servers like Weblogic.

Installing Weblogic Server

Need to run the below binary and answer simple questions.


bash-3.00$ ./wls_linux32.bin
Extracting 0%....................................................................................................100%
Unable to instantiate GUI, defaulting to console mode.

<-------------------- Oracle Installer - WebLogic 10.3.4.0 ------------------->

Welcome:
--------

This installer will guide you through the installation of WebLogic 10.3.4.0.
Type "Next" or enter to proceed to the next prompt.  If you want to change data entered previously, type "Previous".  You may quit the installer at any time by typing "Exit".


Enter [Exit][Next]>

<-------------------- Oracle Installer - WebLogic 10.3.4.0 ------------------->

Choose Middleware Home Directory:
---------------------------------

 ->1|* Create a new Middleware Home
   2|/scratch/test/Oracle/Middleware

Enter index number to select OR [Exit][Previous][Next]> 2


<-------------------- Oracle Installer - WebLogic 10.3.4.0 ------------------->

Register for Security Updates:
------------------------------

Provide your email address for security updates and  to initiate configuration manager.

   1|Email:[]
   2|Support Password:[]
   3|Receive Security Update:[Yes]


Enter index number to select OR [Exit][Previous][Next]>

<-------------------- Oracle Installer - WebLogic 10.3.4.0 ------------------->

Choose Install Type:
--------------------

Select the type of installation you wish to perform.

 ->1|Typical
    |  Install the following product(s) and component(s):
    | - WebLogic Server
    | - Oracle Coherence

   2|Custom
    |  Choose software products and components to install and perform optional
    |configuration.


Enter index number to select OR [Exit][Previous][Next]>

<-------------------- Oracle Installer - WebLogic 10.3.4.0 ------------------->

Choose Product Installation Directories:
----------------------------------------

Middleware Home Directory: [/scratch/test/Oracle/Middleware]

Product Installation Directories:

   1|WebLogic Server: [/scratch/test/Oracle/Middleware/wlserver_10.3]
   2|Oracle Coherence: [/scratch/test/Oracle/Middleware/coherence_3.6]

<-------------------- Oracle Installer - WebLogic 10.3.4.0 ------------------->

The following Products and JDKs will be installed:
--------------------------------------------------

    WebLogic Platform 10.3.4.0
    |_____WebLogic Server
    |    |_____Core Application Server
    |    |_____Administration Console
    |    |_____Configuration Wizard and Upgrade Framework
    |    |_____Web 2.0 HTTP Pub-Sub Server
    |    |_____WebLogic SCA
    |    |_____WebLogic JDBC Drivers
    |    |_____Third Party JDBC Drivers
    |    |_____WebLogic Server Clients
    |    |_____WebLogic Web Server Plugins
    |    |_____UDDI and Xquery Support
    |    |_____Evaluation Database
    |_____Oracle Coherence
         |_____Coherence Product Files

    *Estimated size of installation: 629.2 MB



Enter [Exit][Previous][Next]>




<-------------------- Oracle Installer - WebLogic 10.3.4.0 ------------------->

Installing files..

0%          25%          50%          75%          100%
[------------|------------|------------|------------]
[***********************************************

Performing String Substitutions...





<-------------------- Oracle Installer - WebLogic 10.3.4.0 ------------------->

Configuring OCM...

0%          25%          50%          75%          100%
[------------|------------|------------|------------]
[***************************************************]


Creating Domains...





<-------------------- Oracle Installer - WebLogic 10.3.4.0 ------------------->

Installation Complete


Congratulations! Installation is complete.


Press [Enter] to continue or type [Exit]>

Deploying Java App .war (web archive) through commandline in Weblogic

I am using full paths below for  java command and  location of weblogic.jar so that its easier.

bash-3.00$ /scratch/test/Oracle/sriram/jrockit_160_22_D1.1.1-3/bin/java -classpath /scratch/test/Oracle/sriram/wlserver_10.3/server/lib/weblogic.jar weblogic.Deployer -adminurl t3://adchost.us.apple.com:3333 -username sriram -password xxxx -deploy ./test2.war -id deploy1
weblogic.Deployer invoked with options:  -adminurl t3://adchost.us.apple.com:3333 -username sriram -deploy ./test2.war -id deploy1
<Jan 13, 2011 3:20:47 AM PST> <Info> <J2EE Deployment SPI> <BEA-260121> <Initiating deploy operation for application, test2.war [archive: /scratch/aime1/Oracle/sriram/user_projects/domains/sri/autodeploy/./test2.war], to configured targets.>
<Jan 13, 2011 3:20:48 AM PST> <Warning> <Deployer> <BEA-149004> <Failures were detected while initiating deploy task for application 'test2.war'.>
<Jan 13, 2011 3:20:48 AM PST> <Warning> <Deployer> <BEA-149004> <Failures were detected while initiating deploy task for application 'test2.war'.>
[Deployer:149184]The application 'test2.war' was autodeployed and may only be redeployed by touching REDEPLOY file in the domain autodeploy directory for respected application.
bash-3.00$

Check weblogic version through Java classpath

 echo $JAVA_HOME
/scratch/test/Oracle/sriram/jrockit_160_22_D1.1.1-3/

$java -classpath /scratch/aime1/Oracle/sriram/wlserver_10.3/server/lib/weblogic.jar weblogic.version

WebLogic Server 10.3.4.0  Fri Dec 17 20:47:33 PST 2010 1384255

Use 'weblogic.version -verbose' to get subsystem information

Use 'weblogic.utils.Versions' to get version information for all modules
bash-3.00$

Jrockit Oracle' Java seems to work well with Weblogic.

I tried my weblogic.Deployment through sun java which threw nullpointer error.

so i pointed to jrockit java which seems to have worked,

$export JAVA_HOME=/scratch/test/Oracle/sriram/jrockit_160_22_D1.1.1-3/

To check if weblogic.deployer works with below classpath:

 $java -classpath /scratch/aime1/Oracle/sriram/wlserver_10.3/server/lib/weblogic.jar weblogic.Deployer -help
Usage: java weblogic.Deployer [options] [action] [Deployment units(s)]

where options include:
    -help             Print the standard usage message.
    -version          Print version information.
    -adminurl <<protocol>://<server>:<port>> [option] Administration
                      server URL: default t3://localhost:7001
    -username <username> [option] user name
    -password <password> [option] password for the user
    -userconfigfile <userconfigfile> [option] The user config file
                      contains the user security credentials; it
                      is administered by the weblogic.Admin tool
    -userkeyfile <keyConfigFile> [option] The users key file; it is
                      administered by the weblogic.Admin tool.
    -distribute       [action] Distribute application to the
                      targets.
    -start            [action] Makes an already distributed
                      application available on a target.
    -stop             [action] Makes an application unavailable on
                      targets.
    -redeploy         [action] Replace a running application
                      partially or entirely.
    -undeploy         [action] Take an application out of service.
    -deploy           [action] Make an application available for
                      service.
    -update           [action] Update an application configuration
                      in place.
    -examples         [option] Displays example usage of this tool.
    -name <application name> [option] Defaults to the basename of the
                      deployment file or directory.
    -targets <<target(s)>> [option] A comma separated list of targets
                      for the current operation. If not specified,
                      all configured targets are used. For a new
                      application, the default target is the
                      administration server.
    -plan <Deployment plan path> [option] Specifies location of
                      deployment plan
    -library          [option] Indicates that the unit being
                      deployed is a library. This option is
                      required when the application is a library.
    -advanced         Print advanced usage options.

The optional trailing arguments are deployment units and may
represent the archive being deployed, the name of a previously
deployed application or a list of files for a partial redeploy operation.

Weblogic Environment Variables

Defining the WLS env :

export CLASSPATH=/scratch/test/Oracle/sriram/wlserver_10.3/server/lib/weblogic.jar
export WL_HOME=/scratch/test/Orale/sriram/wlserver_10.3
export JAVA_HOME=/scratch/test/Oracle/sriram/jrockit_160_22_D1.1.1-3/
export PATH=$PATH:/scratch/test/Oracle/sriram/jrockit_160_22_D1.1.1-3/

Check java version :
bash-3.00$ java -version
java version "1.6.0_22"
Java(TM) SE Runtime Environment (build 1.6.0_22-b04)
Oracle JRockit(R) (build R28.1.1-14-139783-1.6.0_22-20101206-0241-linux-ia32, compiled mode)
bash-3.00$

like sun's java , oracle named its version of java as jrockit.