Merge branch 'master' of git://github.com/pradels/vagrant-libvirt

Conflicts:
	lib/vagrant-libvirt/action.rb
This commit is contained in:
dima
2013-05-14 01:19:35 +02:00
6 changed files with 76 additions and 44 deletions

View File

@@ -28,6 +28,7 @@ module VagrantPlugins
b2.use NFS
b2.use PrepareNFSSettings
b2.use ShareFolders
b2.use SetHostname
b2.use StartDomain
b2.use WaitTillUp
b2.use SyncFolders
@@ -84,10 +85,8 @@ module VagrantPlugins
b2.use Call, IsRunning do |env2, b3|
next if !env2[:result]
# VM is running, halt it.. Cleanup running instance data. Now
# only IP address is stored.
# VM is running, halt it.
b3.use HaltDomain
b3.use CleanupDataDir
end
end
end
@@ -108,9 +107,6 @@ module VagrantPlugins
b2.use PruneNFSExports
b2.use DestroyDomain
b2.use DestroyNetworks
# Cleanup running instance data. Now only IP address is stored.
b2.use CleanupDataDir
end
end
end
@@ -277,7 +273,6 @@ module VagrantPlugins
autoload :HaltDomain, action_root.join("halt_domain")
autoload :SuspendDomain, action_root.join("suspend_domain")
autoload :ResumeDomain, action_root.join("resume_domain")
autoload :CleanupDataDir, action_root.join("cleanup_data_dir")
autoload :ReadState, action_root.join("read_state")
autoload :ReadSSHInfo, action_root.join("read_ssh_info")
autoload :TimedProvision, action_root.join("timed_provision")

View File

@@ -1,22 +0,0 @@
require 'log4r'
module VagrantPlugins
module Libvirt
module Action
class CleanupDataDir
def initialize(app, env)
@logger = Log4r::Logger.new("vagrant_libvirt::action::cleanup_data_dir")
@app = app
end
def call(env)
# Remove file holding IP address
ip_file_path = env[:machine].data_dir + 'ip'
File.delete(ip_file_path) if File.exists?(ip_file_path)
@app.call(env)
end
end
end
end
end

View File

@@ -44,7 +44,7 @@ module VagrantPlugins
# (:libvirt__network_name => ...).
@options = scoped_hash_override(options, :libvirt)
@options = {
:netmask => '255.255.255.0',
:netmask => '255.255.255.0',
}.merge(@options)
# Prepare a hash describing network for this specific interface.
@@ -64,6 +64,13 @@ module VagrantPlugins
handle_ip_option(env)
elsif @options[:network_name]
handle_network_name_option
else
# TODO Should be smarter than just using fixed 'default' string.
@interface_network = lookup_network_by_name('default')
if not @interface_network
raise Errors::NetworkNotAvailableError,
:network_name => 'default'
end
end
autostart_network if not @interface_network[:autostart]
@@ -212,6 +219,7 @@ module VagrantPlugins
# First is address of network, second is gateway. Start the range two
# addresses after network address.
# TODO Detect if this IP is not set on the interface.
start_address = net.to_range.begin.succ.succ
# Stop address must not be broadcast.

View File

@@ -1,5 +1,5 @@
module VagrantPlugins
module Libvirt
VERSION = "0.0.4"
VERSION = "0.0.5"
end
end