Libvirt与Xen无法正确启动Ubuntu 14.04

此刻我真的有点无奈:

我试图用Xen和libvirt来设置Ubuntu 14.04进行pipe理。 我创build了一个虚拟机,但我没有自动启动(尽pipeautostart被选中)。 如果我做了一个“停止libvirt-bin”和“启动libvirt-bin”,虚拟机启动完美。

在我看来有点奇怪的是,libvirt-bin在Xen守护进程之前就开始了。

Boot.log:

* Starting configure network device security [ OK ] * Starting configure network device [ OK ] * Starting libvirt daemon [ OK ] * Starting Xen daemons [ OK ] 

作为一种解决方法,我把启动/停止命令添加到rc.local

任何想法呢? 起始顺序是否正确?

下面是我的解决scheme,您对xen需要在libvirt-bin之前运行是正确的。 对我来说问题是,xen正在使用systemV和libvirt-bin使用暴发户。 经过多次辩论,我决定我必须与其中一个去。

我想确保我没有碰到实际提供的脚本,因为它们可能会不时更新,我想确保安全的启动和closures仍然会实现。

暴发户赢了。 – 首先使用以下命令禁用Boot上的XEN SystemV脚本

 sudo update-rc.d xen disable sudo update-rc.d xendomains disable 

然后编辑/etc/init/libvirt-bin.conf并用exec /etc/init.d/xen start修改预启动 。 它只在启动时启动一次,任何前面重新启动的服务将只勾选一个“服务已经运行”的响应。

下面的例子

 description "libvirt daemon" author "Dustin Kirkland <[email protected]>" start on runlevel [2345] stop on starting rc RUNLEVEL=[016] expect daemon respawn # daemonize env libvirtd_opts="-d" # whether libvirtd should run at boot/shutdown env start_libvirtd="yes" # by default wait 30 seconds for vms to shut down env libvirtd_shutdown_timeout=30 # uris for which to shut down vms env libvirt_uris='qemu:///system lxc:///' pre-start script [ -r /etc/default/libvirt-bin ] && . /etc/default/libvirt-bin [ ! "x$start_libvirtd" = "xyes" ] && { stop; exit 0; } mkdir -p /var/run/libvirt # Clean up a pidfile that might be left around rm -f /var/run/libvirtd.pid # ----------------------------------- exec /etc/init.d/xen start # ----------------------------------- end script pre-stop script [ -r /etc/default/libvirt-bin ] && . /etc/default/libvirt-bin log_msg() { logf="/var/log/libvirt/shutdownlog.log" logger -p daemon.debug -s -t libvirt -- "$@" >> $logf 2>&1 } run_virsh() { # We parse the output for things like domain state; # make sure the output is in the language we expect. LANG=C virsh "$@" } if [ -z "$RUNLEVEL" ]; then exit 0 fi if [ "$RUNLEVEL" -ne 0 ] && [ "$RUNLEVEL" -ne 1 ] && [ "$RUNLEVEL" -ne 6 ]; then exit 0 fi log_msg "libvirt-bin: entering pre-stop at $(date)" for uri in $libvirt_uris; do for domain in $(run_virsh -c "$uri" list | awk '$3 == "running" {print $2}'); do log_msg "libvirt-bin: attempting clean shutdown of $domain at $(date)" run_virsh -c "$uri" shutdown "$domain" >/dev/null done done delay=$libvirtd_shutdown_timeout while [ $delay -gt 0 ]; do for uri in $libvirt_uris; do if ! run_virsh -c "$uri" list | awk '$3 == "running" {exit 1}'; then # VMs at this URI are still running. Wait, then # start at the beginning looking for running VMs. sleep 1 delay=$(($delay - 1)) continue 2 fi done break done for uri in $libvirt_uris; do for domain in $(run_virsh -c "$uri" list | awk '$3 == "running" {print $2}'); do log_msg "destroying $domain" run_virsh -c "$uri" destroy "$domain" >/dev/null done done log_msg "libvirt-bin: exiting pre-stop at $(date)" end script # /etc/default/libvirt-bin will be deprecated soon. # If you used to set $libvirtd_opts in /etc/default/libvirt-bin, # change the 'exec' line here instead. script [ -r /etc/default/libvirt-bin ] && . /etc/default/libvirt-bin exec /usr/sbin/libvirtd $libvirtd_opts end script 

而已。 重新启动你的服务器,你应该运行。

希望有所帮助,或者至less让你在正确的方向。