mirror of
https://github.com/vagrant-libvirt/vagrant-libvirt.git
synced 2025-02-25 18:55:27 -06:00
trivial: Remove tabs
Don't mix tabs and spaces. Remove tabs across the board to prevent confusion.
This commit is contained in:
parent
945e84f9a4
commit
b2d1cfa38b
25
README.md
25
README.md
@ -20,13 +20,13 @@ welcome and can help a lot :-)
|
||||
- [Libvirt Configuration](#libvirt-configuration)
|
||||
- [Provider Options](#provider-options)
|
||||
- [Domain Specific Options](#domain-specific-options)
|
||||
- [Reload behavior](#reload-behavior)
|
||||
- [Reload behavior](#reload-behavior)
|
||||
- [Networks](#networks)
|
||||
- [Private Network Options](#private-network-options)
|
||||
- [Public Network Options](#public-network-options)
|
||||
- [Management Network](#management-network)
|
||||
- [Additional Disks](#additional-disks)
|
||||
- [Reload behavior](#reload-behavior-1)
|
||||
- [Reload behavior](#reload-behavior-1)
|
||||
- [CDROMs](#cdroms)
|
||||
- [Input](#input)
|
||||
- [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:
|
||||
|
||||
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
|
||||
remote Libvirt storage pool as new volume.
|
||||
3. Create COW diff image of base box image for new Libvirt domain.
|
||||
4. Create and start new domain on Libvirt host.
|
||||
5. Check for DHCP lease from dnsmasq server.
|
||||
6. Wait till SSH is available.
|
||||
7. Sync folders and run Vagrant provisioner on new domain if
|
||||
setup in Vagrantfile.
|
||||
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
|
||||
remote Libvirt storage pool as new volume.
|
||||
3. Create COW diff image of base box image for new Libvirt domain.
|
||||
4. Create and start new domain on Libvirt host.
|
||||
5. Check for DHCP lease from dnsmasq server.
|
||||
6. Wait till SSH is available.
|
||||
7. Sync folders and run Vagrant provisioner on new domain if
|
||||
setup in Vagrantfile.
|
||||
|
||||
|
||||
### Libvirt Configuration
|
||||
@ -263,6 +263,7 @@ Vagrant.configure("2") do |config|
|
||||
```
|
||||
|
||||
#### Reload behavior
|
||||
|
||||
On vagrant reload the following domain specific attributes are updated in defined domain:
|
||||
|
||||
* `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
|
||||
vagrant.configure(2) do |config|
|
||||
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
|
||||
```
|
||||
|
@ -12,7 +12,7 @@ module VagrantPlugins
|
||||
end
|
||||
|
||||
def _disk_name(name, disk)
|
||||
"#{name}-#{disk[:device]}.#{disk[:type]}" # disk name
|
||||
"#{name}-#{disk[:device]}.#{disk[:type]}" # disk name
|
||||
end
|
||||
|
||||
def _disks_print(disks)
|
||||
|
@ -17,8 +17,8 @@ module VagrantPlugins
|
||||
def initialize(app, env)
|
||||
@logger = Log4r::Logger.new('vagrant_libvirt::action::create_network_interfaces')
|
||||
@management_network_name = env[:machine].provider_config.management_network_name
|
||||
config = env[:machine].provider_config
|
||||
@nic_model_type = config.nic_model_type
|
||||
config = env[:machine].provider_config
|
||||
@nic_model_type = config.nic_model_type
|
||||
@nic_adapter_count = config.nic_adapter_count
|
||||
@app = app
|
||||
end
|
||||
@ -69,7 +69,7 @@ module VagrantPlugins
|
||||
@network_name = iface_configuration[:network_name]
|
||||
@mac = iface_configuration.fetch(:mac, false)
|
||||
@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'
|
||||
# Configuration for public interfaces which use the macvtap driver
|
||||
if iface_configuration[:iface_type] == :public_network
|
||||
|
@ -111,7 +111,7 @@ module VagrantPlugins
|
||||
@env[:ui].info 'Requesting sudo for host port(s) <= 1024'
|
||||
r = system('sudo -v')
|
||||
if r
|
||||
ssh_cmd << 'sudo ' # add sudo prefix
|
||||
ssh_cmd << 'sudo ' # add sudo prefix
|
||||
end
|
||||
end
|
||||
end
|
||||
@ -175,7 +175,7 @@ module VagrantPlugins
|
||||
kill_cmd = ''
|
||||
|
||||
if tag[:port] <= 1024
|
||||
kill_cmd << 'sudo ' # add sudo prefix
|
||||
kill_cmd << 'sudo ' # add sudo prefix
|
||||
end
|
||||
|
||||
kill_cmd << "kill #{tag[:pid]}"
|
||||
|
@ -39,7 +39,7 @@ module VagrantPlugins
|
||||
#
|
||||
# @param [Machine] machine
|
||||
# @return [String]
|
||||
def read_host_ip(ip)
|
||||
def read_host_ip(ip)
|
||||
UDPSocket.open do |s|
|
||||
if(ip.kind_of?(Array))
|
||||
s.connect(ip.last, 1)
|
||||
|
@ -173,10 +173,10 @@ module VagrantPlugins
|
||||
@nic_adapter_count = UNSET_VALUE
|
||||
|
||||
# Boot order
|
||||
@boot_order = []
|
||||
@boot_order = []
|
||||
# Storage
|
||||
@disks = []
|
||||
@cdroms = []
|
||||
@cdroms = []
|
||||
|
||||
# Inputs
|
||||
@inputs = UNSET_VALUE
|
||||
@ -198,15 +198,15 @@ module VagrantPlugins
|
||||
end
|
||||
|
||||
def boot(device)
|
||||
@boot_order << device # append
|
||||
@boot_order << device # append
|
||||
end
|
||||
|
||||
def _get_device(disks)
|
||||
# skip existing devices and also the first one (vda)
|
||||
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
|
||||
dev = skip.vdev # get lettered device
|
||||
dev = skip.vdev # get lettered device
|
||||
if !exist.include?(dev)
|
||||
return dev
|
||||
end
|
||||
@ -363,7 +363,7 @@ module VagrantPlugins
|
||||
options = {
|
||||
:device => _get_device(@disks),
|
||||
:type => 'qcow2',
|
||||
:size => '10G', # matches the fog default
|
||||
:size => '10G', # matches the fog default
|
||||
:path => nil,
|
||||
:bus => 'virtio'
|
||||
}.merge(options)
|
||||
@ -378,7 +378,7 @@ module VagrantPlugins
|
||||
:allow_existing => options[:allow_existing],
|
||||
}
|
||||
|
||||
@disks << disk # append
|
||||
@disks << disk # append
|
||||
end
|
||||
|
||||
# code to generate URI from a config moved out of the connect action
|
||||
@ -397,7 +397,7 @@ module VagrantPlugins
|
||||
raise "Require specify driver #{uri}"
|
||||
end
|
||||
if uri == 'kvm'
|
||||
uri = 'qemu' # use qemu uri for kvm domain type
|
||||
uri = 'qemu' # use qemu uri for kvm domain type
|
||||
end
|
||||
|
||||
if @connect_via_ssh
|
||||
|
@ -1,13 +1,13 @@
|
||||
<interface type='network'>
|
||||
<source network='<%= @network_name %>'/>
|
||||
<% if @mac %>
|
||||
<mac address='<%= @mac %>'/>
|
||||
<% end %>
|
||||
<% if @device_name %>
|
||||
<target dev='<%= @device_name %>'/>
|
||||
<% else %>
|
||||
<target dev='vnet<%= @iface_number %>'/>
|
||||
<% end %>
|
||||
<% if @mac %>
|
||||
<mac address='<%= @mac %>'/>
|
||||
<% end %>
|
||||
<% if @device_name %>
|
||||
<target dev='<%= @device_name %>'/>
|
||||
<% else %>
|
||||
<target dev='vnet<%= @iface_number %>'/>
|
||||
<% end %>
|
||||
<alias name='net<%= @iface_number %>'/>
|
||||
<model type='<%=@model_type%>'/>
|
||||
</interface>
|
||||
|
@ -12,17 +12,17 @@
|
||||
|
||||
# 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."
|
||||
exit 1
|
||||
echo "Usage: $0 <hostname>"
|
||||
echo "Hostname should be in format vagrant-[os-name], e.g. vagrant-redhat63."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
# On which version of RedHet are we running?
|
||||
RHEL_MAJOR_VERSION=$(sed 's/.*release \([0-9]\)\..*/\1/' /etc/redhat-release)
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Is this a RedHat distro?"
|
||||
exit 1
|
||||
echo "Is this a RedHat distro?"
|
||||
exit 1
|
||||
fi
|
||||
echo "* Found RedHat ${RHEL_MAJOR_VERSION} version."
|
||||
|
||||
@ -30,9 +30,9 @@ echo "* Found RedHat ${RHEL_MAJOR_VERSION} version."
|
||||
# Setup hostname vagrant-something.
|
||||
FQDN="$1.vagrantup.com"
|
||||
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
|
||||
echo "HOSTNAME=${FQDN}" >> /etc/sysconfig/network
|
||||
echo "HOSTNAME=${FQDN}" >> /etc/sysconfig/network
|
||||
fi
|
||||
|
||||
|
||||
@ -40,11 +40,11 @@ fi
|
||||
yum -y install wget
|
||||
cd ~root
|
||||
if [ $RHEL_MAJOR_VERSION -eq 5 ]; then
|
||||
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"
|
||||
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"
|
||||
else
|
||||
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"
|
||||
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"
|
||||
fi
|
||||
rpm -i ~root/${EPEL_PKG}
|
||||
rm -f ~root/${EPEL_PKG}
|
||||
@ -60,9 +60,9 @@ chkconfig sshd on
|
||||
echo 'vagrant' | passwd --stdin root
|
||||
grep 'vagrant' /etc/passwd > /dev/null
|
||||
if [ $? -ne 0 ]; then
|
||||
echo '* Creating user vagrant.'
|
||||
useradd vagrant
|
||||
echo 'vagrant' | passwd --stdin vagrant
|
||||
echo '* Creating user vagrant.'
|
||||
useradd vagrant
|
||||
echo 'vagrant' | passwd --stdin vagrant
|
||||
fi
|
||||
grep '^admin:' /etc/group > /dev/null || groupadd admin
|
||||
usermod -G admin vagrant
|
||||
|
Loading…
Reference in New Issue
Block a user