[DRE-commits] [vagrant-libvirt] 54/104: v0.0.6

Antonio Terceiro terceiro at moszumanska.debian.org
Sun Apr 24 13:55:45 UTC 2016


This is an automated email from the git hooks/post-receive script.

terceiro pushed a commit to annotated tag 0.0.11
in repository vagrant-libvirt.

commit d05196692c1d4ff89ee618fe89887e9c733b54d9
Author: pradels <les.pradels at gmail.com>
Date:   Wed Jul 24 15:44:30 2013 +0200

    v0.0.6
    
    * Routed networks support.
    * SSH configurable params in Vagrantfile.
    * Updated README file.
---
 CHANGELOG.md                                       |  7 +++
 README.md                                          | 50 +++++++++++++++++-----
 lib/vagrant-libvirt/action/create_networks.rb      | 13 +++---
 lib/vagrant-libvirt/action/read_ssh_info.rb        | 17 +++++---
 .../templates/private_network.xml.erb              |  6 +--
 lib/vagrant-libvirt/version.rb                     |  2 +-
 tools/prepare_redhat_for_box.sh                    | 11 ++++-
 7 files changed, 75 insertions(+), 31 deletions(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 1b32848..391efd7 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,10 @@
+# 0.0.6 (Jul 24, 2013)
+
+* Synced folder via NFS support.
+* Routed private network support.
+* Configurable ssh parameters in Vagrantfile via `config.ssh.*`.
+* Fixed uploading base box image to storage pool bug (buffer was too big).
+
 # 0.0.5 (May 10, 2013)
 
 * Private networks support.
diff --git a/README.md b/README.md
index 1fe2f68..bff80a9 100644
--- a/README.md
+++ b/README.md
@@ -4,12 +4,12 @@ This is a [Vagrant](http://www.vagrantup.com) 1.1+ plugin that adds an
 [Libvirt](http://libvirt.org) provider to Vagrant, allowing Vagrant to
 control and provision machines via Libvirt toolkit.
 
-**Note:** Actual version (0.0.5) is still a development one. Feedback is
+**Note:** Actual version (0.0.6) is still a development one. Feedback is
 welcome and can help a lot :-)
 
-## Features (Version 0.0.5)
+## Features (Version 0.0.6)
 
-* Controll local or remote Libvirt hypervisors.
+* Controll local Libvirt hypervisors.
 * Vagrant `up`, `destroy`, `suspend`, `resume`, `halt`, `ssh` and `provision` commands.
 * Upload box image (qcow2 format) to Libvirt storage pool.
 * Create volume as COW diff image for domains.
@@ -18,7 +18,7 @@ welcome and can help a lot :-)
 * SSH into domains.
 * Setup hostname and network interfaces.
 * Provision domains with any built-in Vagrant provisioner.
-* Synced folder support via `rsync` and `nfs`
+* Synced folder support via `rsync` or `nfs`.
 
 ## Future work
 
@@ -66,6 +66,11 @@ centos64 box and setup with 10.20.30.40 IP address.
 
 ```ruby
 Vagrant.configure("2") do |config|
+
+  # If you are still using old centos box, you have to setup root username for
+  # ssh access. Read more in section 'SSH Access To VM'.
+  config.ssh.username = "root"
+
   config.vm.define :test_vm do |test_vm|
     test_vm.vm.box = "centos64"
     test_vm.vm.network :private_network, :ip => '10.20.30.40'
@@ -110,6 +115,7 @@ Vagrant.configure("2") do |config|
     dbserver.vm.provider :libvirt do |domain|
       domain.memory = 2048
       domain.cpus = 2
+      domain.nested = true
     end
   end
 
@@ -153,7 +159,7 @@ An examples of network interface definitions:
 
 ```ruby
   config.vm.define :test_vm1 do |test_vm1|
-    test_vm1.vm.network :private_network, :ip => '10.20.30.40'
+    test_vm1.vm.network :private_network, :ip => "10.20.30.40",
   end
 ```
 
@@ -178,14 +184,18 @@ starts with 'libvirt__' string. Here is a list of those options:
   network 'default' is used.
 * `:libvirt__netmask` - Used only together with `:ip` option. Default is
   '255.255.255.0'.
-* `:libvirt__nat_interface` - Name of interface, where should network be
-  NATed. Used only when creating new network. By default, all physical
-  interfaces are used.
-* `:libvirt__isolated` - If network should be isolated - without NAT to outside.
-  Used only when creating new network. Default is set to false.
 * `:libvirt__dhcp_enabled` - If DHCP will offer addresses, or not. Used only
   when creating new network. Default is true.
 * `:libvirt__adapter` - Number specifiyng sequence number of interface.
+* `:libvirt__forward_mode` - Specify one of `none`, `nat` or `route` options.
+  This option is used only when creating new network. Mode `none` will create
+  isolated network without NATing or routing outside. You will want to use
+  NATed forwarding typically to reach networks outside of hypervisor. Routed
+  forwarding is typically useful to reach other networks within hypervisor.
+  By default, option `nat` is used.
+* `:libvirt__forward_device` - Name of interface/device, where network should
+  be forwarded (NATed or routed). Used only when creating new network. By
+  default, all physical interfaces are used.
 
 ## Obtaining Domain IP Address
 
@@ -197,6 +207,24 @@ makes lease information public in `/var/lib/libvirt/dnsmasq` directory, or in
 information like which MAC address has which IP address resides and it's parsed
 by vagrant-libvirt plugin.
 
+## SSH Access To VM
+
+There are some configuration options for ssh access to VM via `config.ssh.*` in
+Vagrantfile. Untill provider version 0.0.5, root user was hardcoded and used to
+access VMs ssh. Now, vagrant user is used by default, but it's configurable via
+`config.ssh.username` option in Vagrantfile now.
+
+If you are still using CentOS 6.4 box from example in this README, please set
+ssh username back to root, because user vagrant is not usable (I forgot to add
+necessary ssh key to his authorized_keys).
+
+Configurable ssh parameters in Vagrantfile after provider version 0.0.5 are:
+
+* `config.ssh.username` - Default is username vagrant.
+* `config.ssh.guest_port` - Default port is set to 22.
+* `config.ssh.forward_agent` - Default is false.
+* `config.ssh.forward_x11` - Default is false.
+
 ## Synced Folders
 
 There is minimal support for synced folders. Upon `vagrant up`, the Libvirt
@@ -206,7 +234,7 @@ to the remote machine over SSH.
 This is good enough for all built-in Vagrant provisioners (shell,
 chef, and puppet) to work!
 
-if used options :nfs => true, folder will exported by nfs.
+If used options `:nfs => true`, folder will exported by nfs.
 
 ## Box Format
 
diff --git a/lib/vagrant-libvirt/action/create_networks.rb b/lib/vagrant-libvirt/action/create_networks.rb
index f35cebf..3114351 100644
--- a/lib/vagrant-libvirt/action/create_networks.rb
+++ b/lib/vagrant-libvirt/action/create_networks.rb
@@ -45,6 +45,8 @@ module VagrantPlugins
             @options = scoped_hash_override(options, :libvirt)
             @options = {
               :netmask      => '255.255.255.0',
+              :dhcp_enabled => true,
+              :forward_mode => 'nat',
             }.merge(@options)
 
             # Prepare a hash describing network for this specific interface.
@@ -201,14 +203,9 @@ module VagrantPlugins
           @network_address = @interface_network[:ip_address]
           @network_netmask = @interface_network[:netmask]
 
-          if @options[:isolated]
-            @network_forward_mode = false
-          else
-            @network_forward_mode = 'nat'
-
-            if @options[:nat_interface]
-              @network_nat_interface = @options[:nat_interface]
-            end
+          @network_forward_mode = @options[:forward_mode]
+          if @options[:forward_device]
+            @network_forward_device = @options[:forward_device]
           end
 
           if @options[:dhcp_enabled]
diff --git a/lib/vagrant-libvirt/action/read_ssh_info.rb b/lib/vagrant-libvirt/action/read_ssh_info.rb
index 26d8857..62e3e0d 100644
--- a/lib/vagrant-libvirt/action/read_ssh_info.rb
+++ b/lib/vagrant-libvirt/action/read_ssh_info.rb
@@ -40,14 +40,19 @@ module VagrantPlugins
           }
           raise Errors::NoIpAddressError if not ip_address
 
-          # Return the info
-          # TODO: Some info should be configurable in Vagrantfile
-          return {
+          ssh_info = {
             :host          => ip_address,
-            :port          => 22,
-            :forward_agent => true,
-            :forward_x11   => true,
+            :port          => machine.config.ssh.guest_port,
+            :username      => machine.config.ssh.username,
+            :forward_agent => machine.config.ssh.forward_agent,
+            :forward_x11   => machine.config.ssh.forward_x11,
           }
+
+          if not ssh_info[:username]
+            ssh_info[:username] = machine.config.ssh.default.username
+          end
+
+          ssh_info
         end 
       end
     end
diff --git a/lib/vagrant-libvirt/templates/private_network.xml.erb b/lib/vagrant-libvirt/templates/private_network.xml.erb
index 8b96df7..e43a77d 100644
--- a/lib/vagrant-libvirt/templates/private_network.xml.erb
+++ b/lib/vagrant-libvirt/templates/private_network.xml.erb
@@ -2,9 +2,9 @@
   <name><%= @network_name %></name>
   <bridge name="<%= @network_bridge_name %>" />
 
-  <% if @network_forward_mode != false %>
-    <% if @network_nat_interface %>
-  <forward mode="<%= @network_forward_mode %>" dev="<%= @network_nat_interface %>" />
+  <% if @network_forward_mode != 'none' %>
+    <% if @network_forward_device %>
+  <forward mode="<%= @network_forward_mode %>" dev="<%= @network_forward_device %>" />
     <% else %>
   <forward mode="<%= @network_forward_mode %>" />
     <% end %>
diff --git a/lib/vagrant-libvirt/version.rb b/lib/vagrant-libvirt/version.rb
index e159d41..addb8f0 100644
--- a/lib/vagrant-libvirt/version.rb
+++ b/lib/vagrant-libvirt/version.rb
@@ -1,5 +1,5 @@
 module VagrantPlugins
   module Libvirt
-    VERSION = "0.0.5"
+    VERSION = "0.0.6"
   end
 end
diff --git a/tools/prepare_redhat_for_box.sh b/tools/prepare_redhat_for_box.sh
index 5b82c43..de60674 100755
--- a/tools/prepare_redhat_for_box.sh
+++ b/tools/prepare_redhat_for_box.sh
@@ -10,7 +10,7 @@
 # For more info about creating custom box refer to
 # https://github.com/pradels/vagrant-libvirt/tree/master/example_box
 
-# We need a hostname.
+# We need to set a hostname.
 if [ $# -ne 1 ]; then
 	echo "Usage: $0 <hostname>"
 	echo "Hostname should be in format vagrant-[os-name], e.g. vagrant-redhat63."
@@ -75,7 +75,7 @@ sed -i 's/Defaults\s*requiretty/Defaults !requiretty/' /etc/sudoers
 
 
 # SSH setup
-# Add Vagrant ssh key for root accout.
+# Add Vagrant ssh key for root and vagrant accouts.
 sed -i 's/.*UseDNS.*/UseDNS no/' /etc/ssh/sshd_config
 
 [ -d ~root/.ssh ] || mkdir ~root/.ssh
@@ -85,6 +85,13 @@ ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA6NF8iallvQVp22WDkTkyrtvp9eWW6A8YVr+kz4TjGYe7
 EOF
 chmod 600 ~root/.ssh/authorized_keys
 
+[ -d ~vagrant/.ssh ] || mkdir ~vagrant/.ssh
+chmod 700 ~vagrant/.ssh
+cat > ~vagrant/.ssh/authorized_keys << EOF
+ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA6NF8iallvQVp22WDkTkyrtvp9eWW6A8YVr+kz4TjGYe7gHzIw+niNltGEFHzD8+v1I2YJ6oXevct1YeS0o9HZyN1Q9qgCgzUFtdOKLv6IedplqoPkcmF0aYet2PkEDo3MlTBckFXPITAMzF8dJSIFo9D8HfdOV0IAdx4O7PtixWKn5y2hMNG0zQPyUecp4pzC6kivAIhyfHilFR61RGL+GPXQ2MWZWFYbAGjyiYJnAmCP3NOTd0jMZEnDkbUvxhMmBYSdETk1rRgm+R4LOzFUGaHqHDLKLX+FIPKcF96hrucXzcWyLbIbEgE98OHlnVYCzRdK8jlqm8tehUc9c9WhQ== vagrant insecure public key
+EOF
+chmod 600 ~vagrant/.ssh/authorized_keys
+
 
 # Disable firewall and switch SELinux to permissive mode.
 chkconfig iptables off

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-ruby-extras/vagrant-libvirt.git



More information about the Pkg-ruby-extras-commits mailing list