initial import

This commit is contained in:
2025-06-22 20:39:04 -05:00
commit f8a70886f0
3428 changed files with 302546 additions and 0 deletions

88
xen/xencommons.initd Normal file
View File

@@ -0,0 +1,88 @@
#!/sbin/openrc-run
# Copyright 2018 Hyperbola Project
# Distributed under the terms of the GNU General Public License v2
. /etc/xen/scripts/hotplugpath.sh
BACKEND_MODULES="xen-evtchn xen-gntdev xen-gntalloc xen-blkback xen-netback xen-pciback evtchn gntdev netbk blkbk xen-scsibk usbbk pciback xen-acpi-processor blktap2"
XENCONSOLED_PIDFILE=$XEN_RUN_DIR/xenconsoled.pid
QEMU_PIDFILE=$XEN_RUN_DIR/qemu-dom0.pid
description="Xencommons - start and stop xenstored and xenconsoled"
depend() {
after net
before libvirtd libvirt-guests
}
start_pre() {
shopt -s extglob
# not running in Xen dom0 or domU
if ! test -d /proc/xen ; then
exit 0
fi
# mount xenfs in dom0 or domU with a pv_ops kernel
if ! test -f /proc/xen/capabilities; then
mount -t xenfs xenfs /proc/xen
fi
# run this script only in dom0:
# no capabilities file in xenlinux domU kernel
# empty capabilities file in pv_ops domU kernel
if test -f /proc/xen/capabilities && \
! grep -q "control_d" /proc/xen/capabilities ; then
exit 0
fi
local mod
for mod in $BACKEND_MODULES; do
modprobe "$mod" &>/dev/null
done
mkdir -p $XEN_RUN_DIR
mkdir -p $XEN_LOCK_DIR
/etc/xen/scripts/launch-xenstore || exit 1
ebegin "Setting domain 0 name, domid and JSON config..."
$LIBEXEC_BIN/xen-init-dom0 &
eend $?
}
start() {
ebegin "Starting xenconsoled..."
test -z "$XENCONSOLED_TRACE" || XENCONSOLED_ARGS=" --log=$XENCONSOLED_TRACE"
$sbindir/xenconsoled --pid-file=$XENCONSOLED_PIDFILE $XENCONSOLED_ARGS &
eend $?
ebegin "Starting QEMU as disk backend for dom0"
test -z "$QEMU_XEN" && QEMU_XEN="$LIBEXEC_BIN/qemu-system-i386"
$QEMU_XEN -xen-domid 0 -xen-attach -name dom0 -nographic -M xenpv -daemonize \
-monitor /dev/null -serial /dev/null -parallel /dev/null \
-pidfile $QEMU_PIDFILE &
eend $?
}
stop() {
ebegin "Stopping xenconsoled"
if read 2>/dev/null <$XENCONSOLED_PIDFILE pid; then
kill $pid
while kill -9 $pid >/dev/null 2>&1; do sleep 1; done
rm -f $XENCONSOLED_PIDFILE
fi
eend $?
ebegin "Stopping QEMU"
if read 2>/dev/null <$QEMU_PIDFILE pid; then
kill $pid
while kill -9 $pid >/dev/null 2>&1; do sleep 1; done
rm -f $QEMU_PIDFILE
fi
eend $?
ebegin "WARNING: Not stopping xenstored, as it cannot be restarted"
eend $?
}