libvirtd: add onBoot option
This adds a new ``onBoot`` option that allows specifying the action taken on guests when the host boots. Specifying "start" ensures all guests that were running prior to shutdown are started, regardless of their autostart settings. Specifying "ignore" will make libvirtd ignore such guests. Any guest marked as autostart will still be automatically started by libvirtd.
This commit is contained in:
parent
a4083fb455
commit
d20022018e
@ -104,6 +104,18 @@ in {
|
||||
'';
|
||||
};
|
||||
|
||||
onBoot = mkOption {
|
||||
type = types.enum ["start" "ignore" ];
|
||||
default = "start";
|
||||
description = ''
|
||||
Specifies the action to be done to / on the guests when the host boots.
|
||||
The "start" option starts all guests that were running prior to shutdown
|
||||
regardless of their autostart settings. The "ignore" option will not
|
||||
start the formally running guest on boot. However, any guest marked as
|
||||
autostart will still be automatically started by libvirtd.
|
||||
'';
|
||||
};
|
||||
|
||||
onShutdown = mkOption {
|
||||
type = types.enum ["shutdown" "suspend" ];
|
||||
default = "suspend";
|
||||
@ -221,6 +233,7 @@ in {
|
||||
path = with pkgs; [ coreutils libvirt gawk ];
|
||||
restartIfChanged = false;
|
||||
|
||||
environment.ON_BOOT = "${cfg.onBoot}";
|
||||
environment.ON_SHUTDOWN = "${cfg.onShutdown}";
|
||||
};
|
||||
|
||||
|
@ -129,6 +129,7 @@ in stdenv.mkDerivation rec {
|
||||
binPath = [ iptables iproute pmutils numad numactl bridge-utils dmidecode dnsmasq ebtables ] ++ optionals enableIscsi [ openiscsi ];
|
||||
in ''
|
||||
substituteInPlace $out/libexec/libvirt-guests.sh \
|
||||
--replace 'ON_BOOT=start' 'ON_BOOT=''${ON_BOOT:-start}' \
|
||||
--replace 'ON_SHUTDOWN=suspend' 'ON_SHUTDOWN=''${ON_SHUTDOWN:-suspend}' \
|
||||
--replace "$out/bin" '${gettext}/bin' \
|
||||
--replace 'lock/subsys' 'lock' \
|
||||
|
Loading…
Reference in New Issue
Block a user