What command line tools will we cover?
xentop:
This utility displays real-time information of VMs and VM Server.xm:
This utility takes you a step deeper into the inner workings of the hypervisor. A lot of arguments can be given with thexm
command line tool and it must be seen as a command control suite.virsh:
This utility is yet another powerful command line tool to manage the VMs within the Oracle VM Server.
The mighty xentop command
The xentop utility is one of the top utility that has been very famous in the UNIX world. With Xen hypervisor we also get to view our top process and that's why we use xentop.
Let's view various arguments of xentop by typing xentop--help
, as shown in the following screenshot:
Let's try all of the arguments one by one and see what they mean.
1. Here, we pass the
-n
argument and it gives us the output of all the Virtual NICs or VIFs.2. Passing the
-v
argument gives us all of the vCPU output data:
Without any arguments we get all the information of the VMs running in this VM Server. As you can see in the preceding screenshot, we have a 64 bit PVM Oracle 11g Database Virtual Appliance, 64 bit HVM Windows 2003 Server, a 32bit HVM Windows XP machine, and a 64bit PVM Oracle ELU2 VM.
We also see the information such as total memory on the VM Server, amount of memory used, free memory, and the number of CPUs.
Since this is a real-time tool, you can punch in arguments on-the-fly to get results. Suppose you type b
while running xentop interactively to get vbd block device data.
With block device data output:
So xentop provides you with real-time information of your running Oracle VM Server. Here you can see and take the right action like moving VMs to another box or allocating more resources to a VM.
The mightier xm utility
If xentop is a mighty utility, xm is the core utility within Xen. It is actually the command control suite with a huge amount of arguments which we shall learn about, soon. However, as mentioned earlier, we will not explore everything about those arguments lest we add another hundred or so pages to the book.
Running the xm-help
command shows you why we cannot discuss every little argument here. However, I will explain on my blog the utilities associated with Xen and other versions of Xen such as Oracle VM, and so on.
And the remaining list of arguments.
We will run a few arguments against the xm utility powerhouse.
1. Let's start with the basics and list all of the running domains on the VM Server using the
xm list
argument, as shown in the following screenshot:2. Check the uptime with the help of the
-uptime
flag for VM ID 19:3. Check out the network list for a VM with ID 19 by passing the
network-list 19
argument.4. You can get the list of vcpus by passing the
vcpu-list
argument for all VMs:5. You can print the log information by passing the
log
argument:6. Pass the
info
argument, in order to get the information about the VM Server, as shown in the following screenshot:7. You can pass the
shell
argument to get into the shell, and pass the arguments directly.8. The
block-list
argument without a-l
(l for long output), as shown in the following screenshot:9. The
block-list
argument with al
argument, to produce the output in the SXP format.
Xm dmesg: Read the Xen Daemon Message Buffer and if needed clean it. Here we type in the basic syntax for the xm dmesg
with an optional argument -c
, which clears the contents of the ring buffer while it displays it, as shown in the following screenshot:
Attaching and detaching new virtual NICs: Show the visible NICs before attaching a virtual NIC to a domain or a VM. Here, we give an extra virtual NIC to a VM by issuing xm network-attach 14
command. It then attaches the new virtual NIC to that VM:
Deleting or detaching can be done by issuing the network-detach
argument; we have to use a force flag and also detaching is not easy:
You have seen a few of the xm command line arguments and there are a lot of arguments which you can use when you feel the need to carry these commands out from the CLI (Command Line Interface).
Always remember that a lot of actions, if your Oracle IntraCloud VM farm is configured properly, can be carried out from the VM Manager console.
The killer virsh utility
Finally, let's take a look at another fine utility called virsh. Even this utility, similar to xm, is a great tool when a CLI rescue operation is needed and one must put on their geeky gloves.
And also, similar to xm, it's huge and has many arguments which we won't cover but we will brush through the important ones for you. Let's start with the -help
argument:
1. Passing the
-list
argument gives us all the VMs, including theDomain-0
, and their states:2. The
vcpuinfo
command can be used for VM with ID 4:3. We can get the version information using the
version
argument, as shown in the following screenshot:4. To get the information of the node or the Oracle VM Server, we use the
nodeinfo
argument: