Home > Articles > Operating Systems, Server

  • Print
  • + Share This
This chapter is from the book

xend

xend, the Xen Daemon, is a special process that runs as root in Domain0. It is a critical part of every Xen system. Users typically interface with xend via the Xen Management (xm) commands. xm commands to start, stop, and manage guest domains actually send requests to the xend daemon first, which are in turn relayed to the Xen hypervisor via a hypercall.

xend and xm are actually both Python applications. The xend daemon listens for requests on an open network port. The xm commands typically send requests to the listening xend daemon on the same machine, but features such as live migration involve sending requests to a xend daemon running on another machine.

xm is in the user interface. xend handles the validation and sequencing of requests from multiple sources. The Xen hypervisor actually carries out the requests.

Controlling xend

The start argument to the xend daemon is used to start xend if it is not already running. No output is produced by this command.

[root@dom0]# xend start

The stop argument to the xend daemon is used to stop an instance of xend that is currently running.

[root@dom0]# xend stop

When the restart argument is used, if an instance of the xend daemon is currently running it will be restarted. If an instance of the xend daemon is not currently running, one will be started. xend restart is often used when changes have been made in its configuration file.

[root@dom0]# xend restart

After you have started xend, you can use the ps command to list running processes and verify that it is running. You actually see a number of Xen related processes/daemons in a typical ps listing. Listing 3.4 includes portions of the ps output from the Xen LiveCD. In this listing, xend is actually listed as python /usr/sbin/xend start because in the automated script that started xend, that is the command line used. Interestingly, there appear to be two copies of xend started by the LiveCD. You can also see the Xen Console daemon (xenconsoled) and the XenStore daemon (xenstored). In addition, you see xenwatch, a utility to monitor Xen domains, and XenBus, a per-guest driver that provides an API for interactions with XenStore. We discuss XenStore in more detail later in this section.

Listing 3.4. List of Xen-Related Running Processes

USER  PID %CPU %MEM VSZ   RSS TTY  STAT START   TIME COMMAND
root     8 0.0  0.0     0     0 ?   S<   13:36   0:00 [xenwatch]
root     9 0.0  0.0     0     0 ?   S<   13:36   0:00 [xenbus]
root  3869 0.1  0.0  1988   924 ?   S    13:37   0:00 xenstored --pid-file /var/run/xenstore.pid
root  3874 0.0  0.3  8688  4040 ?   S    13:37   0:00 python /usr/sbin/xend start
root  3875 0.0  0.4  49860 5024 ?   Sl   13:37   0:00 python /usr/sbin/xend start
root  3877 0.0  0.0  10028  464 ?   Sl   13:37   0:00 xenconsoled

It is good to be aware of the other Xen-related daemons running on the system. For example, if an attempt to stop or restart the xend daemon fails, it may also be necessary to kill all instances of the XenStore daemon and the XenConsole daemon and sometimes even remove the contents of the xenstored directory.

[root@dom0]#killall xenstored xenconsoled


[root@dom0]#rm -rf /var/lib/xenstored/*

While xend is running, it can be useful to query its current condition by using the status argument.

[root@dom0]#xend status

xend Logs

xend produces a number of logs as it runs. These logs are another important way to gain insight into the status of a running xend instance. The logs are typically kept in /var/log or /var/log/xen.

xend sends its runtime log output to a rotating log file called xend.log. As log files grow too large, they are moved to xend.log.1, xend.log.2, and so forth, until deleted. Similarly, xend logs events (less frequently) to xend-debug.log. If tracing is enabled, xend logs function calls and exceptions to xend.trace.

Listing 3.5 contains a short snippet from xend.log from the Xen LiveCD to illustrate the output. Notice the time and date stamp at the beginning of each log record. Notice also the INFO, DEBUG, and WARNING flags used to indicate the severity of the issue being reported.

Consulting these logs is an important first step in diagnosing any problems you may be having configuring your Xen system. Often, a Web search for the string included in any error message helps you locate postings from others who have encountered and overcome a similar problem.

Listing 3.5. Sample xend.log

[2007-02-24 13:37:41 xend 3875] INFO (__init__:1072) Xend Daemon started
[2007-02-24 13:37:41 xend 3875] INFO (__init__:1072) Xend changeset: Mon Oct 16 11:38:12 2006 +0100 11777:a3bc5a7e738c
[2007-02-24 13:37:42 xend.XendDomainInfo 3875] DEBUG ) (__init__:1072)
XendDomainInfo.recreate({'paused':0, 'cpu_time':49070788642L, 'ssidref': 0, 'handle': [0,
 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], 'shutdown_reason': 0, 'dying': 0, 'dom': 0, 
'mem_kb': 1183912, 'maxmem_kb': -4, 'max_vcpu_id': 0, 'crashed': 0, 'running': 1,
     'shutdown':  0, 'online_vcpus': 1, 'blocked': 0})
[2007-02-24 13:37:42 xend.XendDomainInfo 3875] INFO (__init__:1072) Recreating domain 0,
 UUID 00000000-0000-0000-0000-000000000000.
[2007-02-24 13:37:42 xend.XendDomainInfo 3875] WARNING (__init__:1072) No vm path in store
 for existing domain 0
[2007-02-24 13:37:42 xend.XendDomainInfo 3875] DEBUG (__init__:1072) Storing VM details:
 {'shadow_memory': '0', 'uuid': '00000000-0000-0000-0000-000000000000', 'on_reboot':
 'restart', 'on_poweroff': 'destroy', 'name': 'Domain-0', 'xend/restart_count': '0',
 'vcpus': '1', 'vcpu_avail': '1', 'memory': '1157', 'on_crash': 'restart', 'maxmem': '1157'}
[2007-02-24 13:37:42 xend.XendDomainInfo 3875] DEBUG (__init__:1072) Storing domain
 details: {'cpu/0/availability': 'online', 'memory/target': '1184768', 'name': 'Domain-0',
 'console/limit': '1048576', 'vm': '/vm/00000000-0000-0000-0000-000000000000', 'domid': '0'}
[2007-02-24 13:37:42 xend 3875] DEBUG (__init__:1072) number of vcpus to use is 0

xend Configuration

xend has a configuration file, /etc/xen/xend-config.sxp, that can be used to control many aspects of its behavior. This file is consulted whenever xend is started or restarted. After making changes to these values, run xend restart to apply the changes. Table 3.4 summarizes xend's configuration options.

Table 3.4. xend Configuration Options

Option

Description

Possible Values

Default

Logging/Debugging

logfile

Used to change the location of xend's runtime log file.

Filename

/var/log/xen/xend.log

loglevel

Used to filter out logging messages below a specified level.

The five possible levels in order by severity are DEBUG, INFO, WARNING, ERROR, CRITICAL.

DEBUG.

This enables all logging.

enable-dump

Specifies whether core dumps of guest domains should be saved after a crash.

yes

no

no

Management Interfaces

xend-http-server

Specifies whether to start the HTTP management server.

yes

no

no

xend-port

Used to change the port used by the HTTP management server. Requires the xend-http-server option set to yes.

Port number (0 to 65535).

9000 would be another reasonable choice if it must be changed.

8000

xend-address

Specifies the address to which the http management server will bind. Requires the xend-http-server option set to yes.

IP address, localhost, or other network address designator. Specifying localhost prevents remote connections.

"(two single quotes)

This indicates all interfaces.

xend-unix-server

Specifies whether to start the UNIX domain socket management interface. This is required for the CLI tools to operate.

yes

no

yes

xend-unix-path

Used to change the location of the UNIX domain socket used to communicate with the management tools. Requires the xend-unix-server option set to yes.

Filename

/var/lib/xend/xend-socket

xend-tcp-xmlrpc-server

Specifies whether to start the TCP XML-RPC management interface.

yes

no

no

xend-unix-xmlrpc-server

Specifies whether to start the UNIX XML-RPC management interface.

yes

no

yes

xend-relocation-server

Specifies whether to start the relocation server. This is require for cross-machine live migrations. Relocation is not currently well-secured, so it is best left disabled unless needed.

yes

no

no

xend-relocation-port

Used to change the port used by the relocation server. Requires the xend-relocation-server option set to yes.

Port number (0 to 65535).

8002

xend-relocation-address

Specifies the address to which the relocation server will bind. Requires the xend-relocation-server option set to yes.

IP address, localhost, or other network address designator.

"(two single quotes)

This indicates all interfaces.

xend-relocation-hosts-allow

Specifies the hosts allowed to send requests to the relocation server.

Space separated sequence of regular expressions describing allowed hosts.

To be allowed, a host must match one of the listed expressions.

e.g., '^localhost$ ^.*\.foo\.org$'

"(two single quotes)

This indicates that connections from all hosts are allowed.

Be aware that spoofing of requests is possible so this is still relatively insecure.

external-migration-tool

Used to specify an application or script to handle external device migration.

/etc/xen/scripts/external-device-migrate

None

Domain0 Configuration

dom0-min-mem

If Domain0's memory can be reduced to free memory for other guests, this specifies the lowest memory level that Domain0 will ever reach in megabytes.

0-Physical Memory Size

If 0, Domain0's memory will never be allowed to be reduced.

None

dom0-cpus

Specifies the number of CPUs that Domain0 will be allowed to use.

0-Number of Physical CPUs

If 0, Domain0 may use all available CPUs.

None

Virtual Device Configuration and Limits

console-limit

Specifies the buffer limit enforced by the console server on each domain in kilobytes. Used to prevent a single domain from overwhelming the console server.

Reasonable buffer size >0

1024

network-script

Used to specify a file in /etc/xen/scripts containing a script to set up the networking environment.

Filename

Often network-bridge, network-route, and and network-nat

None

vif-script

Used to specify a file in /etc/xen/scripts containing a script to set up the virtual interface when it is created or destroyed.

Filename

Often vif-bridge vif-route, vif-nat, <customscript>

None

In the xend-config.sxp file, these options are listed one per line in the format, (OPTION SETTING). Individual lines may be commented out by beginning the line with a #. Listing 3.6 shows a sample xend-config.sxp file, similar to the one on the Xen LiveCD.

Listing 3.6. A Sample xend-config.sxp

#
# Xend configuration file with default configuration lines
# shown commented out.
#

#(logfile /var/log/xend.log)
#(loglevel DEBUG)
#(enable-dump no)

#(xend-http-server no)
#(xend-port            8000)
#(xend-address '')
# Or consider localhost to disable remote administration
#(xend-address localhost)

#(xend-unix-server no)
#(xend-unix-path /var/lib/xend/xend-socket)

#(xend-tcp-xmlrpc-server no)
#(xend-unix-xmlrpc-server yes)

#(xend-relocation-server no)
#(xend-relocation-port 8002)
#(xend-relocation-address '')
#(xend-relocation-hosts-allow '')
# Or consider restricting hosts that can connect
#(xend-relocation-hosts-allow '^localhost$ ^.*\.foo\.org$')


(dom0-min-mem 196)
(dom0-cpus 0)


#(console-limit 1024)

#(network-script network-bridge)
#(vif-script vif-bridge)


## Or consider routed or NAT options instead of bridged
#(network-script network-route)
#(vif-script     vif-route)
 (network-script 'network-nat dhcp=yes')
 (vif-script 'vif-nat dhcp=yes')
  • + Share This
  • 🔖 Save To Your Account