mirror of
https://github.com/vagrant-libvirt/vagrant-libvirt.git
synced 2025-02-25 18:55:27 -06:00
Merge branch 'master' of github.com:pradels/vagrant-libvirt
Conflicts: lib/vagrant-libvirt/config.rb
This commit is contained in:
commit
3917161eb9
@ -20,6 +20,7 @@ welcome and can help a lot :-)
|
|||||||
* Provision domains with any built-in Vagrant provisioner.
|
* Provision domains with any built-in Vagrant provisioner.
|
||||||
* Synced folder support via `rsync` or `nfs`.
|
* Synced folder support via `rsync` or `nfs`.
|
||||||
* Snapshots via [sahara](https://github.com/jedi4ever/sahara)
|
* Snapshots via [sahara](https://github.com/jedi4ever/sahara)
|
||||||
|
* Use boxes from other Vagrant providers via [vagrant-mutate](https://github.com/sciurus/vagrant-mutate)
|
||||||
|
|
||||||
## Future work
|
## Future work
|
||||||
|
|
||||||
@ -96,8 +97,9 @@ This provider exposes quite a few provider-specific configuration options:
|
|||||||
* `connect_via_ssh` - If use ssh tunnel to connect to Libvirt.
|
* `connect_via_ssh` - If use ssh tunnel to connect to Libvirt.
|
||||||
* `username` - Username and password to access Libvirt.
|
* `username` - Username and password to access Libvirt.
|
||||||
* `password` - Password to access Libvirt.
|
* `password` - Password to access Libvirt.
|
||||||
* `storage_pool_name` - Libvirt storage pool name, where box image and
|
* `id_ssh_key_file` - The id ssh key file name to access Libvirt (eg: id_dsa or id_rsa or ... in the user .ssh directory)
|
||||||
instance snapshots will be stored.
|
* `storage_pool_name` - Libvirt storage pool name, where box image and instance snapshots will be stored.
|
||||||
|
* `default_network` - Libvirt default network name. If not specified default network name is 'default'.
|
||||||
|
|
||||||
### Domain Specific Options
|
### Domain Specific Options
|
||||||
|
|
||||||
|
@ -21,3 +21,9 @@ Libvirt box should define at least three data fields in `metadata.json` file.
|
|||||||
* format - Currently supported format is qcow2.
|
* format - Currently supported format is qcow2.
|
||||||
* virtual_size - Virtual size of image in GBytes.
|
* virtual_size - Virtual size of image in GBytes.
|
||||||
|
|
||||||
|
## Converting Boxes
|
||||||
|
|
||||||
|
Instead of creating a box from scratch, you can use
|
||||||
|
[vagrant-mutate](https://github.com/sciurus/vagrant-mutate)
|
||||||
|
to take boxes created for other Vagrant providers and use them
|
||||||
|
with vagrant-libvirt.
|
||||||
|
@ -59,6 +59,10 @@ module VagrantPlugins
|
|||||||
# VM is not running or suspended. Start it.. Machine should gain
|
# VM is not running or suspended. Start it.. Machine should gain
|
||||||
# IP address when comming up, so wait for dhcp lease and store IP
|
# IP address when comming up, so wait for dhcp lease and store IP
|
||||||
# into machines data_dir.
|
# into machines data_dir.
|
||||||
|
b3.use NFS
|
||||||
|
b3.use PrepareNFSSettings
|
||||||
|
b3.use ShareFolders
|
||||||
|
|
||||||
b3.use StartDomain
|
b3.use StartDomain
|
||||||
b3.use WaitTillUp
|
b3.use WaitTillUp
|
||||||
end
|
end
|
||||||
|
@ -53,9 +53,12 @@ module VagrantPlugins
|
|||||||
|
|
||||||
uri << virt_path
|
uri << virt_path
|
||||||
uri << '?no_verify=1'
|
uri << '?no_verify=1'
|
||||||
# set ssh key for access to libvirt host
|
|
||||||
home_dir = `echo ${HOME}`.chomp
|
if config.id_ssh_key_file
|
||||||
uri << "&keyfile=#{home_dir}/.ssh/id_rsa"
|
# set ssh key for access to libvirt host
|
||||||
|
home_dir = `echo ${HOME}`.chomp
|
||||||
|
uri << "&keyfile=#{home_dir}/.ssh/"+config.id_ssh_key_file
|
||||||
|
end
|
||||||
|
|
||||||
conn_attr = {}
|
conn_attr = {}
|
||||||
conn_attr[:provider] = 'libvirt'
|
conn_attr[:provider] = 'libvirt'
|
||||||
|
@ -16,6 +16,7 @@ module VagrantPlugins
|
|||||||
|
|
||||||
def initialize(app, env)
|
def initialize(app, env)
|
||||||
@logger = Log4r::Logger.new('vagrant_libvirt::action::create_network_interfaces')
|
@logger = Log4r::Logger.new('vagrant_libvirt::action::create_network_interfaces')
|
||||||
|
@default_network = env[:machine].provider_config.default_network;
|
||||||
@app = app
|
@app = app
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -151,7 +152,7 @@ module VagrantPlugins
|
|||||||
end
|
end
|
||||||
|
|
||||||
# TODO Network default can be missing or named different.
|
# TODO Network default can be missing or named different.
|
||||||
return 'default'
|
return @default_network;
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -47,6 +47,8 @@ module VagrantPlugins
|
|||||||
:forward_agent => machine.config.ssh.forward_agent,
|
:forward_agent => machine.config.ssh.forward_agent,
|
||||||
:forward_x11 => machine.config.ssh.forward_x11,
|
:forward_x11 => machine.config.ssh.forward_x11,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ssh_info[:proxy_command] = "ssh '#{machine.provider_config.host}' -l '#{machine.provider_config.username}' nc %h %p" if machine.provider_config.connect_via_ssh
|
||||||
|
|
||||||
if not ssh_info[:username]
|
if not ssh_info[:username]
|
||||||
ssh_info[:username] = machine.config.ssh.default.username
|
ssh_info[:username] = machine.config.ssh.default.username
|
||||||
|
@ -19,6 +19,7 @@ module VagrantPlugins
|
|||||||
|
|
||||||
env[:machine].config.vm.synced_folders.each do |id, data|
|
env[:machine].config.vm.synced_folders.each do |id, data|
|
||||||
next if data[:nfs]
|
next if data[:nfs]
|
||||||
|
proxycommand = "-o ProxyCommand='#{ssh_info[:proxy_command]}'" if ssh_info[:proxy_command]
|
||||||
hostpath = File.expand_path(data[:hostpath], env[:root_path])
|
hostpath = File.expand_path(data[:hostpath], env[:root_path])
|
||||||
guestpath = data[:guestpath]
|
guestpath = data[:guestpath]
|
||||||
|
|
||||||
@ -39,7 +40,7 @@ module VagrantPlugins
|
|||||||
command = [
|
command = [
|
||||||
"rsync", "--del", "--verbose", "--archive", "-z",
|
"rsync", "--del", "--verbose", "--archive", "-z",
|
||||||
"--exclude", ".vagrant/",
|
"--exclude", ".vagrant/",
|
||||||
"-e", "ssh -p #{ssh_info[:port]} -o StrictHostKeyChecking=no -i '#{ssh_info[:private_key_path]}'",
|
"-e", "ssh -p #{ssh_info[:port]} #{proxycommand} -o StrictHostKeyChecking=no -i '#{ssh_info[:private_key_path]}'",
|
||||||
hostpath,
|
hostpath,
|
||||||
"#{ssh_info[:username]}@#{ssh_info[:host]}:#{guestpath}"]
|
"#{ssh_info[:username]}@#{ssh_info[:host]}:#{guestpath}"]
|
||||||
|
|
||||||
|
@ -18,10 +18,16 @@ module VagrantPlugins
|
|||||||
# Password for Libvirt connection.
|
# Password for Libvirt connection.
|
||||||
attr_accessor :password
|
attr_accessor :password
|
||||||
|
|
||||||
|
# ID SSH key file
|
||||||
|
attr_accessor :id_ssh_key_file
|
||||||
|
|
||||||
# Libvirt storage pool name, where box image and instance snapshots will
|
# Libvirt storage pool name, where box image and instance snapshots will
|
||||||
# be stored.
|
# be stored.
|
||||||
attr_accessor :storage_pool_name
|
attr_accessor :storage_pool_name
|
||||||
|
|
||||||
|
# Libvirt default network
|
||||||
|
attr_accessor :default_network
|
||||||
|
|
||||||
# Domain specific settings used while creating new domain.
|
# Domain specific settings used while creating new domain.
|
||||||
attr_accessor :memory
|
attr_accessor :memory
|
||||||
attr_accessor :cpus
|
attr_accessor :cpus
|
||||||
@ -34,7 +40,9 @@ module VagrantPlugins
|
|||||||
@connect_via_ssh = UNSET_VALUE
|
@connect_via_ssh = UNSET_VALUE
|
||||||
@username = UNSET_VALUE
|
@username = UNSET_VALUE
|
||||||
@password = UNSET_VALUE
|
@password = UNSET_VALUE
|
||||||
|
@id_ssh_key_file = UNSET_VALUE
|
||||||
@storage_pool_name = UNSET_VALUE
|
@storage_pool_name = UNSET_VALUE
|
||||||
|
@default_network = UNSET_VALUE
|
||||||
|
|
||||||
# Domain specific settings.
|
# Domain specific settings.
|
||||||
@memory = UNSET_VALUE
|
@memory = UNSET_VALUE
|
||||||
@ -51,6 +59,7 @@ module VagrantPlugins
|
|||||||
@password = nil if @password == UNSET_VALUE
|
@password = nil if @password == UNSET_VALUE
|
||||||
@id_ssh_key_file = 'id_rsa' if @id_ssh_key_file == UNSET_VALUE
|
@id_ssh_key_file = 'id_rsa' if @id_ssh_key_file == UNSET_VALUE
|
||||||
@storage_pool_name = 'default' if @storage_pool_name == UNSET_VALUE
|
@storage_pool_name = 'default' if @storage_pool_name == UNSET_VALUE
|
||||||
|
@default_network = 'default' if @default_network == UNSET_VALUE
|
||||||
|
|
||||||
# Domain specific settings.
|
# Domain specific settings.
|
||||||
@memory = 512 if @memory == UNSET_VALUE
|
@memory = 512 if @memory == UNSET_VALUE
|
||||||
|
@ -35,15 +35,15 @@ module VagrantPlugins
|
|||||||
end
|
end
|
||||||
|
|
||||||
class NoBoxVirtualSizeSet < VagrantLibvirtError
|
class NoBoxVirtualSizeSet < VagrantLibvirtError
|
||||||
error_key(:no_box_virtual_size_error)
|
error_key(:no_box_virtual_size)
|
||||||
end
|
end
|
||||||
|
|
||||||
class NoBoxFormatSet < VagrantLibvirtError
|
class NoBoxFormatSet < VagrantLibvirtError
|
||||||
error_key(:no_box_format_error)
|
error_key(:no_box_format)
|
||||||
end
|
end
|
||||||
|
|
||||||
class WrongBoxFormatSet < VagrantLibvirtError
|
class WrongBoxFormatSet < VagrantLibvirtError
|
||||||
error_key(:wrong_box_format_error)
|
error_key(:wrong_box_format)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user