Manage Learn to apply best practices and optimize your operations.

Managing a XenServer environment with the Xen command line

The Xen command line offers options such as the xe command to perform difficult tasks in a XenServer environment, but the XenCenter interface may work best for easy tasks.

Solution provider takeaway: Get a solid grasp of the different commands available in the Xen command line to manage the Xen environment for your customers. Learn how to use the xe command for complicated tasks.

XenCenter offers an intuitive interface to manage basic tasks in the XenServer environment for your customers. But for more advanced tasks, you may be best served working from the command line interface. You can access all the command line has to offer on the server console or from the Console tab in XenCenter.

XenServer runs on top of Linux, so you can access its powerful command line interface from the XenServer Console. Look for the menu interface on the console and start the interface by running the xsconsole command.

Although the menu interface allows you to perform some of the same tasks from the XenCenter menu, other features are more accessible from the XenServer Console. Enabling remote access to your server is easier from the xsconsole than from the XenCenter GUI. But to get access to the full power of your customer's XenServer environment, you need a pure command shell that you can access by choosing the Local Command Shell option from the xsconsole menu or by clicking the Console tab in the XenCenter interface.

Figure 1: The Console tab from the XenCenter interface allows access to the command shell on the XenServer host.

The Xen execute (xe) command is part of the command line and is an asset to solution providers because it helps them with tough tasks, such as suspending or rebooting virtual machines (VMs). But before using the xe command, analyze your customer's environment and determine which methods fit best for task management.

Taking advantage of the xe command from the Xen command line

Once you're on the command shell, you can use the xe command to manage your server. There are also specific Linux commands to help you manage Linux-specific items on the console.

The xe command may be the best choice because it gives you greater freedom to accomplish tasks in virtual environments. The xe command can execute on local and remote servers. If you're administrators new to xe, the number of options can be intimidating. But find the most efficient method to work with this command and exactly what you can do with it in the most reasonable amount of time.

Xe help gives you an overview of all the common commands, including the xe vm-list command, which displays a list of virtual machines. By default, xe help displays only the most commonly used options, but you can see a full list of all the commands available from the xe interface by using xe help -- all. There are a lot of options and the list doesn't fit on one screen, but you can see all of them using xe help --all | less. This sends the output of the command through the less command, where you can see all six pages of command output page by page.

Figure 2: Use xe help --all | less to see all of the available xe commands.

Connecting Xen commands and tasks

The next challenge is to find the command that is most relevant for the task you want to accomplish. It's important to know that there are a couple of commands that relate to management of the host. Both of them start with host. The command names that start with vm are used to manage the virtual machines. And there are other command names that relate to the kinds of tasks you want to perform.

The built-in help will assist you with learning how to use a command after you've found it. For example, the master command for adding a disk is vm-disk-add. Help vm-disk-add will show you how to use it.

The output of this command consists of two parts: First, you'll see a list of required and additional parameters. Then, you'll see a description of how to perform this task. The same procedure applies for every command available in the xe command line interface.

The xe command was not developed to be user-friendly. Although you will find a list of all the available parameters and a description of ways to use them, you will still need to have a strong understanding of these commands -- as well as their configuration and the setup -- to take full advantage of them.

For these reasons, the xe command is not the best way to begin setting up a XenServer environment. It's easier to start by creating your customer's environment in XenCenter. Then you can accomplish additional tasks from the xsconsole interface that runs on your server. Remember: The only time using the xe command is appropriate is when you can't accomplish tasks from these interfaces.

The easiest approach to managing a XenServer environment is to set up your customer's environment using the XenCenter interface, which was developed to make managing multiple XenServers simpler. If you can't get tasks done from this interface, use the xsconsole interface on the XenServer itself. But be mindful that the xsconsole interface wasn't designed to manage all servers from the same interface.

To accomplish some advanced tasks, you can use the xe command. However, even though xe command comes with great built-in resources, it is difficult to use. So don't make it the default way of managing your XenServer environment.

About the expert
Sander van Vugt is an independent trainer and consultant living in the Netherlands. Van Vugt is an expert in Linux high availability, virtualization and performance and has completed several projects that implement all three. He is also the writer of various Linux-related books, such as
Beginning the Linux Command Line, Beginning Ubuntu Server Administration and Pro Ubuntu Server Administration.

This was last published in September 2010

Dig Deeper on Virtualization Technology and Services



Find more PRO+ content and other member only offers, here.

Start the conversation

Send me notifications when other members comment.

By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Please create a username to comment.