Useful Oracle VM Server Hypervisor XM Commands – Part 15


Basic information about the Oracle VM Server

[root@ovs01 ~]# xm info
host : ovs01.lab.local
release : 3.8.13-118.15.1.el6uek.x86_64
version : #2 SMP Fri Dec 2 09:07:34 PST 2016
machine : x86_64
nr_cpus : 4
nr_nodes : 1
cores_per_socket : 2
threads_per_core : 1
cpu_mhz : 2591
hw_caps : 1fabfbff:2c100800:00000000:00003f00:f6fa3223:00000000:00000101:00000281
virt_caps : hvm
total_memory : 2047
free_memory : 685
free_cpus : 0
xen_major : 4
xen_minor : 3
xen_extra : .1OVM
xen_caps : xen-3.0-x86_64 xen-3.0-x86_32p hvm-3.0-x86_32 hvm-3.0-x86_32p hvm-3.0-x86_64
xen_scheduler : credit
xen_pagesize : 4096
platform_params : virt_start=0xffff800000000000
xen_changeset :
xen_commandline : console=com1,vga com1=57600,8n1 dom0_mem=max:816M allowsuperpage
cc_compiler : gcc (GCC) 4.4.7 20120313 (Red Hat 4.4.7-3)
cc_compile_by : mockbuild
cc_compile_domain : us.oracle.com
cc_compile_date : Sun Dec 25 21:46:52 PST 2016
xend_config_format : 4

List all running domain details

[root@ovs01 ~]# xm list
Name ID Mem VCPUs State Time(s)
0004fb0000060000524f9d3e43fd71f3 2 515 2 -b---- 140.8
Domain-0 0 814 4 r----- 1032.5

To list details for particular VM

[root@ovs01 ~]# xm list 0004fb0000060000524f9d3e43fd71f3
Name ID Mem VCPUs State Time(s)
0004fb0000060000524f9d3e43fd71f3 2 515 2 -b---- 150.1

Detail information about the VM

[root@ovs01 ~]# xm list 0004fb0000060000524f9d3e43fd71f3 -l

VM Grace Shutdown

[root@ovs01 ~]# xm shutdown 0004fb0000060000524f9d3e43fd71f3

To start the VM

[root@ovs01 ~]# xm create /OVS/Repositories/0004fb000003000082b0d717e2f9871d/VirtualMachines/0004fb0000060000524f9d3e43fd71f3/vm.cfg
Using config file "/OVS/Repositories/0004fb000003000082b0d717e2f9871d/VirtualMachines/0004fb0000060000524f9d3e43fd71f3/vm.cfg".
Started domain 0004fb0000060000524f9d3e43fd71f3 (id=3)

VM Kill/PowerOff and Reboot

[root@ovs01 ~]# xm destroy 0004fb0000060000524f9d3e43fd71f3
[root@ovs01 ~]# xm reboot 0004fb0000060000524f9d3e43fd71f3

To get the VM MAC details

[root@ovs01 ~]# xm network-list 0004fb0000060000524f9d3e43fd71f3
Idx BE MAC Addr. handle state evt-ch tx-/rx-ring-ref BE-path
0 0 00:21:f6:96:bf:12 0 1 -1 -1 /-1 /local/domain/0/backend/vif/4/0

To monitor the Xen Domain

[root@ovs01 ~]# xm top

VM current state

[root@ovs01 ~]# xm domstate 0004fb0000060000524f9d3e43fd71f3
idle

To list all domain CPU details

[root@ovs01 ~]# xm vcpu-list
Name ID VCPU CPU State Time(s) CPU Affinity
0004fb0000060000524f9d3e43fd71f3 4 0 1 -b- 70.9 0-1
0004fb0000060000524f9d3e43fd71f3 4 1 0 -b- 22.5 0-1
Domain-0 0 0 1 -b- 255.5 any cpu
Domain-0 0 1 3 -b- 385.1 any cpu
Domain-0 0 2 2 -b- 237.5 any cpu
Domain-0 0 3 0 r-- 335.8 any cpu

To see Domain uptime

[root@ovs01 ~]# xm uptime
Name ID Uptime
0004fb0000060000524f9d3e43fd71f3 4 0:05:21
Domain-0 0 1:31:59

DRY-RUN command to check whether domain is able to access the resources

[root@ovs01 ~]# xm dry-run /OVS/Repositories/0004fb000003000082b0d717e2f9871d/VirtualMachines/0004fb0000060000524f9d3e43fd71f3/vm.cfg
Using config file "/OVS/Repositories/0004fb000003000082b0d717e2f9871d/VirtualMachines/0004fb0000060000524f9d3e43fd71f3/vm.cfg".
Checking domain:
0004fb0000060000524f9d3e43fd71f3: PERMITTED
Checking resources:
file:/OVS/Repositories/0004fb000003000082b0d717e2f9871d/VirtualDisks/0004fb0000120000590b281ac02ac9b2.img: PERMITTED
file:/OVS/Repositories/0004fb000003000082b0d717e2f9871d/ISOs/0004fb0000150000006463c3fe40be43.iso: PERMITTED
Dry Run: PASSED

VM Live migration to other Oracle VM Server

[root@ovs01 ~]# xm migrate -l 0004fb0000060000524f9d3e43fd71f3 ovs02.lab.local

How to configure VNC in Oracle Virtual Server – Part 7


In my last post, new VM has been built and started, now how can we install the operating system and other application on that host from Command Line Interface.
This can be achieved by enable the VNC (Virtual Network Computing) settings in Virtual Machine configuration to access from remote host.

Step 1: Login to Oracle Virtual Server.

[root@mgmtsrv ~]# ssh ovs01.lab.local
root@ovs01.lab.local's password:
Last login: Sat Dec 23 05:24:55 2017 from 10.10.10.1
Warning: making manual modifications in the management domain
might cause inconsistencies between Oracle VM Manager and the server.

Step 2: Check the VM console port number.

[root@ovs01 ~]# xm list
Name ID Mem VCPUs State Time(s)
0004fb0000060000524f9d3e43fd71f3 1 515 1 ------ 1.5
Domain-0 0 814 4 r----- 89.9

[root@ovs01 ~]# xm list -l | grep location
(location 5)
(location 127.0.0.1:5900)

[root@ovs01 ~]# netstat -antulp | grep 5900
tcp 0 0 127.0.0.1:5900 0.0.0.0:* LISTEN 2537/qemu-dm

If you see above netstat output, the console port 5900 mapped to localhost. Which means that VM can be accessible only from local Oracle VM Server, we can’t connect the VM host from remote machine. But in next step we are going to define the vnclisten address to overcome this problem.

Go to Virtual Machine configuration path.

[root@ovs01 ~]# cd /OVS/Repositories/0004fb000003000082b0d717e2f9871d/VirtualMachines/0004fb0000060000524f9d3e43fd71f3

Add the below vfb parameter to enable the VNC to access from anywhere.

[root@ovs01 0004fb0000060000524f9d3e43fd71f3]# echo "vfb = ['type=vnc,vncunused=1,vnclisten=0.0.0.0,vncpasswd=hello123']" >> vm.cfg

[root@ovs01 0004fb0000060000524f9d3e43fd71f3]# cat vm.cfg | grep vfb
vfb = ['type=vnc,vncunused=1,vnclisten=0.0.0.0,vncpasswd=hello123']

vnc = 1 # vnc=1 enabled, 0=disabled
vncconsole = 1 # vncconsole=1 enables spawning VNC viewer for domain’s console. Default=0
vnclisten = 0.0.0.0 # sets VNC to allow access to any computer
vncpasswd = ‘hello123’ # VNC password
vncunused = 1 # vncunused=1 – find an unused port for the VNC server to listen on. Default=1

Step 3: Access VM host from Oracle VM Manager.

Install Required Packages in Oracle VM Manager

[root@ovm ~]# yum install -y xorg-x11-server-Xorg xorg-x11-xauth xorg-x11-apps

Enable X11 SSH Forwarding in the /etc/ssh/ssh_config file.

Uncomment or add the below lines.

X11Forwarding yes

Restart SSH Service

[root@ovm ~]# /etc/init.d/sshd restart
Stopping sshd: [ OK ]
Starting sshd: [ OK ]

Download and install Xming

Once you installed Xming, Select Xming and click XLaunch and proceed with default parameters.

Configure Putty

1. Open Putty and Enter the OVM server hostname or ipaddress
2. Go to Connection -> SSH -> X11 -> Enable X11 forwarding checkbox
3. Set the X display location as localhost:10.0
4. Finally click Open button
5. Login as root user

[root@ovm ~]# echo $DISPLAY
localhost:10.0

By executing below command we can make sure X11 options enabled on this machine.

[root@ovm ~]# xclock
[root@ovm ~]# xeyes

Connect to the guest on the host computer with the command

[root@ovm ~]# vncviewer -Shared ovs01.lab.local:5900

TigerVNC Viewer for X version 1.1.0 - built Sep 22 2014 07:14:05
Copyright (C) 1999-2011 TigerVNC Team and many others (see README.txt)
See http://www.tigervnc.org for information on TigerVNC.

Sun Dec 17 06:21:36 2017
CConn: connected to host ovs01.lab.local port 5900
CConnection: Server supports RFB protocol version 3.8
CConnection: Using RFB protocol version 3.8

Sun Dec 17 06:21:39 2017
TXImage: Using default colormap and visual, TrueColor, depth 24.
CConn: Using pixel format depth 24 (32bpp) little-endian rgb888
CConn: Using Tight encoding

That’s it. Now you can able to access the VM host and start installing the Operating System.