Merge pull request #1536 with maintenance improvements

Simple maintenance improvements
This commit is contained in:
Darragh Bailey
2022-08-10 10:17:25 +01:00
committed by GitHub
30 changed files with 59 additions and 61 deletions

View File

@@ -24,9 +24,9 @@ group :development do
vagrant_gem_version = Gem::Version.new('2.2.8') vagrant_gem_version = Gem::Version.new('2.2.8')
end end
vagrant_spec_verison = ENV['VAGRANT_SPEC_VERSION'] vagrant_spec_version = ENV['VAGRANT_SPEC_VERSION']
if !vagrant_spec_verison.nil? && !vagrant_spec_verison.empty? if !vagrant_spec_version.nil? && !vagrant_spec_version.empty?
gem 'vagrant-spec', :git => 'https://github.com/hashicorp/vagrant-spec', :ref => vagrant_spec_verison gem 'vagrant-spec', :git => 'https://github.com/hashicorp/vagrant-spec', :ref => vagrant_spec_version
elsif vagrant_gem_version <= Gem::Version.new('2.2.7') elsif vagrant_gem_version <= Gem::Version.new('2.2.7')
gem 'vagrant-spec', :git => 'https://github.com/hashicorp/vagrant-spec', :ref => '161128f2216cee8edb7bcd30da18bd4dea86f98a' gem 'vagrant-spec', :git => 'https://github.com/hashicorp/vagrant-spec', :ref => '161128f2216cee8edb7bcd30da18bd4dea86f98a'
else else

Binary file not shown.

Before

Width:  |  Height:  |  Size: 60 KiB

After

Width:  |  Height:  |  Size: 53 KiB

View File

@@ -8,8 +8,8 @@ chmod a+x ./install.bash
* Alternatively install vagrant following [https://www.vagrantup.com/downloads](https://www.vagrantup.com/downloads): * Alternatively install vagrant following [https://www.vagrantup.com/downloads](https://www.vagrantup.com/downloads):
{% if include.distro == "debian" or include.distro == "ubuntu" -%} {% if include.distro == "debian" or include.distro == "ubuntu" -%}
```shell ```shell
curl -fsSL https://apt.releases.hashicorp.com/gpg | sudo apt-key add - curl -fsSL https://apt.releases.hashicorp.com/gpg | sudo tee /usr/share/keyrings/hashicorp-archive-keyring.asc
sudo apt-add-repository "deb [arch=amd64] https://apt.releases.hashicorp.com $(lsb_release -cs) main" echo "deb [ signed-by=/usr/share/keyrings/hashicorp-archive-keyring.asc ] https://apt.releases.hashicorp.com $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/hashicorp.list
sudo apt-get update && sudo apt-get install vagrant sudo apt-get update && sudo apt-get install vagrant
``` ```
{% elsif include.distro == "fedora" -%} {% elsif include.distro == "fedora" -%}

View File

@@ -82,7 +82,7 @@ end
`disk_bus` is set to `scsi` or `disk_device` starts with `sd`, which is a hint `disk_bus` is set to `scsi` or `disk_device` starts with `sd`, which is a hint
to use scsi. Defaults to `virtio-scsi` when it encounters either of the to use scsi. Defaults to `virtio-scsi` when it encounters either of the
config values for `disk_bus` or `disk_device`. See [libvirt controller models]( config values for `disk_bus` or `disk_device`. See [libvirt controller models](
https://libvirt.org/formatdomain.html#controllers) for other posible values. https://libvirt.org/formatdomain.html#controllers) for other possible values.
NOTE: this option applies only to the disks associated with a box image. NOTE: this option applies only to the disks associated with a box image.
* `disk_device` - The disk device to emulate. Defaults to vda if not * `disk_device` - The disk device to emulate. Defaults to vda if not
set, which should be fine for paravirtualized guests, but some fully set, which should be fine for paravirtualized guests, but some fully
@@ -418,7 +418,7 @@ starts with `libvirt__` string. Here is a list of those options:
only when dhcp is enabled.By default is the same host that runs the DHCP only when dhcp is enabled.By default is the same host that runs the DHCP
server. server.
* `:libvirt__tftp_root` - Path to the root directory served via TFTP. * `:libvirt__tftp_root` - Path to the root directory served via TFTP.
* `:libvirt__adapter` - Number specifiyng sequence number of interface. * `:libvirt__adapter` - Number specifying sequence number of interface.
* `:libvirt__forward_mode` - Specify one of `veryisolated`, `none`, `open`, `nat` * `:libvirt__forward_mode` - Specify one of `veryisolated`, `none`, `open`, `nat`
or `route` options. This option is used only when creating new network. Mode or `route` options. This option is used only when creating new network. Mode
`none` will create isolated network without NATing or routing outside. You `none` will create isolated network without NATing or routing outside. You
@@ -472,7 +472,7 @@ starts with `libvirt__` string. Here is a list of those options:
* `:libvirt__driver_name` - Define which network driver to use. [More * `:libvirt__driver_name` - Define which network driver to use. [More
info](https://libvirt.org/formatdomain.html#elementsDriverBackendOptions) info](https://libvirt.org/formatdomain.html#elementsDriverBackendOptions)
* `:libvirt__driver_queues` - Define a number of queues to be used for network * `:libvirt__driver_queues` - Define a number of queues to be used for network
interface. Set equal to numer of vCPUs for best performance. [More interface. Set equal to number of vCPUs for best performance. [More
info](http://www.linux-kvm.org/page/Multiqueue) info](http://www.linux-kvm.org/page/Multiqueue)
* `:autostart` - Automatic startup of network by the Libvirt daemon. * `:autostart` - Automatic startup of network by the Libvirt daemon.
If not specified the default is 'false'. If not specified the default is 'false'.
@@ -549,7 +549,7 @@ the corresponding IP address.
It is also possible to use the Qemu Agent to extract the management interface It is also possible to use the Qemu Agent to extract the management interface
configuration from the booted virtual machine. This is helpful in libvirt configuration from the booted virtual machine. This is helpful in libvirt
environments where no local dnsmasq is used for automatic address assigment, environments where no local dnsmasq is used for automatic address assignment,
but external dhcp services via bridged libvirt networks. but external dhcp services via bridged libvirt networks.
Prerequisite is to enable the qemu agent channel via ([Libvirt communication Prerequisite is to enable the qemu agent channel via ([Libvirt communication
@@ -582,7 +582,7 @@ to setup a bridged host network manually and define it via
You can create and attach additional disks to a VM via `libvirt.storage :file`. You can create and attach additional disks to a VM via `libvirt.storage :file`.
It has a number of options: It has a number of options:
* `path` - Location of the disk image. If unspecified, a path is automtically * `path` - Location of the disk image. If unspecified, a path is automatically
chosen in the same storage pool as the VMs primary disk. chosen in the same storage pool as the VMs primary disk.
* `device` - Name of the device node the disk image will have in the VM, e.g. * `device` - Name of the device node the disk image will have in the VM, e.g.
*vdb*. If unspecified, the next available device is chosen. *vdb*. If unspecified, the next available device is chosen.
@@ -705,7 +705,7 @@ Vagrant.configure("2") do |config|
config.vm.provider :libvirt do |libvirt| config.vm.provider :libvirt do |libvirt|
libvirt.pci :domain => '0x0000', :bus => '0x06', :slot => '0x12', :function => '0x5' libvirt.pci :domain => '0x0000', :bus => '0x06', :slot => '0x12', :function => '0x5'
# Add another one if it is neccessary # Add another one if it is necessary
libvirt.pci :domain => '0x0000', :bus => '0x03', :slot => '0x00', :function => '0x0' libvirt.pci :domain => '0x0000', :bus => '0x03', :slot => '0x00', :function => '0x0'
end end
end end
@@ -808,7 +808,7 @@ Note that in order to enable USB redirection with Spice clients,
you may need to also set `libvirt.graphics_type = "spice"` you may need to also set `libvirt.graphics_type = "spice"`
#### Filter for USB Redirector Devices #### Filter for USB Redirector Devices
You can define filter for redirected devices. These filters can be positiv or negative, by setting the mandatory option `allow=yes` or `allow=no`. All available options are listed below. Note the option `allow` is mandatory. You can define filter for redirected devices. These filters can be positive or negative, by setting the mandatory option `allow=yes` or `allow=no`. All available options are listed below. Note the option `allow` is mandatory.
* `class` - The device class of the USB device. A list of device classes is available on [Wikipedia](https://en.wikipedia.org/wiki/USB#Device_classes). * `class` - The device class of the USB device. A list of device classes is available on [Wikipedia](https://en.wikipedia.org/wiki/USB#Device_classes).
* `vendor` - The vendor of the USB device. * `vendor` - The vendor of the USB device.
@@ -901,7 +901,7 @@ end
``` ```
## Smartcard device ## Smartcard device
A virtual smartcard device can be supplied to the guest via the `libvirt.smartcard` element. The option `mode` is mandatory and currently only value `passthrough` is supported. The value `spicevmc` for option `type` is default value and can be supressed. On using `type = tcp`, the options `source_mode`, `source_host` and `source_service` are mandatory. A virtual smartcard device can be supplied to the guest via the `libvirt.smartcard` element. The option `mode` is mandatory and currently only value `passthrough` is supported. The value `spicevmc` for option `type` is default value and can be suppressed. On using `type = tcp`, the options `source_mode`, `source_host` and `source_service` are mandatory.
```ruby ```ruby
Vagrant.configure("2") do |config| Vagrant.configure("2") do |config|

View File

@@ -95,7 +95,7 @@ that due to a well known limitation only the TCP protocol is supported. For
each `forwarded_port` directive you specify in your Vagrantfile, each `forwarded_port` directive you specify in your Vagrantfile,
vagrant-libvirt will maintain an active ssh process for the lifetime of the VM. vagrant-libvirt will maintain an active ssh process for the lifetime of the VM.
If your VM should happen to be rebooted, the SSH session will need to be If your VM should happen to be rebooted, the SSH session will need to be
restablished by halting the VM and bringing it back up. re-established by halting the VM and bringing it back up.
vagrant-libvirt supports an additional `forwarded_port` option `gateway_ports` vagrant-libvirt supports an additional `forwarded_port` option `gateway_ports`
which defaults to `false`, but can be set to `true` if you want the forwarded which defaults to `false`, but can be set to `true` if you want the forwarded

View File

@@ -396,7 +396,7 @@ git checkout imports/c8s/libssh-0.9.4-1.el8
into_srpm.sh -d c8s into_srpm.sh -d c8s
cd SRPMS cd SRPMS
# common commands (make sure to adjust verison accordingly) # common commands (make sure to adjust version accordingly)
rpm2cpio libssh-0.9.4-1c8s.src.rpm | cpio -imdV rpm2cpio libssh-0.9.4-1c8s.src.rpm | cpio -imdV
tar xf libssh-0.9.4.tar.xz tar xf libssh-0.9.4.tar.xz
mkdir build mkdir build
@@ -428,7 +428,7 @@ get_sources.sh
into_srpm.sh -d c8s into_srpm.sh -d c8s
cd SRPMS cd SRPMS
# common commands (make sure to adjust verison accordingly) # common commands (make sure to adjust version accordingly)
rpm2cpio krb5-1.18.2-8c8s.src.rpm | cpio -imdV rpm2cpio krb5-1.18.2-8c8s.src.rpm | cpio -imdV
tar xf krb5-1.18.2.tar.gz tar xf krb5-1.18.2.tar.gz
cd krb5-1.18.2/src cd krb5-1.18.2/src

View File

@@ -119,7 +119,7 @@ done
# make sure the directories can be written to by vagrant otherwise will # make sure the directories can be written to by vagrant otherwise will
# get a start up error # get a start up error
find ${VAGRANT_HOME} -maxdepth 1 ! -exec chown -h ${USER}:${GROUP} {} \+ find "${VAGRANT_HOME}" -maxdepth 1 ! -exec chown -h ${USER}:${GROUP} {} \+
LIBVIRT_SOCK=/var/run/libvirt/libvirt-sock LIBVIRT_SOCK=/var/run/libvirt/libvirt-sock
if [[ ! -S ${LIBVIRT_SOCK} ]] if [[ ! -S ${LIBVIRT_SOCK} ]]

View File

@@ -59,4 +59,3 @@ Vagrant.configure("2") do |config|
#libvirt.default_prefix = '' #libvirt.default_prefix = ''
end end
end end

View File

@@ -162,7 +162,7 @@ module VagrantPlugins
# Start it.. # Start it..
b3.use StartDomain b3.use StartDomain
# Machine should gain IP address when comming up, # Machine should gain IP address when coming up,
# so wait for dhcp lease and store IP into machines data_dir. # so wait for dhcp lease and store IP into machines data_dir.
b3.use WaitTillUp b3.use WaitTillUp
require 'vagrant/action/builtin/wait_for_communicator' require 'vagrant/action/builtin/wait_for_communicator'

View File

@@ -41,7 +41,7 @@ module VagrantPlugins
# Vagrant gives you adapter 0 by default # Vagrant gives you adapter 0 by default
# Assign interfaces to slots. # Assign interfaces to slots.
configured_networks(env, @logger).each do |options| configured_networks(env, @logger).each do |options|
# dont need to create interface for this type # don't need to create interface for this type
next if options[:iface_type] == :forwarded_port next if options[:iface_type] == :forwarded_port
# TODO: fill first ifaces with adapter option specified. # TODO: fill first ifaces with adapter option specified.

View File

@@ -44,7 +44,7 @@ module VagrantPlugins
end end
# only one vm at a time should try to set up networks # only one vm at a time should try to set up networks
# otherwise they'll have inconsitent views of current state # otherwise they'll have inconsistent views of current state
# and conduct redundant operations that cause errors # and conduct redundant operations that cause errors
@@lock.synchronize do @@lock.synchronize do
# Iterate over networks If some network is not # Iterate over networks If some network is not
@@ -124,7 +124,7 @@ module VagrantPlugins
# Throw an error if dhcp setting for an existing network does not # Throw an error if dhcp setting for an existing network does not
# match what was configured in the vagrantfile # match what was configured in the vagrantfile
# since we always enable dhcp for the management network # since we always enable dhcp for the management network
# this ensures we wont start a vm vagrant cant reach # this ensures we won't start a vm vagrant can't reach
# Allow the situation where DHCP is not requested (:libvirt__dhcp_enabled == false) # Allow the situation where DHCP is not requested (:libvirt__dhcp_enabled == false)
# but where it is enabled on the virtual network # but where it is enabled on the virtual network
def verify_dhcp def verify_dhcp

View File

@@ -50,7 +50,7 @@ module VagrantPlugins
if e.libvirt_code == ProviderLibvirt::Util::ErrorCodes::VIR_ERR_NO_NETWORK if e.libvirt_code == ProviderLibvirt::Util::ErrorCodes::VIR_ERR_NO_NETWORK
@logger.info 'It is already undefined' @logger.info 'It is already undefined'
next next
# some other error occured, so raise it again # some other error occurred, so raise it again
else else
raise e raise e
end end

View File

@@ -64,7 +64,7 @@ module VagrantPlugins
disk_target.parent.delete_element("#{disk_target.parent.xpath}/address") disk_target.parent.delete_element("#{disk_target.parent.xpath}/address")
end end
# Iterface type # Interface type
unless config.nic_model_type.nil? unless config.nic_model_type.nil?
REXML::XPath.each(xml_descr, '/domain/devices/interface/model') do |iface_model| REXML::XPath.each(xml_descr, '/domain/devices/interface/model') do |iface_model|
if iface_model.attributes['type'] != config.nic_model_type if iface_model.attributes['type'] != config.nic_model_type

View File

@@ -11,7 +11,7 @@ module VagrantPlugins
module ProviderLibvirt module ProviderLibvirt
class Config < Vagrant.plugin('2', :config) class Config < Vagrant.plugin('2', :config)
# manually specify URI # manually specify URI
# will supercede most other options if provided # will supersede most other options if provided
attr_accessor :uri attr_accessor :uri
# A hypervisor name to access via Libvirt. # A hypervisor name to access via Libvirt.
@@ -1016,7 +1016,7 @@ module VagrantPlugins
end end
if @qemu_use_agent == true if @qemu_use_agent == true
# if qemu agent is used to optain domain ip configuration, at least # if qemu agent is used to obtain domain ip configuration, at least
# one qemu channel has to be configured. As there are various options, # one qemu channel has to be configured. As there are various options,
# error out and leave configuration to the user # error out and leave configuration to the user
unless machine.provider_config.channels.any? { |channel| channel[:target_name].start_with?("org.qemu.guest_agent") } unless machine.provider_config.channels.any? { |channel| channel[:target_name].start_with?("org.qemu.guest_agent") }

View File

@@ -239,7 +239,7 @@ module VagrantPlugins
interface['ip-addresses'].each do |ip| interface['ip-addresses'].each do |ip|
# returning ipv6 addresses might break windows guests because # returning ipv6 addresses might break windows guests because
# winrm cant handle connection, winrm fails with "invalid uri" # winrm can't handle connection, winrm fails with "invalid uri"
next unless ip['ip-address-type'] == 'ipv4' next unless ip['ip-address-type'] == 'ipv4'
ip_address = ip['ip-address'] ip_address = ip['ip-address']

View File

@@ -52,7 +52,7 @@ module VagrantPlugins
# :username => "mitchellh", # :username => "mitchellh",
# :private_key_path => "/path/to/my/key" # :private_key_path => "/path/to/my/key"
# } # }
# note that modifing @machine.id or accessing @machine.state is not # note that modifying @machine.id or accessing @machine.state is not
# thread safe, so be careful to avoid these here as this method may # thread safe, so be careful to avoid these here as this method may
# be called from other threads of execution. # be called from other threads of execution.
return nil if state.id != :running return nil if state.id != :running

View File

@@ -68,4 +68,3 @@ class ByteNumber < Numeric
(to_f/(1024 ** n)).ceil (to_f/(1024 ** n)).ceil
end end
end end

View File

@@ -16,7 +16,7 @@ en:
Created volume larger than box defaults, will require manual resizing of Created volume larger than box defaults, will require manual resizing of
filesystems to utilize. filesystems to utilize.
box_version_missing: |- box_version_missing: |-
No verison detected for %{name}, using timestamp to watch for modifications. Consider No version detected for %{name}, using timestamp to watch for modifications. Consider
generating a local metadata for the box with a version to allow better handling. generating a local metadata for the box with a version to allow better handling.
See https://www.vagrantup.com/docs/boxes/format#box-metadata for further details. See https://www.vagrantup.com/docs/boxes/format#box-metadata for further details.
uploading_volume: |- uploading_volume: |-

View File

@@ -104,7 +104,7 @@ describe VagrantPlugins::ProviderLibvirt::Action::HandleBoxImage do
it 'should use the box file timestamp' do it 'should use the box file timestamp' do
expect(ui).to receive(:warn).with( expect(ui).to receive(:warn).with(
"No verison detected for test, using timestamp to watch for modifications. Consider\n" + "No version detected for test, using timestamp to watch for modifications. Consider\n" +
"generating a local metadata for the box with a version to allow better handling.\n" + "generating a local metadata for the box with a version to allow better handling.\n" +
'See https://www.vagrantup.com/docs/boxes/format#box-metadata for further details.' 'See https://www.vagrantup.com/docs/boxes/format#box-metadata for further details.'
) )
@@ -134,7 +134,7 @@ describe VagrantPlugins::ProviderLibvirt::Action::HandleBoxImage do
end end
it 'should use the box file timestamp' do it 'should use the box file timestamp' do
expect(ui).to receive(:warn).with(/No verison detected for test/) expect(ui).to receive(:warn).with(/No version detected for test/)
expect(subject.call(env)).to be_nil expect(subject.call(env)).to be_nil
expect(env[:box_volume_number]).to eq(1) expect(env[:box_volume_number]).to eq(1)

View File

@@ -197,7 +197,7 @@ describe VagrantPlugins::ProviderLibvirt::Driver do
allow(machine.provider_config).to receive(:qemu_use_session).and_return(true) allow(machine.provider_config).to receive(:qemu_use_session).and_return(true)
end end
it 'should retreive the address via the system dhcp-leases API' do it 'should retrieve the address via the system dhcp-leases API' do
expect(domain).to receive(:mac).and_return("52:54:00:8b:dc:5f") expect(domain).to receive(:mac).and_return("52:54:00:8b:dc:5f")
expect(subject).to receive(:system_connection).and_return(system_connection1) expect(subject).to receive(:system_connection).and_return(system_connection1)
expect(system_connection1).to receive(:list_all_networks).and_return(networks) expect(system_connection1).to receive(:list_all_networks).and_return(networks)

View File

@@ -67,7 +67,7 @@ mkdir -p "$TMP_DIR"
[[ ! -r "$IMG" ]] && error "'$IMG': Permission denied" [[ ! -r "$IMG" ]] && error "'$IMG': Permission denied"
if [ -n "$3" ] && [ -r "$3" ]; then if [ -n "$3" ] && [ -r "$3" ]; then
VAGRANTFILE_ADD="$(cat $3)" VAGRANTFILE_ADD="$(cat "$3")"
fi fi
# We move / copy (when the image has master) the image to the tempdir # We move / copy (when the image has master) the image to the tempdir