Friday May 20, 2016

Oracle VM 3.4: show VMs full or partially allocated on a repository (ShowRepoVm)

More than one time it could be required to know which VMs are on a specific repository; while it is an easy evaluation for all VMs with their configuration file, it could be much more time expensive to identify VMs that partially resides on a repository.

Even if it's suggested to have the entire VM on one unique repository (for convenience, not for technical limits), one VM can reside on more repositories and in this case it could need much more time to evaluate which VMs are, even partially, on a specific repository.

So, target of the script available here is to supply all the VMs that, completely or partially, reside on a specific repository.

The script is able to interact with Oracle VM 3.2, 3.3 and 3.4 releases and, itself, evaluates the correct release and commands needed.

The script loops on each component available on the repository and verify the ownership; for each line with "." you'll know that one component has been verified:

Here an example of the output of the script:

Feedback and comments are, obviously, appreciated.

Thursday May 12, 2016

Oracle VM 3.4 script: schedule and move VMs to a different repository

Moving VMs from one repository to an other can be something boring, mostly if your VM has many vdisks or if you have to move many vms.

On Oracle VM to completely move a VM you need to create a clone-customizer and specify target destination for each virtual-disk.

So, on activities like:

  • storage replacement (new repositories) ***
  • huge list of vms to move to a new repository
  • vms to move to a new repository with tens of virtual-disks
  • scheduled VM moving

a batch approach can help to address them with an automated script able to create the clone-customizer and move the entire vm (vm.cfg file and all virtual-disks) to the destination repository. 

*** In case of storage replacement this script does not manage the Oracle VM poolfs migration.

Moving a VM is a tricky operation and more checks are executed by the script before starting with it; these are all the checks executed by the script before starting the "move" operation:

  • Execute the first connection to the manager using "expect", needed in case of reboot of Oracle VM Manager or client host
  • Check VM Name is unique: you can have different VMs with the same name but we need to identify which one we have to move
  • Check Server-Pool name and VM membership: verify that VM we are going to move is part of the pool specified
  • Check target repository name: verify that target repository specified exists
  • Check OVS that guest the vm: verify which Oracle VM Server actually guest the VM and if this server has target repository presented
  • Check OVMCLI Release and features available: this script is compatible with Oracle VM 3.3 and 3.4
  • Check VM and all its components are not already on target repository: verify that everything is not already in place
  • Verify disk space available on target repository: verify that on target repository there is enough space to guest the VM
  • Check VM Status (running / stopped) and options specified (VM shutdown and VM restart)

Once all these checks are verified the script executes following steps:

  • Create Clone Customizer for VM moving
  • Prepare storage mappings for Clone Customizer created
  • Prepare network mappings for Clone Customizer created
  • Move VM to target repository and delete Clone Customizer
  • Verify VM moving completed successfully
  • Start the moved vm and verify it's started (optional)

Script "MoveVm.sh" v0.1 can be downloaded here.

"MoveVm.sh" script  has following characteristics:

  • Compatible with:
    • Oracle VM 3.3
    • Oracle VM 3.4
  • Requires
    • "expect" installed on the Linux system executing the script
    • able to reach port 10000 of Oracle VM Manager host

Script flowchart graphically is:

To see script syntax, just execute the script without any option:

The script won't move "Virtual Cd-Rom" (ISO files) and/or manage physical disks.

In the following example we have one VM (ol67test) where:

  • vm.cfg file is on repository named local_02
  • 3 virtual-disks are on repository named local_02
  • 1 virtual-cdrom is on repository named local_02
  • 1 physical-disk is owned by the guest
  • 2 vnic(s) are configured on two different networks

Following example will move the entire VM (vm configuration file and all virtual-disks) to repository named local_01.

Now the "moved" VM is configured with:

  • vm.cfg file is on repository named local_01
  • 3 virtual-disks are on repository named local_01
  • 1 virtual-cdrom remains on repository named local_02
  • 1 physical-disk is owned by the guest
  • 2 vnic(s) are configured as before

Log execution of this operation can be downloaded here

Obviously all this stuff can be scheduled and, thanks to this OVMCLI script, moving VMs won't be anymore a tedious operation.

Feedback and questions are obviously appreciated. 

Monday May 02, 2016

Oracle VM 3.4: create custom install ISO with updated UEK4 kernel

Oracle VM Server 3.4.1 ISO package is dedicated to server installation but, to try it, maybe someone needs to install on a desktop/laptop environment (direct install on bare metal).

It could happen that the default UEK4 kernel part of Oracle VM Server 3.4.1 build 1351, does not contain a particular fix and/or driver needed for old or newest hardware; a common problem, for example, could be related to particular graphic card available on modern desktop/laptop systems and while the installation correctly terminates, you aren't able to get console access to the system.

So, the target of this guide, is to supply a step-by-step guide to build  your custom "Oracle VM Server" ISO package with an updated UEK4 kernel release where, maybe, the fix needed is already in place.

In the example below, I'll pick-up updated kernel-uek packages for Oracle VM Server 3.4.1, actually available by yum.oracle.com ; the machine used for all this steps is based on "Oracle Linux 6.7 x86_64".

RPMs/Packages needed to execute all the operation:

  • createrepo
  • rsync
  • mkisofs
Now we can start with the step-by-step how-to: 
  • Mount the default "Oracle VM Server 3.4.1" ISO
# mount -o loop /u01/OVS-3.4.1-1351.iso /media

  • Clone ISO content to a r/w directory
# mkdir /u01/new_iso
# rsync -avz /media/ /u01/new_iso/

  • Remove RPMs that will be replaced with updated release 

# cd /u01/new_iso/
# cd Packages/
# rm -f kernel-uek-4.1.12-32.1.3.el6uek.x86_64.rpm
# rm -f kernel-uek-firmware-4.1.12-32.1.3.el6uek.noarch.rpm

  • Copy updated RPMs (you can download them from yum.oracle.com if needed)
# cd /u01/new_iso/Packages/
# cp /root/kernel-uek-* .

  • Rebuild file "listing" with updated entries due to changes above and verify differences
# cd /u01/new_iso/Server/
# ls Packages/ > listing.new
# diff listing listing.new
# mv listing.new listing


  • Prepare to update YUM repository configuration and metadata files 
# cd /u01/new_iso/Server/repodata/
# mv bdaef80f41c05cc39420d77d91edea91c3d726cb003ba168ce74b3a5580f06ba-comps-ovs-core.xml comps-ovs-core.xml

  • Update YUM metadata files and sqlite DBs
# cd /u01/new_iso/Server/
# createrepo -g repodata/comps-ovs-core.xml .

  • Generate new ISO build pointing to the temporary directory
# cd /u01/new_iso/
# mkisofs -o ../OVS-3.4.1-b1351_custom.iso -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table -J -R -V "OVS 3.4.1 custom-build" .

  • Test your custom ISO and verify the system correctly installs

  • Update your Oracle VM Server 3.4.1 system pointing to yum.oracle.com
# cd /etc/yum.repos.d
# wget https://blogs.oracle.com/scoter/resource/blog21/ovm34_latest_x86_64.repo
# yum update -y

  • "yum update -y" example 

Feedback and question are obviously appreciated. 

Tuesday Apr 26, 2016

Oracle VM 3.4: ovm-info command to get details within VM

Continuing on the path of the first "ovm-disk" command, here you can find one new tool available for your Linux guest-vms; target of this utility, named "ovm-info", is to supply main information of the running guest on:

  • VM information, like Hostname, VM-Name, VM-Type and repository that house it.
  • CPU and Memory information (Max and used)
  • Disk information like domU device and the corresponding dom0 device (virtual or physical)
  • Network information like domU device and OVM Network configuration (id, dom0 net device and vlan-tag)
  • Other informations like H/A enabled or not, Hugepages enabled or not and actions on different operations (reboot, crash etc)

So with the same approach of the other script, specific for detailed reports on vdisks, we can install and execute this command on our running Linux guest and obtain this information by executing this command on the guest itself:

"ovm-info" command/script, once executed, query the Oracle VM Manager and obtains detailed info related to the device specified.

There are some requirements to have it correctly working and these are: 

  1. "expect" installed on the Linux VM
  2. VM able to reach port 10000 of Oracle VM Manager host
  3. Compatible with Oracle VM 3.3 and 3.4

The package containing all-the-stuff can be downloaded here ; into this tarball-gzipped file you'll find:

  • README_FIRST.txt (please, read it, it won't take more than 2 minutes)
  • FirstConn.exp (expect script that executes first connection to the Oracle VM Manager CLI port)
  • SetupSsh.exp (expect script that setup the self-authentication between the VM and Oracle VM Manager CLI)
  • install.sh (bash script to execute to correctly setup the self-authentication)
  • ovm-info (script that will be customized and copied by the install.sh process)

NB: Once the setup is completed a copy of the command "ovm-info" will be saved under "/usr/local/bin" and you can remove the install package and its directory.

Here you can find an example of the installation output (click on the image to get the entire log).

Syntax:

# ./install.sh <ovmm_host> <ovmm_oracle_linux_user_password> <ovmm_admin_manager_password>


Once the setup is completed, following success message will appear:

"OVMCLI Session successfully connected with key-based authentication!!!"

Now you can remove the package and the installation folder and verify the "ovm-info" command path:


Example output on "General Information" option (-g):


Example output on "CPU and Memory" option (-c):


Example output on "Virtual Disk" option (-d):


Example output on "Network Information" option (-n):

Example output on "Other Information" like H/A, HugePages and actions, option (-o):

Last option "Show all VM information" (-a) query for all information and option above sequentially.

Feedback and question are obviously appreciated. 

Friday Apr 08, 2016

Oracle VM 3.4: ovm-disk command to get disk details on Linux VMs

More than one time I received requests coming from customers or partners that would like to get the Page83 id of a LUN (presented to a specific VM) by executing a command on the VM itself; in fact, commands like "lsscsi" and "scsi_id" do not work on top of a Oracle VM Virtual Machine.


In the picture above, one running VM, is not aware if a disk is physical or virtual; only dom0 (Oracle VM Server) really knows it.

The other component, able to get information related to disks is Oracle VM Manager; so, by opening a communication channel between the guest-VMs and Oracle VM Manager CLI interface we can identify all the details related to our guest-disks.

"ovm-disk" command/script, once executed, query the Oracle VM Manager and obtains detailed info related to the device specified.

So the OVMCLI (Oracle VM Command Line Interface) script posted on this blog-post, allows to get this kind of information by executing a command on the Linux VM itself.

There are some requirements to have it correctly working and these are:

  1. "expect" installed on the Linux VM
  2. VM able to reach port 10000 of Oracle VM Manager host
  3. Compatible with Oracle VM 3.3 and 3.4

The package containing all-the-stuff can be downloaded here ; into this tarball-gzipped file you'll find:

  • README_FIRST.txt (please, read it, it won't take more than 2 minutes)
  • FirstConn.exp (expect script that executes first connection to the Oracle VM Manager CLI port)
  • SetupSsh.exp (expect script that setup the self-authentication between the VM and Oracle VM Manager CLI)
  • install.sh (bash script to execute to correctly setup the self-authentication)
  • ovm-disk (script that will be customized and copied by the install.sh process)

NB: Once the setup is completed a copy of the command "ovm-disk" will be saved under "/usr/local/bin" and you can remove the install package and its directory.

Here you can find an example of the installation output (click on the image to get the entire log).

Syntax:

# ./install.sh <ovmm_host> <ovmm_oracle_linux_user_password> <ovmm_admin_manager_password>

Once the setup is completed, following success message will appear:

"OVMCLI Session successfully connected with key-based authentication!!!"

Now you can remove the package and the installation folder and verify the "ovm-disk" command path:

Example output with a Virtual-Disk:

Example output with a Physical-Disk:

Example output with a Virtual-Cd-rom

Feedback and question are obviously appreciated. 

About

Simon Coter is a Principal Product Manager for Oracle VM and VirtualBox.

Search

Categories
Archives
« May 2016
SunMonTueWedThuFriSat
1
3
4
5
6
7
8
9
10
11
13
14
15
16
17
18
19
21
22
23
24
25
26
27
28
29
30
31
    
       
Today