on  It Road.com

配置xendomains

xendomains 服务的行为由 /etc/sysconfig/xendomains 文件控制。
这个注释良好的文件控制服务如何管理 domU 客户端。
下面是一个示例配置文件:

## Path: System/xen
## Description: xen domain start/stop on boot
## Type: string
## Default: 
#
# The xendomains script can send SysRq requests to domains on shutdown.
# If you don't want to MIGRATE, SAVE, or SHUTDOWN, this may be a possibility
# to do a quick and dirty shutdown ("s e i u o") or at least sync the disks
# of the domains ("s").
#
XENDOMAINS_SYSRQ=""
## Type: integer 
## Default: 100000
#
# If XENDOMAINS_SYSRQ is set, this variable determines how long to wait
# (in microseconds) after each SysRq, so the domain has a chance to react.
# If you want to a quick'n'dirty shutdown via SysRq, you may want to set
# it to a relatively high value (1200000).
#
XENDOMAINS_USLEEP=100000
## Type: integer
## Default: 5000000
#
# When creating a guest domain, it is sensible to allow a little time for it
# to get started before creating another domain or proceeding through the
# boot process. Without this, the booting guests will thrash the disk as they
# start up. This timeout (in microseconds) specifies the delay after guest
# domain creation.
#
XENDOMAINS_CREATE_USLEEP=5000000
## Type: string
## Default: ""
#
# Set this to a non-empty string if you want to migrate virtual machines
# on shutdown. The string will be passed to the xm migrate DOMID command
# as is: It should contain the target IP address of the physical machine
# to migrate to and optionally parameters like --live. Leave empty if
# you don't want to try virtual machine relocation on shutdown.
# If migration succeeds, neither SAVE nor SHUTDOWN will be executed for
# that domain.
#
XENDOMAINS_MIGRATE=""
## Type: string
## Default: /var/lib/xen/save
#
# Directory to save running domains to when the system (dom0) is
# shut down. Will also be used to restore domains from if # XENDOMAINS_RESTORE
# is set (see below). Leave empty to disable domain saving on shutdown 
# (e.g. because you rather shut domains down).
# If domain saving does succeed, SHUTDOWN will not be executed.
#
XENDOMAINS_SAVE=/var/lib/xen/save
## Type: string
## Default: "--halt --wait"
#
# If neither MIGRATE nor SAVE were enabled or if they failed, you can
# try to shut down a domain by sending it a shutdown request. To do this,
# set this to "--halt --wait". Omit the "--wait" flag to avoid waiting
# for the domain to be really down. Leave empty to skip domain shutdown.
#
XENDOMAINS_SHUTDOWN="--halt --wait"
## Type: string
## Default: "--all --halt --wait"
#
# After we have gone over all virtual machines (resp. all automatically
# started ones, see XENDOMAINS_AUTO_ONLY below) in a loop and sent SysRq,
# migrated, saved and/or shutdown according to the settings above, we
# might want to shutdown the virtual machines that are still running
# for some reason or another. To do this, set this variable to
# "--all --halt --wait", it will be passed to xm shutdown.
# Leave it empty not to do anything special here.
# (Note: This will hit all virtual machines, even if XENDOMAINS_AUTO_ONLY
# is set.)
# 
XENDOMAINS_SHUTDOWN_ALL="--all --halt --wait"
## Type: boolean
## Default: true
#
# This variable determines whether saved domains from XENDOMAINS_SAVE
# will be restored on system startup. 
#
XENDOMAINS_RESTORE=true
## Type: string
## Default: /etc/xen/auto
#
# This variable sets the directory where domains configurations
# are stored that should be started on system startup automatically.
# Leave empty if you don't want to start domains automatically
# (or just don't place any xen domain config files in that dir).
# Note that the script tries to be clever if both RESTORE and AUTO are 
# set: It will first restore saved domains and then only start domains
# in AUTO which are not running yet. 
# Note that the name matching is somewhat fuzzy.
#
XENDOMAINS_AUTO=/etc/xen/auto
## Type: boolean
## Default: false
# 
# If this variable is set to "true", only the domains started via config 
# files in XENDOMAINS_AUTO will be treated according to XENDOMAINS_SYSRQ,
# XENDOMAINS_MIGRATE, XENDOMAINS_SAVE, XENDMAINS_SHUTDOWN; otherwise
# all running domains will be. 
# Note that the name matching is somewhat fuzzy.
# 
XENDOMAINS_AUTO_ONLY=false
## Type: integer
## Default: 300
#
# On xendomains stop, a number of xm commands (xm migrate, save, shutdown,
# shutdown --all) may be executed. In the worst case, these commands may
# stall forever, which will prevent a successful shutdown of the machine.
# If this variable is non-zero, the script will set up a watchdog timer
# for every of these xm commands and time it out after the number of seconds
# specified by this variable.
# Note that SHUTDOWN_ALL will not be called if no virtual machines or only
# zombies are still running, so you don't need to enable this timeout just
# for the zombie case.
# The setting should be large enough to make sure that migrate/save/shutdown
# can succeed. If you do live migrations, keep in mind that live migration
# of a 1GB machine over Gigabit ethernet may actually take something like
# 100s (assuming that live migration uses 10% of the network # bandwidth).
# Depending on the virtual machine, a shutdown may also require a significant
# amount of time. So better setup this variable to a huge number and hope the
# watchdog never fires.
#
XENDOMAINS_STOP_MAXWAIT=300
Linux 操作系统“xendomains”服务

当 Oracle VM 服务器 (dom0) 启动或者关闭时,xendomains 服务会自动启动、停止和迁移 Oracle VM 客户端 (domU)。
本质上,xendomains 服务会自动发出一系列 xm 命令,以确保在 dom0 服务器启动或者停止时启动和停止正确的 Oracle VM 客户端。
xendomains 服务不控制守护进程或者其他后台进程;只有 dom0 客户端虚拟机。

作为 Oracle VM Server 产品的一部分,xendomains 服务作为 xen-tools RPM 包的一部分提供,通常作为 Oracle VM Server 产品的一部分安装。

在 dom0 系统启动期间,将启动 xend 服务(在别处描述)。
此后不久将运行 xendomains 服务。
任何 domU 客户端的状态在较早的关闭时被保存,都由 /etc/init.d/xendomains 脚本启动。
然后任何标记为自动启动的 domU 客户端也会启动。
完成此操作后,xendomains 服务将终止。

为了防止尝试运行

# service xendomains start

命令多次并因此可能运行 domU 客户端的多个实例,xendomains 脚本维护锁定文件 /var/lock/subsys/xendomains 文件,这是 Linux 服务中的常见做法。
如果此锁文件存在,则服务无法再次启动;如果没有启动虚拟客户端,则不会创建此锁定文件。

在 dom0 系统关闭期间,在 xend 服务终止之前,将再次运行 xendomains 服务以处理任何仍在运行的 domU 客户端。
客户端关闭分为多个步骤:

步骤必需的?描述
Select是的管理所有 domU 域或者仅管理标记为 AUTO 的域
SysRQ可选的客户端域可以选择通过向虚拟机发出 Alt-SysRQ 魔术键来控制。
Migrate可选的在 Alt-SysRQ 击键后仍在运行的客户端域可以使用 "xm migrate" 迁移到另一个正在运行的 dom0 主机;命令。
Save可选的发出 "xm save"命令到迁移步骤后仍在本地运行的任何客户端域。
Shutdown是的发出 "xm shutdown"命令优雅地终止任何仍在本地运行的虚拟客户端。
Cleanup是的删除服务锁定文件。

这是一项服务,在系统启动时运行一次以启动选定的 Oracle VM 客户端机器,并在系统关闭之前运行一次以迁移、保存或者关闭所有正在运行的 Oracle VM 客户端机器。

服务控制

要在下次系统启动时自动运行 xendomains 服务,请使用以下命令:

# chkconfig xendomains on
# chkconfig --list xendomains
xendomains   0:off  1:off  2:off  3:on   4:on   5:on   6:off

要手动调用 xendomains 服务,请使用命令:

# service xendomains help
Usage: /etc/init.d/xendomains  {start|stop|restart|reload|status}

每个功能的详细信息总结如下:

命令描述
start恢复所有已保存的 domU 客户端。启动标记为 AUTO 的 domU 客户端。
stop使用前面描述的方法关闭所有正在运行的客户端虚拟机。
restart相当于停止/开始序列。
reload相当于重启命令。
status显示当前运行的虚拟客户端域的列表。如果没有,则返回退出代码 3。
日期:2020-09-17 00:14:39 来源:oir作者:oir