vagrant-libvirt 0.0.43 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (67) hide show
  1. checksums.yaml +5 -5
  2. data/README.md +434 -150
  3. data/lib/vagrant-libvirt/action.rb +2 -2
  4. data/lib/vagrant-libvirt/action/create_domain.rb +103 -38
  5. data/lib/vagrant-libvirt/action/create_domain_volume.rb +19 -14
  6. data/lib/vagrant-libvirt/action/create_network_interfaces.rb +10 -5
  7. data/lib/vagrant-libvirt/action/create_networks.rb +7 -2
  8. data/lib/vagrant-libvirt/action/destroy_domain.rb +1 -1
  9. data/lib/vagrant-libvirt/action/destroy_networks.rb +5 -0
  10. data/lib/vagrant-libvirt/action/forward_ports.rb +9 -7
  11. data/lib/vagrant-libvirt/action/halt_domain.rb +1 -1
  12. data/lib/vagrant-libvirt/action/handle_box_image.rb +32 -18
  13. data/lib/vagrant-libvirt/action/handle_storage_pool.rb +9 -4
  14. data/lib/vagrant-libvirt/action/package_domain.rb +63 -12
  15. data/lib/vagrant-libvirt/action/prepare_nfs_settings.rb +3 -9
  16. data/lib/vagrant-libvirt/action/prune_nfs_exports.rb +19 -9
  17. data/lib/vagrant-libvirt/action/remove_libvirt_image.rb +2 -2
  18. data/lib/vagrant-libvirt/action/remove_stale_volume.rb +17 -11
  19. data/lib/vagrant-libvirt/action/set_boot_order.rb +2 -2
  20. data/lib/vagrant-libvirt/action/set_name_of_domain.rb +6 -9
  21. data/lib/vagrant-libvirt/action/start_domain.rb +3 -3
  22. data/lib/vagrant-libvirt/action/wait_till_up.rb +31 -16
  23. data/lib/vagrant-libvirt/cap/public_address.rb +16 -0
  24. data/lib/vagrant-libvirt/cap/synced_folder.rb +3 -3
  25. data/lib/vagrant-libvirt/config.rb +178 -29
  26. data/lib/vagrant-libvirt/driver.rb +31 -2
  27. data/lib/vagrant-libvirt/errors.rb +5 -1
  28. data/lib/vagrant-libvirt/plugin.rb +7 -2
  29. data/lib/vagrant-libvirt/templates/default_storage_pool.xml.erb +3 -3
  30. data/lib/vagrant-libvirt/templates/domain.xml.erb +48 -8
  31. data/lib/vagrant-libvirt/templates/public_interface.xml.erb +5 -1
  32. data/lib/vagrant-libvirt/util.rb +2 -0
  33. data/lib/vagrant-libvirt/util/erb_template.rb +6 -7
  34. data/lib/vagrant-libvirt/util/network_util.rb +33 -13
  35. data/lib/vagrant-libvirt/util/nfs.rb +17 -0
  36. data/lib/vagrant-libvirt/util/storage_util.rb +27 -0
  37. data/lib/vagrant-libvirt/util/ui.rb +23 -0
  38. data/lib/vagrant-libvirt/version +1 -0
  39. data/lib/vagrant-libvirt/version.rb +24 -1
  40. data/locales/en.yml +8 -4
  41. data/spec/support/environment_helper.rb +1 -1
  42. data/spec/support/libvirt_context.rb +1 -1
  43. data/spec/support/sharedcontext.rb +3 -3
  44. data/spec/unit/action/create_domain_spec.rb +85 -0
  45. data/spec/unit/action/create_domain_spec/default_storage_pool.xml +17 -0
  46. data/spec/unit/action/destroy_domain_spec.rb +2 -2
  47. data/spec/unit/action/set_name_of_domain_spec.rb +3 -3
  48. data/spec/unit/action/start_domain_spec.rb +49 -0
  49. data/spec/unit/action/start_domain_spec/default.xml +48 -0
  50. data/spec/unit/config_spec.rb +173 -0
  51. data/spec/unit/templates/domain_all_settings.xml +20 -4
  52. data/spec/unit/templates/domain_custom_cpu_model.xml +48 -0
  53. data/spec/unit/templates/domain_defaults.xml +2 -0
  54. data/spec/unit/templates/domain_spec.rb +26 -2
  55. metadata +34 -32
  56. data/.coveralls.yml +0 -1
  57. data/.github/issue_template.md +0 -37
  58. data/.gitignore +0 -21
  59. data/.travis.yml +0 -24
  60. data/Gemfile +0 -26
  61. data/Rakefile +0 -8
  62. data/example_box/README.md +0 -29
  63. data/example_box/Vagrantfile +0 -60
  64. data/example_box/metadata.json +0 -5
  65. data/tools/create_box.sh +0 -130
  66. data/tools/prepare_redhat_for_box.sh +0 -119
  67. data/vagrant-libvirt.gemspec +0 -54
@@ -1,8 +1,10 @@
1
1
  <domain type='kvm' xmlns:qemu='http://libvirt.org/schemas/domain/qemu/1.0'>
2
2
  <name></name>
3
+ <title>title</title>
4
+ <description>description</description>
3
5
  <uuid></uuid>
4
6
  <memory></memory>
5
- <vcpu>1</vcpu>
7
+ <vcpu cpuset='1-4,^3,6'>1</vcpu>
6
8
 
7
9
 
8
10
  <cpu mode='custom'>
@@ -11,10 +13,16 @@
11
13
  <topology sockets='1' cores='3' threads='2'/>
12
14
  </cpu>
13
15
 
16
+ <numatune>
17
+ <memory nodeset='1-4,^3,6'/>
18
+ </numatune>
19
+ <cputune>
20
+ <shares>1024</shares>
21
+ </cputune>
14
22
 
15
23
  <os>
16
24
  <type arch='x86_64' machine='pc-compatible'>hvm</type>
17
- <loader readonly='yes' type='rom'>/efi/loader</loader>
25
+ <loader readonly='yes' type='rom'>/efi/loader</loader>
18
26
  <bootmenu enable='yes'/>
19
27
  <kernel></kernel>
20
28
  <initrd></initrd>
@@ -24,6 +32,9 @@
24
32
  <acpi/>
25
33
  <apic/>
26
34
  <pae/>
35
+ <hyperv>
36
+ <BBB state='on' />
37
+ </hyperv>
27
38
  </features>
28
39
  <clock offset='utc'/>
29
40
  <devices>
@@ -101,7 +112,7 @@
101
112
  </hostdev>
102
113
  <hostdev mode='subsystem' type='pci' managed='yes'>
103
114
  <source>
104
- <address domain='0x0000'
115
+ <address domain='0x0001'
105
116
  bus='0x03'
106
117
  slot='0x00'
107
118
  function='0x0'/>
@@ -117,7 +128,7 @@
117
128
  <redirdev bus='usb' type='tcp'>
118
129
  </redirdev>
119
130
  <redirfilter>
120
- <usbdev class='0x0b' vendor='0x0b' product='0x0b' version='0x0b' allow='yes'/>
131
+ <usbdev class='0x0b' vendor='0x08e6' product='0x3437' version='2.00' allow='yes'/>
121
132
  </redirfilter>
122
133
  <watchdog model='i6300esb' action='reset'/>
123
134
 
@@ -128,10 +139,15 @@
128
139
  <device path='/dev/tpm0'/>
129
140
  </backend>
130
141
  </tpm>
142
+ <controller type='usb' model='nec-xhci' ports="4" />
131
143
  </devices>
132
144
 
133
145
  <qemu:commandline>
134
146
  <qemu:arg value='-device'/>
135
147
  <qemu:arg value='dummy-device'/>
148
+ <qemu:env name='QEMU_AUDIO_DRV' value='pa'/>
149
+ <qemu:env name='QEMU_AUDIO_TIMER_PERIOD' value='150'/>
150
+ <qemu:env name='QEMU_PA_SAMPLES' value='1024'/>
151
+ <qemu:env name='QEMU_PA_SERVER' value='/run/user/1000/pulse/native'/>
136
152
  </qemu:commandline>
137
153
  </domain>
@@ -0,0 +1,48 @@
1
+ <domain type='' xmlns:qemu='http://libvirt.org/schemas/domain/qemu/1.0'>
2
+ <name></name>
3
+ <title></title>
4
+ <description></description>
5
+ <uuid></uuid>
6
+ <memory></memory>
7
+ <vcpu>1</vcpu>
8
+
9
+
10
+ <cpu mode='custom'>
11
+ <model fallback='allow'>SandyBridge</model>
12
+ </cpu>
13
+
14
+
15
+ <os>
16
+ <type>hvm</type>
17
+ <kernel></kernel>
18
+ <initrd></initrd>
19
+ <cmdline></cmdline>
20
+ </os>
21
+ <features>
22
+ <acpi/>
23
+ <apic/>
24
+ <pae/>
25
+ </features>
26
+ <clock offset='utc'/>
27
+ <devices>
28
+
29
+
30
+ <serial type='pty'>
31
+ <target port='0'/>
32
+ </serial>
33
+ <console type='pty'>
34
+ <target port='0'/>
35
+ </console>
36
+
37
+
38
+ <input type='mouse' bus='ps2'/>
39
+
40
+ <graphics type='vnc' port='-1' autoport='yes' listen='127.0.0.1' keymap='en-us' />
41
+ <video>
42
+ <model type='cirrus' vram='9216' heads='1'/>
43
+ </video>
44
+
45
+
46
+ </devices>
47
+
48
+ </domain>
@@ -1,5 +1,7 @@
1
1
  <domain type='' xmlns:qemu='http://libvirt.org/schemas/domain/qemu/1.0'>
2
2
  <name></name>
3
+ <title></title>
4
+ <description></description>
3
5
  <uuid></uuid>
4
6
  <memory></memory>
5
7
  <vcpu>1</vcpu>
@@ -11,7 +11,6 @@ describe 'templates/domain' do
11
11
 
12
12
  def finalize!
13
13
  super
14
- @qargs = @qemu_args
15
14
  end
16
15
  end
17
16
 
@@ -28,9 +27,12 @@ describe 'templates/domain' do
28
27
 
29
28
  context 'when all settings enabled' do
30
29
  before do
30
+ domain.title = 'title'
31
+ domain.description = 'description'
31
32
  domain.instance_variable_set('@domain_type', 'kvm')
32
33
  domain.cpu_mode = 'custom'
33
34
  domain.cpu_feature(name: 'AAA', policy: 'required')
35
+ domain.hyperv_feature(name: 'BBB', state: 'on')
34
36
  domain.cputopology(sockets: '1', cores: '3', threads: '2')
35
37
  domain.machine_type = 'pc-compatible'
36
38
  domain.machine_arch = 'x86_64'
@@ -63,7 +65,8 @@ describe 'templates/domain' do
63
65
  source_path: '/tmp/foo')
64
66
  domain.random(model: 'random')
65
67
  domain.pci(bus: '0x06', slot: '0x12', function: '0x5')
66
- domain.pci(bus: '0x03', slot: '0x00', function: '0x0')
68
+ domain.pci(domain: '0x0001', bus: '0x03', slot: '0x00', function: '0x0')
69
+ domain.usb_controller(model: 'nec-xhci', ports: '4')
67
70
  domain.usb(bus: '1', device: '2', vendor: '0x1234', product: '0xabcd')
68
71
  domain.redirdev(type: 'tcp', host: 'localhost', port: '4000')
69
72
  domain.redirfilter(class: '0x0b', vendor: '0x08e6',
@@ -74,6 +77,15 @@ describe 'templates/domain' do
74
77
 
75
78
  domain.qemuargs(value: '-device')
76
79
  domain.qemuargs(value: 'dummy-device')
80
+
81
+ domain.qemuenv(QEMU_AUDIO_DRV: 'pa')
82
+ domain.qemuenv(QEMU_AUDIO_TIMER_PERIOD: '150')
83
+ domain.qemuenv(QEMU_PA_SAMPLES: '1024')
84
+ domain.qemuenv(QEMU_PA_SERVER: '/run/user/1000/pulse/native')
85
+
86
+ domain.shares = '1024'
87
+ domain.cpuset = '1-4,^3,6'
88
+ domain.nodeset = '1-4,^3,6'
77
89
  end
78
90
  let(:test_file) { 'domain_all_settings.xml' }
79
91
  it 'renders template' do
@@ -81,4 +93,16 @@ describe 'templates/domain' do
81
93
  expect(domain.to_xml('domain')).to eq xml_expected
82
94
  end
83
95
  end
96
+
97
+ context 'when custom cpu model enabled' do
98
+ before do
99
+ domain.cpu_mode = 'custom'
100
+ domain.cpu_model = 'SandyBridge'
101
+ end
102
+ let(:test_file) { 'domain_custom_cpu_model.xml' }
103
+ it 'renders template' do
104
+ domain.finalize!
105
+ expect(domain.to_xml('domain')).to eq xml_expected
106
+ end
107
+ end
84
108
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vagrant-libvirt
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.43
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lukas Stanek
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2018-02-02 00:00:00.000000000 Z
13
+ date: 2020-11-16 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rspec-core
@@ -60,42 +60,42 @@ dependencies:
60
60
  requirements:
61
61
  - - ">="
62
62
  - !ruby/object:Gem::Version
63
- version: 0.3.0
63
+ version: 0.6.0
64
64
  type: :runtime
65
65
  prerelease: false
66
66
  version_requirements: !ruby/object:Gem::Requirement
67
67
  requirements:
68
68
  - - ">="
69
69
  - !ruby/object:Gem::Version
70
- version: 0.3.0
70
+ version: 0.6.0
71
71
  - !ruby/object:Gem::Dependency
72
- name: nokogiri
72
+ name: fog-core
73
73
  requirement: !ruby/object:Gem::Requirement
74
74
  requirements:
75
- - - ">="
75
+ - - "~>"
76
76
  - !ruby/object:Gem::Version
77
- version: 1.6.0
77
+ version: '2.1'
78
78
  type: :runtime
79
79
  prerelease: false
80
80
  version_requirements: !ruby/object:Gem::Requirement
81
81
  requirements:
82
- - - ">="
82
+ - - "~>"
83
83
  - !ruby/object:Gem::Version
84
- version: 1.6.0
84
+ version: '2.1'
85
85
  - !ruby/object:Gem::Dependency
86
- name: fog-core
86
+ name: nokogiri
87
87
  requirement: !ruby/object:Gem::Requirement
88
88
  requirements:
89
89
  - - "~>"
90
90
  - !ruby/object:Gem::Version
91
- version: 1.43.0
91
+ version: '1.6'
92
92
  type: :runtime
93
93
  prerelease: false
94
94
  version_requirements: !ruby/object:Gem::Requirement
95
95
  requirements:
96
96
  - - "~>"
97
97
  - !ruby/object:Gem::Version
98
- version: 1.43.0
98
+ version: '1.6'
99
99
  - !ruby/object:Gem::Dependency
100
100
  name: rake
101
101
  requirement: !ruby/object:Gem::Requirement
@@ -119,17 +119,8 @@ executables: []
119
119
  extensions: []
120
120
  extra_rdoc_files: []
121
121
  files:
122
- - ".coveralls.yml"
123
- - ".github/issue_template.md"
124
- - ".gitignore"
125
- - ".travis.yml"
126
- - Gemfile
127
122
  - LICENSE
128
123
  - README.md
129
- - Rakefile
130
- - example_box/README.md
131
- - example_box/Vagrantfile
132
- - example_box/metadata.json
133
124
  - lib/vagrant-libvirt.rb
134
125
  - lib/vagrant-libvirt/action.rb
135
126
  - lib/vagrant-libvirt/action/create_domain.rb
@@ -166,6 +157,7 @@ files:
166
157
  - lib/vagrant-libvirt/action/wait_till_up.rb
167
158
  - lib/vagrant-libvirt/cap/mount_p9.rb
168
159
  - lib/vagrant-libvirt/cap/nic_mac_addresses.rb
160
+ - lib/vagrant-libvirt/cap/public_address.rb
169
161
  - lib/vagrant-libvirt/cap/synced_folder.rb
170
162
  - lib/vagrant-libvirt/config.rb
171
163
  - lib/vagrant-libvirt/driver.rb
@@ -181,23 +173,29 @@ files:
181
173
  - lib/vagrant-libvirt/util/erb_template.rb
182
174
  - lib/vagrant-libvirt/util/error_codes.rb
183
175
  - lib/vagrant-libvirt/util/network_util.rb
176
+ - lib/vagrant-libvirt/util/nfs.rb
177
+ - lib/vagrant-libvirt/util/storage_util.rb
184
178
  - lib/vagrant-libvirt/util/timer.rb
179
+ - lib/vagrant-libvirt/util/ui.rb
180
+ - lib/vagrant-libvirt/version
185
181
  - lib/vagrant-libvirt/version.rb
186
182
  - locales/en.yml
187
183
  - spec/spec_helper.rb
188
184
  - spec/support/environment_helper.rb
189
185
  - spec/support/libvirt_context.rb
190
186
  - spec/support/sharedcontext.rb
187
+ - spec/unit/action/create_domain_spec.rb
188
+ - spec/unit/action/create_domain_spec/default_storage_pool.xml
191
189
  - spec/unit/action/destroy_domain_spec.rb
192
190
  - spec/unit/action/set_name_of_domain_spec.rb
191
+ - spec/unit/action/start_domain_spec.rb
192
+ - spec/unit/action/start_domain_spec/default.xml
193
193
  - spec/unit/action/wait_till_up_spec.rb
194
194
  - spec/unit/config_spec.rb
195
195
  - spec/unit/templates/domain_all_settings.xml
196
+ - spec/unit/templates/domain_custom_cpu_model.xml
196
197
  - spec/unit/templates/domain_defaults.xml
197
198
  - spec/unit/templates/domain_spec.rb
198
- - tools/create_box.sh
199
- - tools/prepare_redhat_for_box.sh
200
- - vagrant-libvirt.gemspec
201
199
  homepage: https://github.com/vagrant-libvirt/vagrant-libvirt
202
200
  licenses:
203
201
  - MIT
@@ -217,20 +215,24 @@ required_rubygems_version: !ruby/object:Gem::Requirement
217
215
  - !ruby/object:Gem::Version
218
216
  version: '0'
219
217
  requirements: []
220
- rubyforge_project:
221
- rubygems_version: 2.6.14
218
+ rubygems_version: 3.0.8
222
219
  signing_key:
223
220
  specification_version: 4
224
221
  summary: libvirt provider for Vagrant.
225
222
  test_files:
226
- - spec/spec_helper.rb
227
- - spec/support/environment_helper.rb
228
223
  - spec/support/libvirt_context.rb
229
224
  - spec/support/sharedcontext.rb
230
- - spec/unit/action/destroy_domain_spec.rb
231
- - spec/unit/action/set_name_of_domain_spec.rb
232
- - spec/unit/action/wait_till_up_spec.rb
233
- - spec/unit/config_spec.rb
225
+ - spec/support/environment_helper.rb
234
226
  - spec/unit/templates/domain_all_settings.xml
227
+ - spec/unit/templates/domain_custom_cpu_model.xml
235
228
  - spec/unit/templates/domain_defaults.xml
236
229
  - spec/unit/templates/domain_spec.rb
230
+ - spec/unit/action/create_domain_spec/default_storage_pool.xml
231
+ - spec/unit/action/create_domain_spec.rb
232
+ - spec/unit/action/wait_till_up_spec.rb
233
+ - spec/unit/action/destroy_domain_spec.rb
234
+ - spec/unit/action/start_domain_spec.rb
235
+ - spec/unit/action/set_name_of_domain_spec.rb
236
+ - spec/unit/action/start_domain_spec/default.xml
237
+ - spec/unit/config_spec.rb
238
+ - spec/spec_helper.rb
@@ -1 +0,0 @@
1
- service_name: travis-ci
@@ -1,37 +0,0 @@
1
- <!--
2
- Thank you for reporting issues to vagrant-libvirt.
3
-
4
- To make it possible for us to help you quickly, we kindly request that you use the template below to report issues. If the issue you are reporting does not fit the template (a feature request for example) please feel free to adapt it to your needs.
5
-
6
- Please be aware that we are not actively testing previous versions of both Vagrant and Vagrant-libvirt, so before reporting an issue, please install the latest Vagrant version from Vagrantup.com, run `vagrant plugin update` and reproduce the issue.
7
- -->
8
- ### Steps to reproduce
9
- 1.
10
- 2.
11
- 3.
12
-
13
- ### Expected behaviour
14
- Tell us what should happen
15
-
16
- ### Actual behaviour
17
- Tell us what happens instead
18
-
19
- ### System configuration
20
- **OS/Distro version:**:
21
-
22
- **Libvirt version:**
23
-
24
- **Output of `vagrant version; vagrant plugin list`:**
25
-
26
- **Output of `VAGRANT_LOG=debug vagrant ... --provider=libvirt`**
27
- ```
28
- Insert debug output inside quotes here (replace ... with whatever command you use to trigger the issue)
29
- ```
30
-
31
- **A Vagrantfile to reproduce the issue:**
32
- ```
33
- Insert Vagrantfile inside quotes here (remove sensitive data if needed)
34
- ```
35
-
36
- **Are you using upstream vagrant package or your distros package?**
37
- Upstream / Distro
data/.gitignore DELETED
@@ -1,21 +0,0 @@
1
- *.gem
2
- *.rbc
3
- .bundle
4
- .config
5
- .yardoc
6
- Gemfile.lock
7
- InstalledFiles
8
- _yardoc
9
- coverage
10
- doc/
11
- lib/bundler/man
12
- pkg
13
- rdoc
14
- spec/reports
15
- test/tmp
16
- test/version_tmp
17
- tmp
18
- Vagrantfile
19
- !example_box/Vagrantfile
20
- .vagrant
21
- *.swp
@@ -1,24 +0,0 @@
1
- ---
2
- language: ruby
3
- dist: trusty
4
- before_install:
5
- - sudo apt-get update -qq
6
- - sudo apt-get install -y libvirt-dev
7
- - gem update --system
8
- - gem install bundler
9
- install: bundle install
10
- script: bundle exec rspec --color --format documentation
11
- notifications:
12
- email: false
13
- rvm:
14
- - 2.2.5
15
- - 2.3.3
16
- env:
17
- global:
18
- - NOKOGIRI_USE_SYSTEM_LIBRARIES=true
19
- matrix:
20
- - VAGRANT_VERSION=v2.0.1
21
- matrix:
22
- allow_failures:
23
- - env: VAGRANT_VERSION=master
24
- rvm: 2.3.3
data/Gemfile DELETED
@@ -1,26 +0,0 @@
1
- source 'https://rubygems.org'
2
-
3
- # Specify your gem's dependencies in vagrant-libvirt.gemspec
4
- gemspec
5
-
6
- group :development do
7
- # We depend on Vagrant for development, but we don't add it as a
8
- # gem dependency because we expect to be installed within the
9
- # Vagrant environment itself using `vagrant plugin`.
10
- if ENV['VAGRANT_VERSION']
11
- gem 'vagrant', :git => 'https://github.com/hashicorp/vagrant.git',
12
- tag: ENV['VAGRANT_VERSION']
13
- else
14
- gem 'vagrant', :git => 'https://github.com/hashicorp/vagrant.git'
15
- end
16
-
17
- gem 'vagrant-spec', :github => 'hashicorp/vagrant-spec'
18
-
19
- gem 'pry'
20
- end
21
-
22
- group :plugins do
23
- gemspec
24
- end
25
-
26
- gem 'coveralls', require: false