From 6e8c43e300964a0b1b3c87c83a7d2213c035a4a5 Mon Sep 17 00:00:00 2001 From: Brian Pitts Date: Sat, 18 Jan 2014 13:03:34 -0600 Subject: [PATCH] Create and activate networks if needed when starting VM. Closes #116 --- lib/vagrant-libvirt/action.rb | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/lib/vagrant-libvirt/action.rb b/lib/vagrant-libvirt/action.rb index 1f3547f..164476b 100644 --- a/lib/vagrant-libvirt/action.rb +++ b/lib/vagrant-libvirt/action.rb @@ -57,14 +57,18 @@ module VagrantPlugins next if env[:result] b2.use Call, IsSuspended do |env2, b3| + # if vm is suspended resume it then exit if env2[:result] b3.use ResumeDomain next end - # VM is not running or suspended. Start it.. Machine should gain - # IP address when comming up, so wait for dhcp lease and store IP - # into machines data_dir. + # VM is not running or suspended. + + # Ensure networks are created and active + b3.use CreateNetworks + + # Handle shared folders if Vagrant::VERSION < "1.4.0" b3.use NFS else @@ -74,7 +78,11 @@ module VagrantPlugins b3.use PrepareNFSSettings b3.use ShareFolders + # Start it.. b3.use StartDomain + + # Machine should gain IP address when comming up, + # so wait for dhcp lease and store IP into machines data_dir. b3.use WaitTillUp end end