vagrant-libvirt 0.10.8 → 0.11.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +44 -7
- data/lib/vagrant-libvirt/action/create_domain.rb +45 -22
- data/lib/vagrant-libvirt/action/create_domain_volume.rb +3 -0
- data/lib/vagrant-libvirt/action/create_network_interfaces.rb +15 -5
- data/lib/vagrant-libvirt/action/create_networks.rb +2 -6
- data/lib/vagrant-libvirt/action/destroy_domain.rb +2 -10
- data/lib/vagrant-libvirt/action/forward_ports.rb +1 -1
- data/lib/vagrant-libvirt/action/prepare_nfs_settings.rb +7 -5
- data/lib/vagrant-libvirt/action/resolve_disk_settings.rb +2 -0
- data/lib/vagrant-libvirt/action/snapshot_delete.rb +1 -1
- data/lib/vagrant-libvirt/action/snapshot_restore.rb +1 -1
- data/lib/vagrant-libvirt/action/snapshot_save.rb +1 -2
- data/lib/vagrant-libvirt/action/start_domain.rb +149 -62
- data/lib/vagrant-libvirt/action/wait_till_up.rb +2 -2
- data/lib/vagrant-libvirt/action.rb +18 -13
- data/lib/vagrant-libvirt/cap/mount_9p.rb +9 -1
- data/lib/vagrant-libvirt/cap/snapshots.rb +1 -1
- data/lib/vagrant-libvirt/config.rb +198 -26
- data/lib/vagrant-libvirt/driver.rb +94 -55
- data/lib/vagrant-libvirt/provider.rb +4 -4
- data/lib/vagrant-libvirt/templates/domain.xml.erb +73 -27
- data/lib/vagrant-libvirt/templates/public_interface.xml.erb +6 -3
- data/lib/vagrant-libvirt/util/network_util.rb +5 -10
- data/lib/vagrant-libvirt/version +1 -1
- data/locales/en.yml +2 -0
- data/spec/acceptance/additional_storage_spec.rb +1 -4
- data/spec/acceptance/networking_spec.rb +41 -0
- data/spec/acceptance/package_domain_spec.rb +2 -2
- data/spec/acceptance/provider_settings_spec.rb +1 -1
- data/spec/acceptance/simple_vm_provision_via_shell_spec.rb +1 -1
- data/spec/acceptance/snapshots_spec.rb +1 -1
- data/spec/acceptance/two_disks_spec.rb +1 -1
- data/spec/acceptance/use_qemu_agent_for_connectivity_spec.rb +1 -1
- data/spec/spec_helper.rb +31 -8
- data/spec/support/acceptance/isolated_environment.rb +1 -1
- data/spec/support/environment_helper.rb +1 -1
- data/spec/support/libvirt_acceptance_context.rb +15 -1
- data/spec/support/{sharedcontext.rb → unit_context.rb} +20 -5
- data/spec/unit/action/clean_machine_folder_spec.rb +1 -2
- data/spec/unit/action/cleanup_on_failure_spec.rb +1 -2
- data/spec/unit/action/create_domain_spec/additional_disks_domain.xml +4 -2
- data/spec/unit/action/create_domain_spec/custom_disk_settings.xml +4 -2
- data/spec/unit/action/create_domain_spec/default_domain.xml +4 -2
- data/spec/unit/action/create_domain_spec/sysinfo.xml +4 -2
- data/spec/unit/action/create_domain_spec/sysinfo_only_required.xml +4 -2
- data/spec/unit/action/create_domain_spec/two_disk_settings.xml +4 -2
- data/spec/unit/action/create_domain_spec.rb +51 -3
- data/spec/unit/action/create_domain_volume_spec.rb +2 -4
- data/spec/unit/action/destroy_domain_spec/additional_disks_domain.xml +1 -0
- data/spec/unit/action/destroy_domain_spec/box_multiple_disks.xml +1 -0
- data/spec/unit/action/destroy_domain_spec/box_multiple_disks_and_additional_and_custom_disks.xml +1 -0
- data/spec/unit/action/destroy_domain_spec/box_multiple_disks_and_additional_and_custom_disks_no_aliases.xml +1 -0
- data/spec/unit/action/destroy_domain_spec/box_multiple_disks_and_additional_disks.xml +1 -0
- data/spec/unit/action/destroy_domain_spec/cdrom_domain.xml +1 -0
- data/spec/unit/action/destroy_domain_spec.rb +1 -18
- data/spec/unit/action/forward_ports_spec.rb +1 -3
- data/spec/unit/action/halt_domain_spec.rb +2 -3
- data/spec/unit/action/handle_box_image_spec.rb +3 -4
- data/spec/unit/action/package_domain_spec.rb +2 -3
- data/spec/unit/action/prepare_nfs_settings_spec.rb +25 -9
- data/spec/unit/action/remove_libvirt_image_spec.rb +1 -2
- data/spec/unit/action/resolve_disk_settings_spec/default_domain.xml +1 -0
- data/spec/unit/action/resolve_disk_settings_spec/default_no_aliases.xml +1 -0
- data/spec/unit/action/resolve_disk_settings_spec/multi_volume_box.xml +1 -0
- data/spec/unit/action/resolve_disk_settings_spec/multi_volume_box_additional_and_custom_no_aliases.xml +1 -0
- data/spec/unit/action/resolve_disk_settings_spec/multi_volume_box_additional_storage.xml +1 -0
- data/spec/unit/action/resolve_disk_settings_spec.rb +1 -1
- data/spec/unit/action/set_boot_order_spec/default.xml +1 -0
- data/spec/unit/action/set_boot_order_spec/explicit_boot_order.xml +1 -0
- data/spec/unit/action/set_boot_order_spec.rb +1 -3
- data/spec/unit/action/set_name_of_domain_spec.rb +3 -1
- data/spec/unit/action/shutdown_domain_spec.rb +4 -3
- data/spec/unit/action/start_domain_spec/clock_timer_removed.xml +1 -1
- data/spec/unit/action/start_domain_spec/clock_timer_rtc.xml +1 -1
- data/spec/unit/action/start_domain_spec/clock_timer_rtc_tsc.xml +1 -1
- data/spec/unit/action/start_domain_spec/default.xml +1 -1
- data/spec/unit/action/start_domain_spec/default_added_tpm_path.xml +1 -1
- data/spec/unit/action/start_domain_spec/default_added_tpm_version.xml +1 -1
- data/spec/unit/action/start_domain_spec/default_with_different_formatting.xml +1 -1
- data/spec/unit/action/start_domain_spec/existing.xml +2 -1
- data/spec/unit/action/start_domain_spec/existing_added_nvram.xml +2 -1
- data/spec/unit/action/start_domain_spec/existing_reordered.xml +2 -1
- data/spec/unit/action/start_domain_spec/nvram_domain.xml +1 -0
- data/spec/unit/action/start_domain_spec/nvram_domain_other_setting.xml +2 -1
- data/spec/unit/action/start_domain_spec/nvram_domain_removed.xml +2 -1
- data/spec/unit/action/start_domain_spec.rb +192 -3
- data/spec/unit/action/wait_till_up_spec.rb +3 -5
- data/spec/unit/action_spec.rb +403 -10
- data/spec/unit/cap/mount_9p_spec.rb +75 -0
- data/spec/unit/cap/synced_folder_9p_spec.rb +1 -2
- data/spec/unit/cap/synced_folder_virtiofs_spec.rb +1 -2
- data/spec/unit/config_spec.rb +365 -25
- data/spec/unit/driver_spec.rb +217 -80
- data/spec/unit/plugin_spec.rb +6 -3
- data/spec/unit/templates/domain_all_settings.xml +26 -4
- data/spec/unit/templates/domain_cpu_mode_passthrough.xml +4 -2
- data/spec/unit/templates/domain_custom_cpu_model.xml +4 -2
- data/spec/unit/templates/domain_defaults.xml +4 -2
- data/spec/unit/templates/domain_scsi_bus_storage.xml +4 -2
- data/spec/unit/templates/domain_scsi_device_storage.xml +4 -2
- data/spec/unit/templates/domain_scsi_multiple_controllers_storage.xml +4 -2
- data/spec/unit/templates/domain_spec.rb +11 -3
- data/spec/unit/templates/tpm/version_1.2.xml +4 -2
- data/spec/unit/templates/tpm/version_2.0.xml +4 -2
- data/spec/unit/util/byte_number_spec.rb +1 -1
- data/spec/unit/util/network_util_spec/default.xml +16 -0
- data/spec/unit/util/network_util_spec/hostdev.xml +6 -0
- data/spec/unit/util/network_util_spec/vagrant-libvirt.xml +16 -0
- data/spec/unit/util/network_util_spec.rb +59 -0
- data/spec/unit/util/resolvers_spec.rb +1 -1
- metadata +85 -73
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: def1435c7bf9fcebb8ca2b0c038317b14b3ab02c42582257a27e97b84dbb57bb
|
4
|
+
data.tar.gz: abf0b94e5bd4d6c279fab842844c0d86b97b34382f898f0564a7251453f369c0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bbff78a2c9409e800da340ad264aa846cfe31934e36296c46ccf9e352849343f80c042038e35eb65a2643bdbc6330c9f1f3e21060847d3121ccb21ab5fe71c00
|
7
|
+
data.tar.gz: b605b592f7c0d4fe024c63b0f2a9d2618cb54a72550f2c9f6489f92a8ba09f083153bb3c522309b8363969775b38815b2bd9a55dd8ff8251e9a04577cb126ec2
|
data/README.md
CHANGED
@@ -16,11 +16,19 @@ can help a lot :-)
|
|
16
16
|
|
17
17
|
Vagrant-libvirt Documentation is published at [https://vagrant-libvirt.github.io/vagrant-libvirt/](https://vagrant-libvirt.github.io/vagrant-libvirt/)
|
18
18
|
|
19
|
+
## QA status
|
20
|
+
|
21
|
+
We periodically test basic functionality for vagrant-libvirt on various distributions.
|
22
|
+
In the status badges below, build passing means that latest version of Vagrant + Vagrant-libvirt was installed correctly and `vagrant up` is working. Click the badge to review the action workflow.
|
23
|
+
|
24
|
+
[![](http://github-actions.40ants.com/vagrant-libvirt/vagrant-libvirt-qa/matrix.svg?only=Distribution%20Install.verify-install)](https://github.com/vagrant-libvirt/vagrant-libvirt-qa/actions/workflows/distro-install.yml)
|
25
|
+
|
19
26
|
## Index
|
20
27
|
|
21
28
|
<!-- vim-markdown-toc GFM -->
|
22
29
|
|
23
30
|
* [Installing](#installing)
|
31
|
+
* [Latest development version](#latest-development-version)
|
24
32
|
* [Running](#running)
|
25
33
|
* [Development](#development)
|
26
34
|
* [Contributing](#contributing)
|
@@ -32,6 +40,27 @@ Vagrant-libvirt Documentation is published at [https://vagrant-libvirt.github.io
|
|
32
40
|
Installation typically involves a number of distribution package dependencies to ensure that Libvirt is available.
|
33
41
|
Recommend that you follow the [installation guide](https://vagrant-libvirt.github.io/vagrant-libvirt/installation.html).
|
34
42
|
|
43
|
+
### Latest development version
|
44
|
+
|
45
|
+
If you want to try out the very latest development version you can download the gem package from the GitHub
|
46
|
+
rubygems package [repository](https://github.com/vagrant-libvirt/vagrant-libvirt/packages/1659776) under the
|
47
|
+
asserts. Unfortunately it's not yet possible to make the rubygem repositories in GitHub public.
|
48
|
+
|
49
|
+
To install provide the file directly to the install command:
|
50
|
+
```
|
51
|
+
vagrant plugin install ./vagrant-libvirt-<version>.gem
|
52
|
+
```
|
53
|
+
|
54
|
+
It is possible to install directly from the GitHub rubygems package repository, however this will embedded
|
55
|
+
your GitHub token directly into the file `~/.vagrant.d/plugins.json`:
|
56
|
+
```
|
57
|
+
vagrant plugin install vagrant-libvirt \
|
58
|
+
--plugin-source https://${USERNAME}:${GITHUB_TOKEN}@rubygems.pkg.github.com/vagrant-libvirt \
|
59
|
+
--plugin-version "0.10.9.pre.62"
|
60
|
+
```
|
61
|
+
|
62
|
+
Provided this token is a classic token limited to `read:packages` only, this may be acceptable to you.
|
63
|
+
|
35
64
|
## Running
|
36
65
|
|
37
66
|
Once installed, use vagrant-libvirt through vagrant.
|
@@ -75,21 +104,19 @@ To work on the `vagrant-libvirt` plugin, clone this repository out, and use
|
|
75
104
|
```shell
|
76
105
|
git clone https://github.com/vagrant-libvirt/vagrant-libvirt.git
|
77
106
|
cd vagrant-libvirt
|
107
|
+
bundle config --local with development
|
108
|
+
bundle config --local path 'vendor/bundle'
|
78
109
|
bundle install
|
79
110
|
```
|
80
111
|
|
81
112
|
Once you have the dependencies, verify the unit tests pass with `rspec`:
|
82
113
|
|
83
114
|
```shell
|
84
|
-
export VAGRANT_HOME=$(mktemp -d)
|
85
115
|
bundle exec rspec --fail-fast --color --format documentation
|
86
116
|
```
|
87
117
|
|
88
118
|
If those pass, you're ready to start developing the plugin.
|
89
119
|
|
90
|
-
Setting `VAGRANT_HOME` is to avoid issues with conflicting with other
|
91
|
-
plugins/gems or data already present under `~/.vagrant.d`.
|
92
|
-
|
93
120
|
Additionally if you wish to test against a specific version of vagrant you
|
94
121
|
can control the version using the following before running the tests:
|
95
122
|
|
@@ -98,13 +125,23 @@ export VAGRANT_VERSION=v2.2.14
|
|
98
125
|
bundle update && bundle exec rspec --fail-fast --color --format documentation
|
99
126
|
```
|
100
127
|
|
128
|
+
To run the acceptance tests which involve bringing up VMs and exercising
|
129
|
+
various functionality aspects run the following (warning, may have issues if
|
130
|
+
distro ruby is newer than supported by vagrant):
|
131
|
+
```shell
|
132
|
+
bundle exec rspec --fail-fast --color --format documentation --tag acceptance
|
133
|
+
```
|
134
|
+
|
101
135
|
**Note** rvm is used by the maintainers to help provide an environment to test
|
102
136
|
against multiple ruby versions that align with the ones used by vagrant for
|
103
137
|
their embedded ruby depending on the release. You can see what version is used
|
104
138
|
by looking at the current [unit tests](.github/workflows/unit-tests.yml)
|
105
139
|
workflow. By default if you have rvm installed and enabled it this project looks
|
106
|
-
to use ruby
|
107
|
-
to each time you enter the project directory.
|
140
|
+
to use ruby 3.1.2 and configures a separate gemset, both of which will be switched
|
141
|
+
to each time you enter the project directory. It should be considered sufficient
|
142
|
+
just to get any tests passing with your system ruby, and as long as you ensure
|
143
|
+
that the option to allow maintainers can update your PR, we will fix up any
|
144
|
+
issues with the remaining combinations.
|
108
145
|
|
109
146
|
You can test the plugin without installing it into your Vagrant environment by
|
110
147
|
just creating a `Vagrantfile` in the top level of this directory (it is
|
@@ -132,7 +169,7 @@ end
|
|
132
169
|
Now you can use bundler to execute Vagrant:
|
133
170
|
|
134
171
|
```shell
|
135
|
-
|
172
|
+
bundle exec vagrant up --provider=libvirt
|
136
173
|
```
|
137
174
|
|
138
175
|
**IMPORTANT NOTE:** bundle is crucial. You need to use bundled Vagrant.
|
@@ -32,11 +32,13 @@ module VagrantPlugins
|
|
32
32
|
@cpuset = config.cpuset
|
33
33
|
@cpu_features = config.cpu_features
|
34
34
|
@cpu_topology = config.cpu_topology
|
35
|
+
@cpu_affinity = config.cpu_affinity
|
35
36
|
@nodeset = config.nodeset
|
36
37
|
@features = config.features
|
37
38
|
@features_hyperv = config.features_hyperv
|
38
39
|
@clock_offset = config.clock_offset
|
39
40
|
@clock_timers = config.clock_timers
|
41
|
+
@launchsecurity_data = config.launchsecurity_data
|
40
42
|
@shares = config.shares
|
41
43
|
@cpu_mode = config.cpu_mode
|
42
44
|
@cpu_model = config.cpu_model
|
@@ -48,9 +50,12 @@ module VagrantPlugins
|
|
48
50
|
@machine_arch = config.machine_arch
|
49
51
|
@disk_controller_model = config.disk_controller_model
|
50
52
|
@disk_driver_opts = config.disk_driver_opts
|
53
|
+
@disk_address_type = config.disk_address_type
|
51
54
|
@nested = config.nested
|
52
55
|
@memory_size = config.memory.to_i * 1024
|
53
56
|
@memory_backing = config.memory_backing
|
57
|
+
@memtunes = config.memtunes
|
58
|
+
|
54
59
|
@management_network_mac = config.management_network_mac
|
55
60
|
@domain_volume_cache = config.volume_cache || 'default'
|
56
61
|
@kernel = config.kernel
|
@@ -61,6 +66,7 @@ module VagrantPlugins
|
|
61
66
|
@graphics_type = config.graphics_type
|
62
67
|
@graphics_autoport = config.graphics_autoport
|
63
68
|
@graphics_port = config.graphics_port
|
69
|
+
@graphics_websocket = config.graphics_websocket
|
64
70
|
@graphics_ip = config.graphics_ip
|
65
71
|
@graphics_passwd = config.graphics_passwd
|
66
72
|
@graphics_gl = config.graphics_gl
|
@@ -100,6 +106,7 @@ module VagrantPlugins
|
|
100
106
|
@domain_volumes = env[:domain_volumes] || []
|
101
107
|
@disks = env[:disks] || []
|
102
108
|
@cdroms = config.cdroms
|
109
|
+
@floppies = config.floppies
|
103
110
|
|
104
111
|
# Input
|
105
112
|
@inputs = config.inputs
|
@@ -206,13 +213,16 @@ module VagrantPlugins
|
|
206
213
|
env[:ui].info(" -- Domain type: #{@domain_type}")
|
207
214
|
env[:ui].info(" -- Cpus: #{@cpus}")
|
208
215
|
unless @cpuset.nil?
|
209
|
-
env[:ui].info("
|
216
|
+
env[:ui].info(" -- Cpuset: #{@cpuset}")
|
210
217
|
end
|
211
218
|
if not @cpu_topology.empty?
|
212
|
-
env[:ui].info(" -- CPU topology:
|
219
|
+
env[:ui].info(" -- CPU topology: sockets=#{@cpu_topology[:sockets]}, cores=#{@cpu_topology[:cores]}, threads=#{@cpu_topology[:threads]}")
|
220
|
+
end
|
221
|
+
@cpu_affinity.each do |vcpu, cpuset|
|
222
|
+
env[:ui].info(" -- CPU affinity: vcpu #{vcpu} => cpuset #{cpuset}")
|
213
223
|
end
|
214
224
|
@cpu_features.each do |cpu_feature|
|
215
|
-
env[:ui].info(" -- CPU
|
225
|
+
env[:ui].info(" -- CPU feature: name=#{cpu_feature[:name]}, policy=#{cpu_feature[:policy]}")
|
216
226
|
end
|
217
227
|
@features.each do |feature|
|
218
228
|
env[:ui].info(" -- Feature: #{feature}")
|
@@ -235,12 +245,18 @@ module VagrantPlugins
|
|
235
245
|
@memory_backing.each do |backing|
|
236
246
|
env[:ui].info(" -- Memory Backing: #{backing[:name]}: #{backing[:config].map { |k,v| "#{k}='#{v}'"}.join(' ')}")
|
237
247
|
end
|
248
|
+
|
249
|
+
@memtunes.each do |type, options|
|
250
|
+
env[:ui].info(" -- Memory Tuning: #{type}: #{options[:config].map { |k,v| "#{k}='#{v}'"}.join(' ')}, value: #{options[:value]}")
|
251
|
+
end
|
238
252
|
unless @shares.nil?
|
239
253
|
env[:ui].info(" -- Shares: #{@shares}")
|
240
254
|
end
|
241
|
-
env[:ui].info(" -- Management MAC: #{@management_network_mac}")
|
242
|
-
env[:ui].info(" --
|
243
|
-
env[:ui].info(" --
|
255
|
+
env[:ui].info(" -- Management MAC: #{@management_network_mac}") if @management_network_mac
|
256
|
+
env[:ui].info(" -- Kernel: #{@kernel}") if @kernel
|
257
|
+
env[:ui].info(" -- Initrd: #{@initrd}") if @initrd
|
258
|
+
env[:ui].info(" -- Loader: #{@loader}") if @loader
|
259
|
+
env[:ui].info(" -- Nvram: #{@nvram}") if @nvram
|
244
260
|
if env[:machine].config.vm.box
|
245
261
|
env[:ui].info(" -- Base box: #{env[:machine].box.name}")
|
246
262
|
end
|
@@ -255,23 +271,24 @@ module VagrantPlugins
|
|
255
271
|
env[:ui].info(" -- Disk driver opts: cache='#{@domain_volume_cache}'")
|
256
272
|
end
|
257
273
|
|
258
|
-
env[:ui].info(" -- Kernel: #{@kernel}")
|
259
|
-
env[:ui].info(" -- Initrd: #{@initrd}")
|
260
274
|
env[:ui].info(" -- Graphics Type: #{@graphics_type}")
|
261
|
-
env[:ui].info(" -- Graphics
|
262
|
-
|
263
|
-
|
275
|
+
env[:ui].info(" -- Graphics Websocket: #{@graphics_websocket}") if @graphics_websocket != -1
|
276
|
+
if !@graphics_autoport
|
277
|
+
env[:ui].info(" -- Graphics Port: #{@graphics_port}")
|
278
|
+
env[:ui].info(" -- Graphics IP: #{@graphics_ip}")
|
279
|
+
env[:ui].info(" -- Graphics Password: #{@graphics_passwd.nil? ? 'Not defined' : 'Defined'}")
|
280
|
+
end
|
264
281
|
env[:ui].info(" -- Video Type: #{@video_type}")
|
265
282
|
env[:ui].info(" -- Video VRAM: #{@video_vram}")
|
266
283
|
env[:ui].info(" -- Video 3D accel: #{@video_accel3d}")
|
267
|
-
env[:ui].info(" -- Sound Type: #{@sound_type}")
|
284
|
+
env[:ui].info(" -- Sound Type: #{@sound_type}") if @sound_type
|
268
285
|
env[:ui].info(" -- Keymap: #{@keymap}")
|
269
286
|
env[:ui].info(" -- TPM Backend: #{@tpm_type}")
|
270
287
|
if @tpm_type == 'emulator'
|
271
288
|
env[:ui].info(" -- TPM Model: #{@tpm_model}")
|
272
289
|
env[:ui].info(" -- TPM Version: #{@tpm_version}")
|
273
290
|
else
|
274
|
-
env[:ui].info(" -- TPM Path: #{@tpm_path}")
|
291
|
+
env[:ui].info(" -- TPM Path: #{@tpm_path}") if @tpm_path
|
275
292
|
end
|
276
293
|
|
277
294
|
unless @sysinfo.empty?
|
@@ -300,12 +317,12 @@ module VagrantPlugins
|
|
300
317
|
env[:ui].info(" -- Boot device: #{device}")
|
301
318
|
end
|
302
319
|
|
303
|
-
|
304
|
-
env[:ui].info(" --
|
320
|
+
if not @launchsecurity_data.nil?
|
321
|
+
env[:ui].info(" -- Launch security: #{@launchsecurity_data.map { |k, v| "#{k.to_s}=#{v}" }.join(", ")}")
|
305
322
|
end
|
306
323
|
|
307
324
|
@disks.each do |disk|
|
308
|
-
msg = " -- Disk(#{disk[:device]}):
|
325
|
+
msg = " -- Disk(#{disk[:device]}): #{disk[:absolute_path]}, #{disk[:bus]}, #{disk[:size]}"
|
309
326
|
msg += ' Shared' if disk[:shareable]
|
310
327
|
msg += ' (Remove only manually)' if disk[:allow_existing]
|
311
328
|
msg += ' Not created - using existed.' if disk[:preexisting]
|
@@ -320,6 +337,14 @@ module VagrantPlugins
|
|
320
337
|
env[:ui].info(" -- CDROM(#{cdrom[:dev]}): #{cdrom[:path]}")
|
321
338
|
end
|
322
339
|
|
340
|
+
unless @floppies.empty?
|
341
|
+
env[:ui].info(" -- Floppies: #{_floppies_print(@floppies)}")
|
342
|
+
end
|
343
|
+
|
344
|
+
@floppies.each do |floppy|
|
345
|
+
env[:ui].info(" -- Floppy(#{floppy[:dev]}): #{floppy[:path]}")
|
346
|
+
end
|
347
|
+
|
323
348
|
@inputs.each do |input|
|
324
349
|
env[:ui].info(" -- INPUT: type=#{input[:type]}, bus=#{input[:bus]}")
|
325
350
|
end
|
@@ -428,15 +453,13 @@ module VagrantPlugins
|
|
428
453
|
end
|
429
454
|
|
430
455
|
private
|
431
|
-
def _disks_print(disks)
|
432
|
-
disks.collect do |x|
|
433
|
-
"#{x[:device]}(#{x[:type]}, #{x[:bus]}, #{x[:size]})"
|
434
|
-
end.join(', ')
|
435
|
-
end
|
436
|
-
|
437
456
|
def _cdroms_print(cdroms)
|
438
457
|
cdroms.collect { |x| x[:dev] }.join(', ')
|
439
458
|
end
|
459
|
+
|
460
|
+
def _floppies_print(floppies)
|
461
|
+
floppies.collect { |x| x[:dev] }.join(', ')
|
462
|
+
end
|
440
463
|
end
|
441
464
|
end
|
442
465
|
end
|
@@ -61,7 +61,7 @@ module VagrantPlugins
|
|
61
61
|
# We have slot for interface, fill it with interface configuration.
|
62
62
|
adapters[free_slot] = options
|
63
63
|
adapters[free_slot][:network_name] = interface_network(
|
64
|
-
env[:machine].provider.driver
|
64
|
+
env[:machine].provider.driver, adapters[free_slot]
|
65
65
|
)
|
66
66
|
end
|
67
67
|
|
@@ -76,6 +76,7 @@ module VagrantPlugins
|
|
76
76
|
@mac = iface_configuration.fetch(:mac, false)
|
77
77
|
@model_type = iface_configuration.fetch(:model_type, @nic_model_type)
|
78
78
|
@driver_name = iface_configuration.fetch(:driver_name, false)
|
79
|
+
@driver_iommu = iface_configuration.fetch(:driver_iommu, false )
|
79
80
|
@driver_queues = iface_configuration.fetch(:driver_queues, false)
|
80
81
|
@device_name = iface_configuration.fetch(:iface_name, false)
|
81
82
|
@mtu = iface_configuration.fetch(:mtu, nil)
|
@@ -84,12 +85,15 @@ module VagrantPlugins
|
|
84
85
|
template_name = 'interface'
|
85
86
|
@type = nil
|
86
87
|
@udp_tunnel = nil
|
88
|
+
|
89
|
+
@logger.debug("Interface configuration: #{iface_configuration}")
|
87
90
|
# Configuration for public interfaces which use the macvtap driver
|
88
91
|
if iface_configuration[:iface_type] == :public_network
|
89
92
|
@device = iface_configuration.fetch(:dev, 'eth0')
|
90
93
|
@mode = iface_configuration.fetch(:mode, 'bridge')
|
91
94
|
@type = iface_configuration.fetch(:type, 'direct')
|
92
95
|
@model_type = iface_configuration.fetch(:model_type, @nic_model_type)
|
96
|
+
@driver_iommu = iface_configuration.fetch(:driver_iommu, false )
|
93
97
|
@driver_name = iface_configuration.fetch(:driver_name, false)
|
94
98
|
@driver_queues = iface_configuration.fetch(:driver_queues, false)
|
95
99
|
@portgroup = iface_configuration.fetch(:portgroup, nil)
|
@@ -124,13 +128,14 @@ module VagrantPlugins
|
|
124
128
|
}
|
125
129
|
@tunnel_type = iface_configuration.fetch(:model_type, @nic_model_type)
|
126
130
|
@driver_name = iface_configuration.fetch(:driver_name, false)
|
131
|
+
@driver_iommu = iface_configuration.fetch(:driver_iommu, false )
|
127
132
|
@driver_queues = iface_configuration.fetch(:driver_queues, false)
|
128
133
|
template_name = 'tunnel_interface'
|
129
134
|
@logger.info("Setting up #{@type} tunnel interface using #{@tunnel_ip} port #{@tunnel_port}")
|
130
135
|
end
|
131
136
|
|
132
137
|
message = "Creating network interface eth#{@iface_number}"
|
133
|
-
message += " connected to network #{@network_name}."
|
138
|
+
message += " connected to network #{@network_name} based on template #{template_name}."
|
134
139
|
if @mac
|
135
140
|
@mac = @mac.scan(/(\h{2})/).join(':')
|
136
141
|
message += " Using MAC address: #{@mac}"
|
@@ -141,7 +146,9 @@ module VagrantPlugins
|
|
141
146
|
# FIXME: all options for network driver should be hash from Vagrantfile
|
142
147
|
driver_options = {}
|
143
148
|
driver_options[:name] = @driver_name if @driver_name
|
149
|
+
driver_options[:iommu] = @driver_iommu ? "on" : "off"
|
144
150
|
driver_options[:queues] = @driver_queues if @driver_queues
|
151
|
+
|
145
152
|
@udp_tunnel ||= {}
|
146
153
|
xml = if template_name == 'interface' or
|
147
154
|
template_name == 'tunnel_interface'
|
@@ -259,12 +266,15 @@ module VagrantPlugins
|
|
259
266
|
xml.source(source_options) do
|
260
267
|
xml.local(udp_tunnel) if type == 'udp'
|
261
268
|
end
|
269
|
+
|
270
|
+
@logger.debug "Driver options: #{driver_options}"
|
271
|
+
|
262
272
|
xml.mac(address: mac) if mac
|
263
273
|
xml.target(dev: target_dev_name(device_name, type, iface_number))
|
264
274
|
xml.alias(name: "net#{iface_number}")
|
265
275
|
xml.model(type: model_type.to_s)
|
266
276
|
xml.mtu(size: Integer(mtu)) if mtu
|
267
|
-
xml.driver(driver_options)
|
277
|
+
xml.driver(**driver_options)
|
268
278
|
xml.address(type: 'pci', bus: pci_bus, slot: pci_slot) if pci_bus and pci_slot
|
269
279
|
end
|
270
280
|
end.to_xml(
|
@@ -282,7 +292,7 @@ module VagrantPlugins
|
|
282
292
|
end
|
283
293
|
|
284
294
|
# Return network name according to interface options.
|
285
|
-
def interface_network(
|
295
|
+
def interface_network(driver, options)
|
286
296
|
# no need to get interface network for tcp tunnel config
|
287
297
|
return 'tunnel_interface' if options.fetch(:tunnel_type, nil)
|
288
298
|
|
@@ -292,7 +302,7 @@ module VagrantPlugins
|
|
292
302
|
end
|
293
303
|
|
294
304
|
# Get list of all (active and inactive) Libvirt networks.
|
295
|
-
available_networks = libvirt_networks(
|
305
|
+
available_networks = libvirt_networks(driver)
|
296
306
|
|
297
307
|
return 'public' if options[:iface_type] == :public_network
|
298
308
|
|
@@ -35,9 +35,7 @@ module VagrantPlugins
|
|
35
35
|
# for VMs using sessions. It is likely that this should be done
|
36
36
|
# to determine the correct virtual device for the management
|
37
37
|
# network for sessions instead of assuming the default of virbr0.
|
38
|
-
@available_networks = libvirt_networks(
|
39
|
-
env[:machine].provider.driver.system_connection
|
40
|
-
)
|
38
|
+
@available_networks = libvirt_networks(env[:machine].provider.driver)
|
41
39
|
|
42
40
|
@app.call(env)
|
43
41
|
return
|
@@ -61,9 +59,7 @@ module VagrantPlugins
|
|
61
59
|
# Get a list of all (active and inactive) Libvirt networks. This
|
62
60
|
# list is used throughout this class and should be easier to
|
63
61
|
# process than Libvirt API calls.
|
64
|
-
@available_networks = libvirt_networks(
|
65
|
-
env[:machine].provider.driver.connection.client
|
66
|
-
)
|
62
|
+
@available_networks = libvirt_networks(env[:machine].provider.driver)
|
67
63
|
|
68
64
|
current_network = @available_networks.detect { |network| network[:name] == @options[:network_name] }
|
69
65
|
|
@@ -54,7 +54,7 @@ module VagrantPlugins
|
|
54
54
|
env[:machine].provider_config.cdroms.empty?
|
55
55
|
# if using default configuration of disks and cdroms
|
56
56
|
# cdroms are consider volumes, but cannot be destroyed
|
57
|
-
|
57
|
+
domain.destroy(destroy_volumes: true, flags: undefine_flags)
|
58
58
|
else
|
59
59
|
domain_xml = libvirt_domain.xml_desc(1)
|
60
60
|
xml_descr = REXML::Document.new(domain_xml)
|
@@ -64,7 +64,7 @@ module VagrantPlugins
|
|
64
64
|
env[:ui].warn(I18n.t('vagrant_libvirt.domain_xml.obsolete_method'))
|
65
65
|
end
|
66
66
|
|
67
|
-
|
67
|
+
domain.destroy(destroy_volumes: false, flags: undefine_flags)
|
68
68
|
|
69
69
|
volumes = domain.volumes
|
70
70
|
|
@@ -171,14 +171,6 @@ module VagrantPlugins
|
|
171
171
|
libvirt_disk.destroy if libvirt_disk
|
172
172
|
end
|
173
173
|
end
|
174
|
-
|
175
|
-
def destroy_domain(domain, destroy_volumes:, flags:)
|
176
|
-
if domain.method(:destroy).parameters.first.include?(:flags)
|
177
|
-
domain.destroy(destroy_volumes: destroy_volumes, flags: flags)
|
178
|
-
else
|
179
|
-
domain.destroy(destroy_volumes: destroy_volumes)
|
180
|
-
end
|
181
|
-
end
|
182
174
|
end
|
183
175
|
end
|
184
176
|
end
|
@@ -110,7 +110,7 @@ module VagrantPlugins
|
|
110
110
|
end
|
111
111
|
).map { |s| ['-o', s] }.flatten
|
112
112
|
|
113
|
-
options += ['-o', "ProxyCommand=\"#{ssh_info[:proxy_command]}\""] if machine.provider_config.proxy_command
|
113
|
+
options += ['-o', "ProxyCommand=\"#{ssh_info[:proxy_command]}\""] if machine.provider_config.proxy_command && !machine.provider_config.proxy_command.empty?
|
114
114
|
|
115
115
|
ssh_cmd = ['ssh'] + options + params
|
116
116
|
|
@@ -52,8 +52,8 @@ module VagrantPlugins
|
|
52
52
|
# @return [String]
|
53
53
|
def read_machine_ip(machine)
|
54
54
|
# check host only ip
|
55
|
-
|
56
|
-
return
|
55
|
+
ssh_info = machine.ssh_info
|
56
|
+
return ssh_info[:host] if ping(ssh_info[:host], ssh_info[:port])
|
57
57
|
|
58
58
|
# check other ips
|
59
59
|
command = "ip=$(which ip); ${ip:-/sbin/ip} addr show | grep -i 'inet ' | grep -v '127.0.0.1' | tr -s ' ' | cut -d' ' -f3 | cut -d'/' -f 1"
|
@@ -65,17 +65,19 @@ module VagrantPlugins
|
|
65
65
|
ips = result.chomp.split("\n").uniq
|
66
66
|
@logger.info("guest IPs: #{ips.join(', ')}")
|
67
67
|
ips.each do |ip|
|
68
|
-
next if ip ==
|
68
|
+
next if ip == ssh_info[:host]
|
69
69
|
return ip if ping(ip)
|
70
70
|
end
|
71
|
+
|
72
|
+
nil
|
71
73
|
end
|
72
74
|
|
73
75
|
private
|
74
76
|
|
75
77
|
# Check if we can open a connection to the host
|
76
|
-
def ping(host, timeout = 3)
|
78
|
+
def ping(host, port=nil, timeout = 3)
|
77
79
|
::Timeout.timeout(timeout) do
|
78
|
-
s = TCPSocket.new(host, 'ssh')
|
80
|
+
s = TCPSocket.new(host, port || 'ssh')
|
79
81
|
s.close
|
80
82
|
end
|
81
83
|
true
|
@@ -23,6 +23,7 @@ module VagrantPlugins
|
|
23
23
|
domain_name = env[:domain_name] # only set on create
|
24
24
|
disk_bus = config.disk_bus
|
25
25
|
disk_device = config.disk_device
|
26
|
+
disk_address_type = config.disk_address_type
|
26
27
|
domain_volume_cache = config.volume_cache || 'default'
|
27
28
|
|
28
29
|
# Storage
|
@@ -84,6 +85,7 @@ module VagrantPlugins
|
|
84
85
|
device: env[:box_volumes][index][:device],
|
85
86
|
cache: domain_volume_cache,
|
86
87
|
bus: disk_bus,
|
88
|
+
address_type: disk_address_type,
|
87
89
|
absolute_path: domain_volume.path,
|
88
90
|
virtual_size: env[:box_volumes][index][:virtual_size],
|
89
91
|
pool: pool_name,
|
@@ -12,7 +12,7 @@ module VagrantPlugins
|
|
12
12
|
env[:ui].info(I18n.t(
|
13
13
|
"vagrant.actions.vm.snapshot.deleting",
|
14
14
|
name: env[:snapshot_name]))
|
15
|
-
env[:machine].provider.driver.delete_snapshot(env[:
|
15
|
+
env[:machine].provider.driver.delete_snapshot(env[:snapshot_name])
|
16
16
|
|
17
17
|
env[:ui].success(I18n.t(
|
18
18
|
"vagrant.actions.vm.snapshot.deleted",
|
@@ -12,7 +12,7 @@ module VagrantPlugins
|
|
12
12
|
env[:ui].info(I18n.t(
|
13
13
|
"vagrant.actions.vm.snapshot.restoring",
|
14
14
|
name: env[:snapshot_name]))
|
15
|
-
env[:machine].provider.driver.restore_snapshot(env[:
|
15
|
+
env[:machine].provider.driver.restore_snapshot(env[:snapshot_name])
|
16
16
|
|
17
17
|
@app.call(env)
|
18
18
|
end
|
@@ -12,8 +12,7 @@ module VagrantPlugins
|
|
12
12
|
env[:ui].info(I18n.t(
|
13
13
|
"vagrant.actions.vm.snapshot.saving",
|
14
14
|
name: env[:snapshot_name]))
|
15
|
-
env[:machine].provider.driver.create_snapshot(
|
16
|
-
env[:machine], env[:snapshot_name])
|
15
|
+
env[:machine].provider.driver.create_snapshot(env[:snapshot_name])
|
17
16
|
|
18
17
|
env[:ui].success(I18n.t(
|
19
18
|
"vagrant.actions.vm.snapshot.saved",
|