Home > Articles > Operating Systems, Server

The Xen Hypervisor

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')

InformIT Promotional Mailings & Special Offers

I would like to receive exclusive offers and hear about products from InformIT and its family of brands. I can unsubscribe at any time.

Overview


Pearson Education, Inc., 221 River Street, Hoboken, New Jersey 07030, (Pearson) presents this site to provide information about products and services that can be purchased through this site.

This privacy notice provides an overview of our commitment to privacy and describes how we collect, protect, use and share personal information collected through this site. Please note that other Pearson websites and online products and services have their own separate privacy policies.

Collection and Use of Information


To conduct business and deliver products and services, Pearson collects and uses personal information in several ways in connection with this site, including:

Questions and Inquiries

For inquiries and questions, we collect the inquiry or question, together with name, contact details (email address, phone number and mailing address) and any other additional information voluntarily submitted to us through a Contact Us form or an email. We use this information to address the inquiry and respond to the question.

Online Store

For orders and purchases placed through our online store on this site, we collect order details, name, institution name and address (if applicable), email address, phone number, shipping and billing addresses, credit/debit card information, shipping options and any instructions. We use this information to complete transactions, fulfill orders, communicate with individuals placing orders or visiting the online store, and for related purposes.

Surveys

Pearson may offer opportunities to provide feedback or participate in surveys, including surveys evaluating Pearson products, services or sites. Participation is voluntary. Pearson collects information requested in the survey questions and uses the information to evaluate, support, maintain and improve products, services or sites, develop new products and services, conduct educational research and for other purposes specified in the survey.

Contests and Drawings

Occasionally, we may sponsor a contest or drawing. Participation is optional. Pearson collects name, contact information and other information specified on the entry form for the contest or drawing to conduct the contest or drawing. Pearson may collect additional personal information from the winners of a contest or drawing in order to award the prize and for tax reporting purposes, as required by law.

Newsletters

If you have elected to receive email newsletters or promotional mailings and special offers but want to unsubscribe, simply email information@informit.com.

Service Announcements

On rare occasions it is necessary to send out a strictly service related announcement. For instance, if our service is temporarily suspended for maintenance we might send users an email. Generally, users may not opt-out of these communications, though they can deactivate their account information. However, these communications are not promotional in nature.

Customer Service

We communicate with users on a regular basis to provide requested services and in regard to issues relating to their account we reply via email or phone in accordance with the users' wishes when a user submits their information through our Contact Us form.

Other Collection and Use of Information


Application and System Logs

Pearson automatically collects log data to help ensure the delivery, availability and security of this site. Log data may include technical information about how a user or visitor connected to this site, such as browser type, type of computer/device, operating system, internet service provider and IP address. We use this information for support purposes and to monitor the health of the site, identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents and appropriately scale computing resources.

Web Analytics

Pearson may use third party web trend analytical services, including Google Analytics, to collect visitor information, such as IP addresses, browser types, referring pages, pages visited and time spent on a particular site. While these analytical services collect and report information on an anonymous basis, they may use cookies to gather web trend information. The information gathered may enable Pearson (but not the third party web trend services) to link information with application and system log data. Pearson uses this information for system administration and to identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents, appropriately scale computing resources and otherwise support and deliver this site and its services.

Cookies and Related Technologies

This site uses cookies and similar technologies to personalize content, measure traffic patterns, control security, track use and access of information on this site, and provide interest-based messages and advertising. Users can manage and block the use of cookies through their browser. Disabling or blocking certain cookies may limit the functionality of this site.

Do Not Track

This site currently does not respond to Do Not Track signals.

Security


Pearson uses appropriate physical, administrative and technical security measures to protect personal information from unauthorized access, use and disclosure.

Children


This site is not directed to children under the age of 13.

Marketing


Pearson may send or direct marketing communications to users, provided that

  • Pearson will not use personal information collected or processed as a K-12 school service provider for the purpose of directed or targeted advertising.
  • Such marketing is consistent with applicable law and Pearson's legal obligations.
  • Pearson will not knowingly direct or send marketing communications to an individual who has expressed a preference not to receive marketing.
  • Where required by applicable law, express or implied consent to marketing exists and has not been withdrawn.

Pearson may provide personal information to a third party service provider on a restricted basis to provide marketing solely on behalf of Pearson or an affiliate or customer for whom Pearson is a service provider. Marketing preferences may be changed at any time.

Correcting/Updating Personal Information


If a user's personally identifiable information changes (such as your postal address or email address), we provide a way to correct or update that user's personal data provided to us. This can be done on the Account page. If a user no longer desires our service and desires to delete his or her account, please contact us at customer-service@informit.com and we will process the deletion of a user's account.

Choice/Opt-out


Users can always make an informed choice as to whether they should proceed with certain services offered by InformIT. If you choose to remove yourself from our mailing list(s) simply visit the following page and uncheck any communication you no longer want to receive: www.informit.com/u.aspx.

Sale of Personal Information


Pearson does not rent or sell personal information in exchange for any payment of money.

While Pearson does not sell personal information, as defined in Nevada law, Nevada residents may email a request for no sale of their personal information to NevadaDesignatedRequest@pearson.com.

Supplemental Privacy Statement for California Residents


California residents should read our Supplemental privacy statement for California residents in conjunction with this Privacy Notice. The Supplemental privacy statement for California residents explains Pearson's commitment to comply with California law and applies to personal information of California residents collected in connection with this site and the Services.

Sharing and Disclosure


Pearson may disclose personal information, as follows:

  • As required by law.
  • With the consent of the individual (or their parent, if the individual is a minor)
  • In response to a subpoena, court order or legal process, to the extent permitted or required by law
  • To protect the security and safety of individuals, data, assets and systems, consistent with applicable law
  • In connection the sale, joint venture or other transfer of some or all of its company or assets, subject to the provisions of this Privacy Notice
  • To investigate or address actual or suspected fraud or other illegal activities
  • To exercise its legal rights, including enforcement of the Terms of Use for this site or another contract
  • To affiliated Pearson companies and other companies and organizations who perform work for Pearson and are obligated to protect the privacy of personal information consistent with this Privacy Notice
  • To a school, organization, company or government agency, where Pearson collects or processes the personal information in a school setting or on behalf of such organization, company or government agency.

Links


This web site contains links to other sites. Please be aware that we are not responsible for the privacy practices of such other sites. We encourage our users to be aware when they leave our site and to read the privacy statements of each and every web site that collects Personal Information. This privacy statement applies solely to information collected by this web site.

Requests and Contact


Please contact us about this Privacy Notice or if you have any requests or questions relating to the privacy of your personal information.

Changes to this Privacy Notice


We may revise this Privacy Notice through an updated posting. We will identify the effective date of the revision in the posting. Often, updates are made to provide greater clarity or to comply with changes in regulatory requirements. If the updates involve material changes to the collection, protection, use or disclosure of Personal Information, Pearson will provide notice of the change through a conspicuous notice on this site or other appropriate way. Continued use of the site after the effective date of a posted revision evidences acceptance. Please contact us if you have questions or concerns about the Privacy Notice or any objection to any revisions.

Last Update: November 17, 2020