Merge pull request #555 from infernix/autostart

Support libvirt autostart functionality
This commit is contained in:
Dmitry Vasilets 2016-02-12 20:53:23 +01:00
commit ea3491b3d1
3 changed files with 11 additions and 0 deletions

View File

@ -216,6 +216,7 @@ end
* `tpm_model` - The model of the TPM to which you wish to connect.
* `tpm_type` - The type of TPM device to which you are connecting.
* `tpm_path` - The path to the TPM device on the host system.
* `autostart` - Automatically start the domain when the host boots. Defaults to 'false'.
Specific domain settings can be set for each domain separately in multi-VM

View File

@ -208,6 +208,8 @@ module VagrantPlugins
rescue => e
env[:ui].error("Error when updating domain settings: #{e.message}")
end
# Autostart with host if enabled in Vagrantfile
libvirt_domain.autostart = config.autostart
# Actually start the domain
domain.start
rescue => e

View File

@ -108,6 +108,9 @@ module VagrantPlugins
# Suspend mode
attr_accessor :suspend_mode
# Autostart
attr_accessor :autostart
def initialize
@uri = UNSET_VALUE
@driver = UNSET_VALUE
@ -174,6 +177,9 @@ module VagrantPlugins
# Suspend mode
@suspend_mode = UNSET_VALUE
# Autostart
@autostart = UNSET_VALUE
end
def boot(device)
@ -456,6 +462,8 @@ module VagrantPlugins
# Suspend mode
@suspend_mode = "pause" if @suspend_mode == UNSET_VALUE
# Autostart
@autostart = false if @autostart == UNSET_VALUE
end
def validate(machine)