diff options
author | Eelco Dolstra <eelco.dolstra@logicblox.com> | 2010-10-06 16:07:16 +0000 |
---|---|---|
committer | Eelco Dolstra <eelco.dolstra@logicblox.com> | 2010-10-06 16:07:16 +0000 |
commit | cda2e41c017f68f0f4a522d8c5b039ec86e05b92 (patch) | |
tree | dd0da8d5f309fcba65f34270b0ae19f20dc83f4a /modules/virtualisation/xen-dom0.nix | |
parent | 102a1e15ba050cf9e3440b1671ce9772c31f3aef (diff) | |
download | nixpkgs-cda2e41c017f68f0f4a522d8c5b039ec86e05b92.tar nixpkgs-cda2e41c017f68f0f4a522d8c5b039ec86e05b92.tar.gz nixpkgs-cda2e41c017f68f0f4a522d8c5b039ec86e05b92.tar.bz2 nixpkgs-cda2e41c017f68f0f4a522d8c5b039ec86e05b92.tar.lz nixpkgs-cda2e41c017f68f0f4a522d8c5b039ec86e05b92.tar.xz nixpkgs-cda2e41c017f68f0f4a522d8c5b039ec86e05b92.tar.zst nixpkgs-cda2e41c017f68f0f4a522d8c5b039ec86e05b92.zip |
* 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
Diffstat (limited to 'modules/virtualisation/xen-dom0.nix')
-rw-r--r-- | modules/virtualisation/xen-dom0.nix | 30 |
1 files changed, 29 insertions, 1 deletions
diff --git a/modules/virtualisation/xen-dom0.nix b/modules/virtualisation/xen-dom0.nix index 65158bc5f81..e10713466f7 100644 --- a/modules/virtualisation/xen-dom0.nix +++ b/modules/virtualisation/xen-dom0.nix @@ -108,11 +108,39 @@ in 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"; }; + 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 # script (which renames eth* to peth* and recreates eth* as a # virtual device), start dhclient after xend. |