* Add Xen's udev rules. This is necessary to get automatically
created block and network devices to work. svn path=/nixos/trunk/; revision=23823
This commit is contained in:
parent
82f97b5fb2
commit
0442e7e82a
@ -4,7 +4,20 @@
|
|||||||
|
|
||||||
with pkgs.lib;
|
with pkgs.lib;
|
||||||
|
|
||||||
let cfg = config.virtualisation.xen; in
|
let
|
||||||
|
|
||||||
|
cfg = config.virtualisation.xen;
|
||||||
|
|
||||||
|
xen = pkgs.xen;
|
||||||
|
|
||||||
|
xendConfig = pkgs.writeText "xend-config.sxp"
|
||||||
|
''
|
||||||
|
(loglevel DEBUG)
|
||||||
|
(network-script network-bridge)
|
||||||
|
(vif-script vif-bridge)
|
||||||
|
'';
|
||||||
|
|
||||||
|
in
|
||||||
|
|
||||||
{
|
{
|
||||||
###### interface
|
###### interface
|
||||||
@ -52,12 +65,12 @@ let cfg = config.virtualisation.xen; in
|
|||||||
|
|
||||||
config = mkIf cfg.enable {
|
config = mkIf cfg.enable {
|
||||||
|
|
||||||
environment.systemPackages = [ pkgs.xen ];
|
environment.systemPackages = [ xen ];
|
||||||
|
|
||||||
# Domain 0 requires a pvops-enabled kernel.
|
# Domain 0 requires a pvops-enabled kernel.
|
||||||
boot.kernelPackages = pkgs.linuxPackages_2_6_32_xen;
|
boot.kernelPackages = pkgs.linuxPackages_2_6_32_xen;
|
||||||
|
|
||||||
boot.kernelModules = [ "xen_evtchn" "xen_gntdev" ];
|
boot.kernelModules = [ "xen_evtchn" "xen_gntdev" "xen_blkback" "xen_netback" "xen_pciback" "blktap" ];
|
||||||
|
|
||||||
# The radeonfb kernel module causes the screen to go black as soon
|
# The radeonfb kernel module causes the screen to go black as soon
|
||||||
# as it's loaded, so don't load it.
|
# as it's loaded, so don't load it.
|
||||||
@ -69,7 +82,7 @@ let cfg = config.virtualisation.xen; in
|
|||||||
|
|
||||||
system.extraSystemBuilderCmds =
|
system.extraSystemBuilderCmds =
|
||||||
''
|
''
|
||||||
ln -s ${pkgs.xen}/boot/xen.gz $out/xen.gz
|
ln -s ${xen}/boot/xen.gz $out/xen.gz
|
||||||
echo "${toString cfg.bootParams}" > $out/xen-params
|
echo "${toString cfg.bootParams}" > $out/xen-params
|
||||||
'';
|
'';
|
||||||
|
|
||||||
@ -89,12 +102,12 @@ let cfg = config.virtualisation.xen; in
|
|||||||
|
|
||||||
path =
|
path =
|
||||||
[ pkgs.bridge_utils pkgs.gawk pkgs.iproute pkgs.nettools
|
[ pkgs.bridge_utils pkgs.gawk pkgs.iproute pkgs.nettools
|
||||||
pkgs.utillinux pkgs.bash pkgs.xen pkgs.pciutils pkgs.procps
|
pkgs.utillinux pkgs.bash xen pkgs.pciutils pkgs.procps
|
||||||
];
|
];
|
||||||
|
|
||||||
preStart = "${pkgs.xen}/sbin/xend start";
|
preStart = "${xen}/sbin/xend start";
|
||||||
|
|
||||||
postStop = "${pkgs.xen}/sbin/xend stop";
|
postStop = "${xen}/sbin/xend stop";
|
||||||
};
|
};
|
||||||
|
|
||||||
# To prevent a race between dhclient and xend's bridge setup
|
# To prevent a race between dhclient and xend's bridge setup
|
||||||
@ -102,6 +115,20 @@ let cfg = config.virtualisation.xen; in
|
|||||||
# virtual device), start dhclient after xend.
|
# virtual device), start dhclient after xend.
|
||||||
jobs.dhclient.startOn = mkOverride 50 "started xend";
|
jobs.dhclient.startOn = mkOverride 50 "started xend";
|
||||||
|
|
||||||
|
environment.etc =
|
||||||
|
[ { source = xendConfig;
|
||||||
|
target = "xen/xend-config.sxp";
|
||||||
|
}
|
||||||
|
{ source = "${xen}/etc/xen/scripts";
|
||||||
|
target = "xen/scripts";
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
|
# Xen provides udev rules.
|
||||||
|
services.udev.packages = [ xen ];
|
||||||
|
|
||||||
|
services.udev.path = [ pkgs.bridge_utils pkgs.iproute ];
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user