mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-01 23:22:37 +00:00
* Added a "xendomains" job to automatically start the domains defined
in /etc/xen/auto at boot time, to save all running domains during shutdown, and to restore all saved domains at boot time. svn path=/nixos/trunk/; revision=24121
This commit is contained in:
parent
102a1e15ba
commit
cda2e41c01
@ -110,7 +110,11 @@ EOF
|
|||||||
# forget about current sessions.
|
# forget about current sessions.
|
||||||
# Idem for the emergeny-shell, because its `console owner'
|
# Idem for the emergeny-shell, because its `console owner'
|
||||||
# line screws up the X server.
|
# line screws up the X server.
|
||||||
if echo "$job" | grep -q "^shutdown$\|^control-alt-delete$\|^xserver$\|^dbus$\|^disnix$\|^emergency-shell$"; then continue; fi
|
# Idem for xendomains because we don't want to save/restore
|
||||||
|
# Xen domains unless we have to.
|
||||||
|
# TODO: Jobs should be able to declare that they should not be
|
||||||
|
# auto-restarted.
|
||||||
|
if echo "$job" | grep -q "^shutdown$\|^control-alt-delete$\|^xserver$\|^dbus$\|^disnix$\|^emergency-shell$\|^xendomains$"; then continue; fi
|
||||||
|
|
||||||
if ! test -e "$oldJobs/$job.conf"; then
|
if ! test -e "$oldJobs/$job.conf"; then
|
||||||
echo "starting $job..."
|
echo "starting $job..."
|
||||||
|
@ -108,11 +108,39 @@ in
|
|||||||
pkgs.utillinux pkgs.bash xen pkgs.pciutils pkgs.procps
|
pkgs.utillinux pkgs.bash xen pkgs.pciutils pkgs.procps
|
||||||
];
|
];
|
||||||
|
|
||||||
preStart = "${xen}/sbin/xend start";
|
preStart =
|
||||||
|
''
|
||||||
|
${xen}/sbin/xend start
|
||||||
|
|
||||||
|
# Wait until Xend is running.
|
||||||
|
for ((i = 0; i < 60; i++)); do echo "waiting for xend..."; ${xen}/sbin/xend status && break; done
|
||||||
|
|
||||||
|
${xen}/sbin/xend status || exit 1
|
||||||
|
'';
|
||||||
|
|
||||||
postStop = "${xen}/sbin/xend stop";
|
postStop = "${xen}/sbin/xend stop";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
jobs.xendomains =
|
||||||
|
{ description = "Automatically starts, saves and restores Xen domains on startup/shutdown";
|
||||||
|
|
||||||
|
startOn = "started xend";
|
||||||
|
|
||||||
|
stopOn = "starting shutdown and stopping xend";
|
||||||
|
|
||||||
|
path = [ pkgs.xen ];
|
||||||
|
|
||||||
|
environment.XENDOM_CONFIG = "${xen}/etc/sysconfig/xendomains";
|
||||||
|
|
||||||
|
preStart =
|
||||||
|
''
|
||||||
|
mkdir -p /var/lock/subsys -m 755
|
||||||
|
${xen}/etc/init.d/xendomains start
|
||||||
|
'';
|
||||||
|
|
||||||
|
postStop = "${xen}/etc/init.d/xendomains stop";
|
||||||
|
};
|
||||||
|
|
||||||
# To prevent a race between dhclient and xend's bridge setup
|
# To prevent a race between dhclient and xend's bridge setup
|
||||||
# script (which renames eth* to peth* and recreates eth* as a
|
# script (which renames eth* to peth* and recreates eth* as a
|
||||||
# virtual device), start dhclient after xend.
|
# virtual device), start dhclient after xend.
|
||||||
|
Loading…
Reference in New Issue
Block a user