trivial: Remove tabs

Don't mix tabs and spaces. Remove tabs across the board to prevent
confusion.
This commit is contained in:
Stephen Finucane 2016-09-06 16:26:33 +01:00
parent 945e84f9a4
commit b2d1cfa38b
8 changed files with 50 additions and 49 deletions

View File

@ -20,13 +20,13 @@ welcome and can help a lot :-)
- [Libvirt Configuration](#libvirt-configuration) - [Libvirt Configuration](#libvirt-configuration)
- [Provider Options](#provider-options) - [Provider Options](#provider-options)
- [Domain Specific Options](#domain-specific-options) - [Domain Specific Options](#domain-specific-options)
- [Reload behavior](#reload-behavior) - [Reload behavior](#reload-behavior)
- [Networks](#networks) - [Networks](#networks)
- [Private Network Options](#private-network-options) - [Private Network Options](#private-network-options)
- [Public Network Options](#public-network-options) - [Public Network Options](#public-network-options)
- [Management Network](#management-network) - [Management Network](#management-network)
- [Additional Disks](#additional-disks) - [Additional Disks](#additional-disks)
- [Reload behavior](#reload-behavior-1) - [Reload behavior](#reload-behavior-1)
- [CDROMs](#cdroms) - [CDROMs](#cdroms)
- [Input](#input) - [Input](#input)
- [PCI device passthrough](#pci-device-passthrough) - [PCI device passthrough](#pci-device-passthrough)
@ -145,15 +145,15 @@ Vagrant to use Libvirt provider is to setup environment variable
Vagrant goes through steps below when creating new project: Vagrant goes through steps below when creating new project:
1. Connect to Libvirt localy or remotely via SSH. 1. Connect to Libvirt localy or remotely via SSH.
2. Check if box image is available in Libvirt storage pool. If not, upload it to 2. Check if box image is available in Libvirt storage pool. If not, upload it to
remote Libvirt storage pool as new volume. remote Libvirt storage pool as new volume.
3. Create COW diff image of base box image for new Libvirt domain. 3. Create COW diff image of base box image for new Libvirt domain.
4. Create and start new domain on Libvirt host. 4. Create and start new domain on Libvirt host.
5. Check for DHCP lease from dnsmasq server. 5. Check for DHCP lease from dnsmasq server.
6. Wait till SSH is available. 6. Wait till SSH is available.
7. Sync folders and run Vagrant provisioner on new domain if 7. Sync folders and run Vagrant provisioner on new domain if
setup in Vagrantfile. setup in Vagrantfile.
### Libvirt Configuration ### Libvirt Configuration
@ -263,6 +263,7 @@ Vagrant.configure("2") do |config|
``` ```
#### Reload behavior #### Reload behavior
On vagrant reload the following domain specific attributes are updated in defined domain: On vagrant reload the following domain specific attributes are updated in defined domain:
* `disk_bus` - Is updated only on disks. It skips cdroms. * `disk_bus` - Is updated only on disks. It skips cdroms.
@ -739,7 +740,7 @@ Below is the syntax for creating a spicevmc channel for use by a qxl graphics ca
```ruby ```ruby
vagrant.configure(2) do |config| vagrant.configure(2) do |config|
config.vm.provider :libvirt do |libvirt| config.vm.provider :libvirt do |libvirt|
libvirt.channel :type => 'spicevmc', :target_name => 'com.redhat.spice.0', :target_type => 'virtio' libvirt.channel :type => 'spicevmc', :target_name => 'com.redhat.spice.0', :target_type => 'virtio'
end end
end end
``` ```

View File

@ -12,7 +12,7 @@ module VagrantPlugins
end end
def _disk_name(name, disk) def _disk_name(name, disk)
"#{name}-#{disk[:device]}.#{disk[:type]}" # disk name "#{name}-#{disk[:device]}.#{disk[:type]}" # disk name
end end
def _disks_print(disks) def _disks_print(disks)

View File

@ -17,8 +17,8 @@ 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')
@management_network_name = env[:machine].provider_config.management_network_name @management_network_name = env[:machine].provider_config.management_network_name
config = env[:machine].provider_config config = env[:machine].provider_config
@nic_model_type = config.nic_model_type @nic_model_type = config.nic_model_type
@nic_adapter_count = config.nic_adapter_count @nic_adapter_count = config.nic_adapter_count
@app = app @app = app
end end
@ -69,7 +69,7 @@ module VagrantPlugins
@network_name = iface_configuration[:network_name] @network_name = iface_configuration[:network_name]
@mac = iface_configuration.fetch(:mac, false) @mac = iface_configuration.fetch(:mac, false)
@model_type = iface_configuration.fetch(:model_type, @nic_model_type) @model_type = iface_configuration.fetch(:model_type, @nic_model_type)
@device_name = iface_configuration.fetch(:iface_name, false) @device_name = iface_configuration.fetch(:iface_name, false)
template_name = 'interface' template_name = 'interface'
# Configuration for public interfaces which use the macvtap driver # Configuration for public interfaces which use the macvtap driver
if iface_configuration[:iface_type] == :public_network if iface_configuration[:iface_type] == :public_network

View File

@ -111,7 +111,7 @@ module VagrantPlugins
@env[:ui].info 'Requesting sudo for host port(s) <= 1024' @env[:ui].info 'Requesting sudo for host port(s) <= 1024'
r = system('sudo -v') r = system('sudo -v')
if r if r
ssh_cmd << 'sudo ' # add sudo prefix ssh_cmd << 'sudo ' # add sudo prefix
end end
end end
end end
@ -175,7 +175,7 @@ module VagrantPlugins
kill_cmd = '' kill_cmd = ''
if tag[:port] <= 1024 if tag[:port] <= 1024
kill_cmd << 'sudo ' # add sudo prefix kill_cmd << 'sudo ' # add sudo prefix
end end
kill_cmd << "kill #{tag[:pid]}" kill_cmd << "kill #{tag[:pid]}"

View File

@ -39,7 +39,7 @@ module VagrantPlugins
# #
# @param [Machine] machine # @param [Machine] machine
# @return [String] # @return [String]
def read_host_ip(ip) def read_host_ip(ip)
UDPSocket.open do |s| UDPSocket.open do |s|
if(ip.kind_of?(Array)) if(ip.kind_of?(Array))
s.connect(ip.last, 1) s.connect(ip.last, 1)

View File

@ -173,10 +173,10 @@ module VagrantPlugins
@nic_adapter_count = UNSET_VALUE @nic_adapter_count = UNSET_VALUE
# Boot order # Boot order
@boot_order = [] @boot_order = []
# Storage # Storage
@disks = [] @disks = []
@cdroms = [] @cdroms = []
# Inputs # Inputs
@inputs = UNSET_VALUE @inputs = UNSET_VALUE
@ -198,15 +198,15 @@ module VagrantPlugins
end end
def boot(device) def boot(device)
@boot_order << device # append @boot_order << device # append
end end
def _get_device(disks) def _get_device(disks)
# skip existing devices and also the first one (vda) # skip existing devices and also the first one (vda)
exist = disks.collect {|x| x[:device]}+[1.vdev.to_s] exist = disks.collect {|x| x[:device]}+[1.vdev.to_s]
skip = 1 # we're 1 based, not 0 based... skip = 1 # we're 1 based, not 0 based...
while true do while true do
dev = skip.vdev # get lettered device dev = skip.vdev # get lettered device
if !exist.include?(dev) if !exist.include?(dev)
return dev return dev
end end
@ -363,7 +363,7 @@ module VagrantPlugins
options = { options = {
:device => _get_device(@disks), :device => _get_device(@disks),
:type => 'qcow2', :type => 'qcow2',
:size => '10G', # matches the fog default :size => '10G', # matches the fog default
:path => nil, :path => nil,
:bus => 'virtio' :bus => 'virtio'
}.merge(options) }.merge(options)
@ -378,7 +378,7 @@ module VagrantPlugins
:allow_existing => options[:allow_existing], :allow_existing => options[:allow_existing],
} }
@disks << disk # append @disks << disk # append
end end
# code to generate URI from a config moved out of the connect action # code to generate URI from a config moved out of the connect action
@ -397,7 +397,7 @@ module VagrantPlugins
raise "Require specify driver #{uri}" raise "Require specify driver #{uri}"
end end
if uri == 'kvm' if uri == 'kvm'
uri = 'qemu' # use qemu uri for kvm domain type uri = 'qemu' # use qemu uri for kvm domain type
end end
if @connect_via_ssh if @connect_via_ssh

View File

@ -1,13 +1,13 @@
<interface type='network'> <interface type='network'>
<source network='<%= @network_name %>'/> <source network='<%= @network_name %>'/>
<% if @mac %> <% if @mac %>
<mac address='<%= @mac %>'/> <mac address='<%= @mac %>'/>
<% end %> <% end %>
<% if @device_name %> <% if @device_name %>
<target dev='<%= @device_name %>'/> <target dev='<%= @device_name %>'/>
<% else %> <% else %>
<target dev='vnet<%= @iface_number %>'/> <target dev='vnet<%= @iface_number %>'/>
<% end %> <% end %>
<alias name='net<%= @iface_number %>'/> <alias name='net<%= @iface_number %>'/>
<model type='<%=@model_type%>'/> <model type='<%=@model_type%>'/>
</interface> </interface>

View File

@ -12,17 +12,17 @@
# We need to set a hostname. # We need to set a hostname.
if [ $# -ne 1 ]; then if [ $# -ne 1 ]; then
echo "Usage: $0 <hostname>" echo "Usage: $0 <hostname>"
echo "Hostname should be in format vagrant-[os-name], e.g. vagrant-redhat63." echo "Hostname should be in format vagrant-[os-name], e.g. vagrant-redhat63."
exit 1 exit 1
fi fi
# On which version of RedHet are we running? # On which version of RedHet are we running?
RHEL_MAJOR_VERSION=$(sed 's/.*release \([0-9]\)\..*/\1/' /etc/redhat-release) RHEL_MAJOR_VERSION=$(sed 's/.*release \([0-9]\)\..*/\1/' /etc/redhat-release)
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
echo "Is this a RedHat distro?" echo "Is this a RedHat distro?"
exit 1 exit 1
fi fi
echo "* Found RedHat ${RHEL_MAJOR_VERSION} version." echo "* Found RedHat ${RHEL_MAJOR_VERSION} version."
@ -30,9 +30,9 @@ echo "* Found RedHat ${RHEL_MAJOR_VERSION} version."
# Setup hostname vagrant-something. # Setup hostname vagrant-something.
FQDN="$1.vagrantup.com" FQDN="$1.vagrantup.com"
if grep '^HOSTNAME=' /etc/sysconfig/network > /dev/null; then if grep '^HOSTNAME=' /etc/sysconfig/network > /dev/null; then
sed -i 's/HOSTNAME=\(.*\)/HOSTNAME='${FQDN}'/' /etc/sysconfig/network sed -i 's/HOSTNAME=\(.*\)/HOSTNAME='${FQDN}'/' /etc/sysconfig/network
else else
echo "HOSTNAME=${FQDN}" >> /etc/sysconfig/network echo "HOSTNAME=${FQDN}" >> /etc/sysconfig/network
fi fi
@ -40,11 +40,11 @@ fi
yum -y install wget yum -y install wget
cd ~root cd ~root
if [ $RHEL_MAJOR_VERSION -eq 5 ]; then if [ $RHEL_MAJOR_VERSION -eq 5 ]; then
wget http://ftp.astral.ro/mirrors/fedora/pub/epel/5/i386/epel-release-5-4.noarch.rpm wget http://ftp.astral.ro/mirrors/fedora/pub/epel/5/i386/epel-release-5-4.noarch.rpm
EPEL_PKG="epel-release-5-4.noarch.rpm" EPEL_PKG="epel-release-5-4.noarch.rpm"
else else
wget http://ftp.astral.ro/mirrors/fedora/pub/epel/6/i386/epel-release-6-8.noarch.rpm wget http://ftp.astral.ro/mirrors/fedora/pub/epel/6/i386/epel-release-6-8.noarch.rpm
EPEL_PKG="epel-release-6-8.noarch.rpm" EPEL_PKG="epel-release-6-8.noarch.rpm"
fi fi
rpm -i ~root/${EPEL_PKG} rpm -i ~root/${EPEL_PKG}
rm -f ~root/${EPEL_PKG} rm -f ~root/${EPEL_PKG}
@ -60,9 +60,9 @@ chkconfig sshd on
echo 'vagrant' | passwd --stdin root echo 'vagrant' | passwd --stdin root
grep 'vagrant' /etc/passwd > /dev/null grep 'vagrant' /etc/passwd > /dev/null
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
echo '* Creating user vagrant.' echo '* Creating user vagrant.'
useradd vagrant useradd vagrant
echo 'vagrant' | passwd --stdin vagrant echo 'vagrant' | passwd --stdin vagrant
fi fi
grep '^admin:' /etc/group > /dev/null || groupadd admin grep '^admin:' /etc/group > /dev/null || groupadd admin
usermod -G admin vagrant usermod -G admin vagrant