vagrant-libvirt 0.0.36 → 0.0.37

Sign up to get free protection for your applications and to get access to all the features.
Files changed (66) hide show
  1. checksums.yaml +4 -4
  2. data/.coveralls.yml +1 -0
  3. data/Gemfile +1 -0
  4. data/README.md +171 -13
  5. data/lib/vagrant-libvirt/action/create_domain.rb +44 -19
  6. data/lib/vagrant-libvirt/action/create_domain_volume.rb +12 -12
  7. data/lib/vagrant-libvirt/action/create_network_interfaces.rb +37 -39
  8. data/lib/vagrant-libvirt/action/create_networks.rb +34 -34
  9. data/lib/vagrant-libvirt/action/destroy_domain.rb +7 -8
  10. data/lib/vagrant-libvirt/action/destroy_networks.rb +12 -13
  11. data/lib/vagrant-libvirt/action/forward_ports.rb +21 -23
  12. data/lib/vagrant-libvirt/action/halt_domain.rb +8 -9
  13. data/lib/vagrant-libvirt/action/handle_box_image.rb +28 -27
  14. data/lib/vagrant-libvirt/action/handle_storage_pool.rb +8 -8
  15. data/lib/vagrant-libvirt/action/is_created.rb +1 -1
  16. data/lib/vagrant-libvirt/action/is_running.rb +2 -2
  17. data/lib/vagrant-libvirt/action/is_suspended.rb +4 -4
  18. data/lib/vagrant-libvirt/action/message_already_created.rb +2 -2
  19. data/lib/vagrant-libvirt/action/message_not_created.rb +2 -2
  20. data/lib/vagrant-libvirt/action/message_not_running.rb +2 -2
  21. data/lib/vagrant-libvirt/action/message_not_suspended.rb +2 -2
  22. data/lib/vagrant-libvirt/action/package_domain.rb +6 -5
  23. data/lib/vagrant-libvirt/action/prepare_nfs_settings.rb +7 -6
  24. data/lib/vagrant-libvirt/action/prepare_nfs_valid_ids.rb +2 -2
  25. data/lib/vagrant-libvirt/action/prune_nfs_exports.rb +3 -3
  26. data/lib/vagrant-libvirt/action/read_mac_addresses.rb +8 -10
  27. data/lib/vagrant-libvirt/action/remove_libvirt_image.rb +4 -4
  28. data/lib/vagrant-libvirt/action/remove_stale_volume.rb +8 -7
  29. data/lib/vagrant-libvirt/action/resume_domain.rb +5 -5
  30. data/lib/vagrant-libvirt/action/set_boot_order.rb +70 -27
  31. data/lib/vagrant-libvirt/action/set_name_of_domain.rb +10 -12
  32. data/lib/vagrant-libvirt/action/share_folders.rb +16 -18
  33. data/lib/vagrant-libvirt/action/start_domain.rb +59 -64
  34. data/lib/vagrant-libvirt/action/suspend_domain.rb +5 -5
  35. data/lib/vagrant-libvirt/action/wait_till_up.rb +24 -26
  36. data/lib/vagrant-libvirt/action.rb +18 -23
  37. data/lib/vagrant-libvirt/cap/mount_p9.rb +11 -10
  38. data/lib/vagrant-libvirt/cap/nic_mac_addresses.rb +1 -1
  39. data/lib/vagrant-libvirt/cap/synced_folder.rb +20 -19
  40. data/lib/vagrant-libvirt/config.rb +164 -136
  41. data/lib/vagrant-libvirt/driver.rb +10 -13
  42. data/lib/vagrant-libvirt/errors.rb +4 -3
  43. data/lib/vagrant-libvirt/plugin.rb +4 -6
  44. data/lib/vagrant-libvirt/provider.rb +23 -24
  45. data/lib/vagrant-libvirt/templates/domain.xml.erb +14 -1
  46. data/lib/vagrant-libvirt/templates/private_network.xml.erb +4 -0
  47. data/lib/vagrant-libvirt/util/collection.rb +0 -3
  48. data/lib/vagrant-libvirt/util/erb_template.rb +6 -10
  49. data/lib/vagrant-libvirt/util/error_codes.rb +32 -33
  50. data/lib/vagrant-libvirt/util/network_util.rb +29 -21
  51. data/lib/vagrant-libvirt/util.rb +3 -4
  52. data/lib/vagrant-libvirt/version.rb +1 -1
  53. data/locales/en.yml +3 -0
  54. data/spec/spec_helper.rb +3 -0
  55. data/spec/support/environment_helper.rb +5 -7
  56. data/spec/support/libvirt_context.rb +13 -11
  57. data/spec/support/sharedcontext.rb +9 -10
  58. data/spec/unit/action/destroy_domain_spec.rb +38 -37
  59. data/spec/unit/action/set_name_of_domain_spec.rb +4 -4
  60. data/spec/unit/action/wait_till_up_spec.rb +45 -46
  61. data/spec/unit/config_spec.rb +106 -0
  62. data/spec/unit/templates/domain_all_settings.xml +125 -0
  63. data/spec/unit/templates/domain_defaults.xml +44 -0
  64. data/spec/unit/templates/domain_spec.rb +69 -0
  65. data/tools/create_box.sh +8 -2
  66. metadata +12 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: da3ef4d7080d541442e7999b6520977d5cd21413
4
- data.tar.gz: 72ac9eb37b6ae2db6fa9a6a78ebfb315670bbba8
3
+ metadata.gz: 133c3e62a88c8fe90de33598ebafdaadb7a8fcfc
4
+ data.tar.gz: efc8ee6514b87be1309957af7a9bf57f15daa893
5
5
  SHA512:
6
- metadata.gz: f957e84d690db98da45f32a80845979b8bf0f42bcab229a756746003c2e1559a11ac8251f11dcea96d534848139a7fb91fa04fa65e633b926a5dce0496be0b6b
7
- data.tar.gz: 8cd3f18ed2b9b0d6d352fbb2be5725c7a6e27381d5afa2a0ced7147397a3ca483216557fbf8644549c932722e853df20e64da03f37917d23cfa06323da27adc2
6
+ metadata.gz: 5dcc7e341830feb2a3ac402539ef4e9447eb234caa6cda31f62a35bb677be58e0a89b6ed27d84a683c09857f8b4580978d61c89409e9955c676bd0b42c4a3e15
7
+ data.tar.gz: 2e1f97ec49aaf4c71131fd2eedf524e707b42814b943a38fb88a201ef8061244f4287e1adad8700d7f1267d4c4c6a83e2262327734e6d3b569b74629ebcc5e48
data/.coveralls.yml ADDED
@@ -0,0 +1 @@
1
+ service_name: travis-ci
data/Gemfile CHANGED
@@ -24,3 +24,4 @@ group :plugins do
24
24
  gem 'vagrant-libvirt', :path => '.'
25
25
  end
26
26
 
27
+ gem 'coveralls', require: false
data/README.md CHANGED
@@ -1,5 +1,8 @@
1
1
  # Vagrant Libvirt Provider
2
+
3
+ [![Join the chat at https://gitter.im/vagrant-libvirt/vagrant-libvirt](https://badges.gitter.im/vagrant-libvirt/vagrant-libvirt.svg)](https://gitter.im/vagrant-libvirt/vagrant-libvirt?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
2
4
  [![Build Status](https://travis-ci.org/vagrant-libvirt/vagrant-libvirt.svg)](https://travis-ci.org/vagrant-libvirt/vagrant-libvirt)
5
+ [![Coverage Status](https://coveralls.io/repos/github/vagrant-libvirt/vagrant-libvirt/badge.svg?branch=master)](https://coveralls.io/github/vagrant-libvirt/vagrant-libvirt?branch=master)
3
6
 
4
7
  This is a [Vagrant](http://www.vagrantup.com) plugin that adds an
5
8
  [Libvirt](http://libvirt.org) provider to Vagrant, allowing Vagrant to
@@ -8,6 +11,23 @@ control and provision machines via Libvirt toolkit.
8
11
  **Note:** Actual version is still a development one. Feedback is welcome and
9
12
  can help a lot :-)
10
13
 
14
+ ## QA status
15
+
16
+ We periodically test basic functionality for vagrant-libvirt on various distributions.
17
+ In the table below, build passing means that specific version combination of Vagrant + Vagrant-libvirt was installed correctly and `vagrant up` is working. Click the badge to see the log.
18
+
19
+ |Vagrant|Vagrant-libvirt|ubuntu-12.04|ubuntu-14.04|ubuntu-16.04|debian-8|centos-6|centos-7|fedora-21|fedora-22|fedora-23|fedora-24|arch|
20
+ |---|---|---|---|---|---|---|---|---|---|---|---|---|
21
+ |1.9.1|master|[![Build Status](https://jenkins.infernix.net/job/vagrant-libvirt-qa/qa_vagrant_libvirt_version=master,qa_vagrant_version=1.9.1,distro=ubuntu-12.04/badge/icon)](https://jenkins.infernix.net/job/vagrant-libvirt-qa/qa_vagrant_libvirt_version=master,qa_vagrant_version=1.9.1,distro=ubuntu-12.04/lastBuild/consoleText)|[![Build Status](https://jenkins.infernix.net/job/vagrant-libvirt-qa/qa_vagrant_libvirt_version=master,qa_vagrant_version=1.9.1,distro=ubuntu-14.04/badge/icon)](https://jenkins.infernix.net/job/vagrant-libvirt-qa/qa_vagrant_libvirt_version=master,qa_vagrant_version=1.9.1,distro=ubuntu-14.04/lastBuild/consoleText)|[![Build Status](https://jenkins.infernix.net/job/vagrant-libvirt-qa/qa_vagrant_libvirt_version=master,qa_vagrant_version=1.9.1,distro=ubuntu-16.04/badge/icon)](https://jenkins.infernix.net/job/vagrant-libvirt-qa/qa_vagrant_libvirt_version=master,qa_vagrant_version=1.9.1,distro=ubuntu-16.04/lastBuild/consoleText)|[![Build Status](https://jenkins.infernix.net/job/vagrant-libvirt-qa/qa_vagrant_libvirt_version=master,qa_vagrant_version=1.9.1,distro=debian-8/badge/icon)](https://jenkins.infernix.net/job/vagrant-libvirt-qa/qa_vagrant_libvirt_version=master,qa_vagrant_version=1.9.1,distro=debian-8/lastBuild/consoleText)|[![Build Status](https://jenkins.infernix.net/job/vagrant-libvirt-qa/qa_vagrant_libvirt_version=master,qa_vagrant_version=1.9.1,distro=centos-6/badge/icon)](https://jenkins.infernix.net/job/vagrant-libvirt-qa/qa_vagrant_libvirt_version=master,qa_vagrant_version=1.9.1,distro=centos-6/lastBuild/consoleText)|[![Build Status](https://jenkins.infernix.net/job/vagrant-libvirt-qa/qa_vagrant_libvirt_version=master,qa_vagrant_version=1.9.1,distro=centos-7/badge/icon)](https://jenkins.infernix.net/job/vagrant-libvirt-qa/qa_vagrant_libvirt_version=master,qa_vagrant_version=1.9.1,distro=centos-7/lastBuild/consoleText)|[![Build Status](https://jenkins.infernix.net/job/vagrant-libvirt-qa/qa_vagrant_libvirt_version=master,qa_vagrant_version=1.9.1,distro=fedora-21/badge/icon)](https://jenkins.infernix.net/job/vagrant-libvirt-qa/qa_vagrant_libvirt_version=master,qa_vagrant_version=1.9.1,distro=fedora-21/lastBuild/consoleText)|[![Build Status](https://jenkins.infernix.net/job/vagrant-libvirt-qa/qa_vagrant_libvirt_version=master,qa_vagrant_version=1.9.1,distro=fedora-22/badge/icon)](https://jenkins.infernix.net/job/vagrant-libvirt-qa/qa_vagrant_libvirt_version=master,qa_vagrant_version=1.9.1,distro=fedora-22/lastBuild/consoleText)|[![Build Status](https://jenkins.infernix.net/job/vagrant-libvirt-qa/qa_vagrant_libvirt_version=master,qa_vagrant_version=1.9.1,distro=fedora-23/badge/icon)](https://jenkins.infernix.net/job/vagrant-libvirt-qa/qa_vagrant_libvirt_version=master,qa_vagrant_version=1.9.1,distro=fedora-23/lastBuild/consoleText)|[![Build Status](https://jenkins.infernix.net/job/vagrant-libvirt-qa/qa_vagrant_libvirt_version=master,qa_vagrant_version=1.9.1,distro=fedora-24/badge/icon)](https://jenkins.infernix.net/job/vagrant-libvirt-qa/qa_vagrant_libvirt_version=master,qa_vagrant_version=1.9.1,distro=fedora-24/lastBuild/consoleText)|[![Build Status](https://jenkins.infernix.net/job/vagrant-libvirt-qa/qa_vagrant_libvirt_version=master,qa_vagrant_version=1.9.1,distro=arch/badge/icon)](https://jenkins.infernix.net/job/vagrant-libvirt-qa/qa_vagrant_libvirt_version=master,qa_vagrant_version=1.9.1,distro=arch/lastBuild/consoleText)|
22
+ |1.9.1|0.0.37|[![Build Status](https://jenkins.infernix.net/job/vagrant-libvirt-qa/qa_vagrant_libvirt_version=0.0.37,qa_vagrant_version=1.9.1,distro=ubuntu-12.04/badge/icon)](https://jenkins.infernix.net/job/vagrant-libvirt-qa/qa_vagrant_libvirt_version=0.0.37,qa_vagrant_version=1.9.1,distro=ubuntu-12.04/lastBuild/consoleText)|[![Build Status](https://jenkins.infernix.net/job/vagrant-libvirt-qa/qa_vagrant_libvirt_version=0.0.37,qa_vagrant_version=1.9.1,distro=ubuntu-14.04/badge/icon)](https://jenkins.infernix.net/job/vagrant-libvirt-qa/qa_vagrant_libvirt_version=0.0.37,qa_vagrant_version=1.9.1,distro=ubuntu-14.04/lastBuild/consoleText)|[![Build Status](https://jenkins.infernix.net/job/vagrant-libvirt-qa/qa_vagrant_libvirt_version=0.0.37,qa_vagrant_version=1.9.1,distro=ubuntu-16.04/badge/icon)](https://jenkins.infernix.net/job/vagrant-libvirt-qa/qa_vagrant_libvirt_version=0.0.37,qa_vagrant_version=1.9.1,distro=ubuntu-16.04/lastBuild/consoleText)|[![Build Status](https://jenkins.infernix.net/job/vagrant-libvirt-qa/qa_vagrant_libvirt_version=0.0.37,qa_vagrant_version=1.9.1,distro=debian-8/badge/icon)](https://jenkins.infernix.net/job/vagrant-libvirt-qa/qa_vagrant_libvirt_version=0.0.37,qa_vagrant_version=1.9.1,distro=debian-8/lastBuild/consoleText)|[![Build Status](https://jenkins.infernix.net/job/vagrant-libvirt-qa/qa_vagrant_libvirt_version=0.0.37,qa_vagrant_version=1.9.1,distro=centos-6/badge/icon)](https://jenkins.infernix.net/job/vagrant-libvirt-qa/qa_vagrant_libvirt_version=0.0.37,qa_vagrant_version=1.9.1,distro=centos-6/lastBuild/consoleText)|[![Build Status](https://jenkins.infernix.net/job/vagrant-libvirt-qa/qa_vagrant_libvirt_version=0.0.37,qa_vagrant_version=1.9.1,distro=centos-7/badge/icon)](https://jenkins.infernix.net/job/vagrant-libvirt-qa/qa_vagrant_libvirt_version=0.0.37,qa_vagrant_version=1.9.1,distro=centos-7/lastBuild/consoleText)|[![Build Status](https://jenkins.infernix.net/job/vagrant-libvirt-qa/qa_vagrant_libvirt_version=0.0.37,qa_vagrant_version=1.9.1,distro=fedora-21/badge/icon)](https://jenkins.infernix.net/job/vagrant-libvirt-qa/qa_vagrant_libvirt_version=0.0.37,qa_vagrant_version=1.9.1,distro=fedora-21/lastBuild/consoleText)|[![Build Status](https://jenkins.infernix.net/job/vagrant-libvirt-qa/qa_vagrant_libvirt_version=0.0.37,qa_vagrant_version=1.9.1,distro=fedora-22/badge/icon)](https://jenkins.infernix.net/job/vagrant-libvirt-qa/qa_vagrant_libvirt_version=0.0.37,qa_vagrant_version=1.9.1,distro=fedora-22/lastBuild/consoleText)|[![Build Status](https://jenkins.infernix.net/job/vagrant-libvirt-qa/qa_vagrant_libvirt_version=0.0.37,qa_vagrant_version=1.9.1,distro=fedora-23/badge/icon)](https://jenkins.infernix.net/job/vagrant-libvirt-qa/qa_vagrant_libvirt_version=0.0.37,qa_vagrant_version=1.9.1,distro=fedora-23/lastBuild/consoleText)|[![Build Status](https://jenkins.infernix.net/job/vagrant-libvirt-qa/qa_vagrant_libvirt_version=0.0.37,qa_vagrant_version=1.9.1,distro=fedora-24/badge/icon)](https://jenkins.infernix.net/job/vagrant-libvirt-qa/qa_vagrant_libvirt_version=0.0.37,qa_vagrant_version=1.9.1,distro=fedora-24/lastBuild/consoleText)|[![Build Status](https://jenkins.infernix.net/job/vagrant-libvirt-qa/qa_vagrant_libvirt_version=0.0.37,qa_vagrant_version=1.9.1,distro=arch/badge/icon)](https://jenkins.infernix.net/job/vagrant-libvirt-qa/qa_vagrant_libvirt_version=0.0.37,qa_vagrant_version=1.9.1,distro=arch/lastBuild/consoleText)|
23
+ |1.9.1|0.0.35|[![Build Status](https://jenkins.infernix.net/job/vagrant-libvirt-qa/qa_vagrant_libvirt_version=0.0.35,qa_vagrant_version=1.9.1,distro=ubuntu-12.04/badge/icon)](https://jenkins.infernix.net/job/vagrant-libvirt-qa/qa_vagrant_libvirt_version=0.0.35,qa_vagrant_version=1.9.1,distro=ubuntu-12.04/lastBuild/consoleText)|[![Build Status](https://jenkins.infernix.net/job/vagrant-libvirt-qa/qa_vagrant_libvirt_version=0.0.35,qa_vagrant_version=1.9.1,distro=ubuntu-14.04/badge/icon)](https://jenkins.infernix.net/job/vagrant-libvirt-qa/qa_vagrant_libvirt_version=0.0.35,qa_vagrant_version=1.9.1,distro=ubuntu-14.04/lastBuild/consoleText)|[![Build Status](https://jenkins.infernix.net/job/vagrant-libvirt-qa/qa_vagrant_libvirt_version=0.0.35,qa_vagrant_version=1.9.1,distro=ubuntu-16.04/badge/icon)](https://jenkins.infernix.net/job/vagrant-libvirt-qa/qa_vagrant_libvirt_version=0.0.35,qa_vagrant_version=1.9.1,distro=ubuntu-16.04/lastBuild/consoleText)|[![Build Status](https://jenkins.infernix.net/job/vagrant-libvirt-qa/qa_vagrant_libvirt_version=0.0.35,qa_vagrant_version=1.9.1,distro=debian-8/badge/icon)](https://jenkins.infernix.net/job/vagrant-libvirt-qa/qa_vagrant_libvirt_version=0.0.35,qa_vagrant_version=1.9.1,distro=debian-8/lastBuild/consoleText)|[![Build Status](https://jenkins.infernix.net/job/vagrant-libvirt-qa/qa_vagrant_libvirt_version=0.0.35,qa_vagrant_version=1.9.1,distro=centos-6/badge/icon)](https://jenkins.infernix.net/job/vagrant-libvirt-qa/qa_vagrant_libvirt_version=0.0.35,qa_vagrant_version=1.9.1,distro=centos-6/lastBuild/consoleText)|[![Build Status](https://jenkins.infernix.net/job/vagrant-libvirt-qa/qa_vagrant_libvirt_version=0.0.35,qa_vagrant_version=1.9.1,distro=centos-7/badge/icon)](https://jenkins.infernix.net/job/vagrant-libvirt-qa/qa_vagrant_libvirt_version=0.0.35,qa_vagrant_version=1.9.1,distro=centos-7/lastBuild/consoleText)|[![Build Status](https://jenkins.infernix.net/job/vagrant-libvirt-qa/qa_vagrant_libvirt_version=0.0.35,qa_vagrant_version=1.9.1,distro=fedora-21/badge/icon)](https://jenkins.infernix.net/job/vagrant-libvirt-qa/qa_vagrant_libvirt_version=0.0.35,qa_vagrant_version=1.9.1,distro=fedora-21/lastBuild/consoleText)|[![Build Status](https://jenkins.infernix.net/job/vagrant-libvirt-qa/qa_vagrant_libvirt_version=0.0.35,qa_vagrant_version=1.9.1,distro=fedora-22/badge/icon)](https://jenkins.infernix.net/job/vagrant-libvirt-qa/qa_vagrant_libvirt_version=0.0.35,qa_vagrant_version=1.9.1,distro=fedora-22/lastBuild/consoleText)|[![Build Status](https://jenkins.infernix.net/job/vagrant-libvirt-qa/qa_vagrant_libvirt_version=0.0.35,qa_vagrant_version=1.9.1,distro=fedora-23/badge/icon)](https://jenkins.infernix.net/job/vagrant-libvirt-qa/qa_vagrant_libvirt_version=0.0.35,qa_vagrant_version=1.9.1,distro=fedora-23/lastBuild/consoleText)|[![Build Status](https://jenkins.infernix.net/job/vagrant-libvirt-qa/qa_vagrant_libvirt_version=0.0.35,qa_vagrant_version=1.9.1,distro=fedora-24/badge/icon)](https://jenkins.infernix.net/job/vagrant-libvirt-qa/qa_vagrant_libvirt_version=0.0.35,qa_vagrant_version=1.9.1,distro=fedora-24/lastBuild/consoleText)|[![Build Status](https://jenkins.infernix.net/job/vagrant-libvirt-qa/qa_vagrant_libvirt_version=0.0.35,qa_vagrant_version=1.9.1,distro=arch/badge/icon)](https://jenkins.infernix.net/job/vagrant-libvirt-qa/qa_vagrant_libvirt_version=0.0.35,qa_vagrant_version=1.9.1,distro=arch/lastBuild/consoleText)|
24
+ |1.8.7|master|[![Build Status](https://jenkins.infernix.net/job/vagrant-libvirt-qa/qa_vagrant_libvirt_version=master,qa_vagrant_version=1.8.7,distro=ubuntu-12.04/badge/icon)](https://jenkins.infernix.net/job/vagrant-libvirt-qa/qa_vagrant_libvirt_version=master,qa_vagrant_version=1.8.7,distro=ubuntu-12.04/lastBuild/consoleText)|[![Build Status](https://jenkins.infernix.net/job/vagrant-libvirt-qa/qa_vagrant_libvirt_version=master,qa_vagrant_version=1.8.7,distro=ubuntu-14.04/badge/icon)](https://jenkins.infernix.net/job/vagrant-libvirt-qa/qa_vagrant_libvirt_version=master,qa_vagrant_version=1.8.7,distro=ubuntu-14.04/lastBuild/consoleText)|[![Build Status](https://jenkins.infernix.net/job/vagrant-libvirt-qa/qa_vagrant_libvirt_version=master,qa_vagrant_version=1.8.7,distro=ubuntu-16.04/badge/icon)](https://jenkins.infernix.net/job/vagrant-libvirt-qa/qa_vagrant_libvirt_version=master,qa_vagrant_version=1.8.7,distro=ubuntu-16.04/lastBuild/consoleText)|[![Build Status](https://jenkins.infernix.net/job/vagrant-libvirt-qa/qa_vagrant_libvirt_version=master,qa_vagrant_version=1.8.7,distro=debian-8/badge/icon)](https://jenkins.infernix.net/job/vagrant-libvirt-qa/qa_vagrant_libvirt_version=master,qa_vagrant_version=1.8.7,distro=debian-8/lastBuild/consoleText)|[![Build Status](https://jenkins.infernix.net/job/vagrant-libvirt-qa/qa_vagrant_libvirt_version=master,qa_vagrant_version=1.8.7,distro=centos-6/badge/icon)](https://jenkins.infernix.net/job/vagrant-libvirt-qa/qa_vagrant_libvirt_version=master,qa_vagrant_version=1.8.7,distro=centos-6/lastBuild/consoleText)|[![Build Status](https://jenkins.infernix.net/job/vagrant-libvirt-qa/qa_vagrant_libvirt_version=master,qa_vagrant_version=1.8.7,distro=centos-7/badge/icon)](https://jenkins.infernix.net/job/vagrant-libvirt-qa/qa_vagrant_libvirt_version=master,qa_vagrant_version=1.8.7,distro=centos-7/lastBuild/consoleText)|[![Build Status](https://jenkins.infernix.net/job/vagrant-libvirt-qa/qa_vagrant_libvirt_version=master,qa_vagrant_version=1.8.7,distro=fedora-21/badge/icon)](https://jenkins.infernix.net/job/vagrant-libvirt-qa/qa_vagrant_libvirt_version=master,qa_vagrant_version=1.8.7,distro=fedora-21/lastBuild/consoleText)|[![Build Status](https://jenkins.infernix.net/job/vagrant-libvirt-qa/qa_vagrant_libvirt_version=master,qa_vagrant_version=1.8.7,distro=fedora-22/badge/icon)](https://jenkins.infernix.net/job/vagrant-libvirt-qa/qa_vagrant_libvirt_version=master,qa_vagrant_version=1.8.7,distro=fedora-22/lastBuild/consoleText)|[![Build Status](https://jenkins.infernix.net/job/vagrant-libvirt-qa/qa_vagrant_libvirt_version=master,qa_vagrant_version=1.8.7,distro=fedora-23/badge/icon)](https://jenkins.infernix.net/job/vagrant-libvirt-qa/qa_vagrant_libvirt_version=master,qa_vagrant_version=1.8.7,distro=fedora-23/lastBuild/consoleText)|[![Build Status](https://jenkins.infernix.net/job/vagrant-libvirt-qa/qa_vagrant_libvirt_version=master,qa_vagrant_version=1.8.7,distro=fedora-24/badge/icon)](https://jenkins.infernix.net/job/vagrant-libvirt-qa/qa_vagrant_libvirt_version=master,qa_vagrant_version=1.8.7,distro=fedora-24/lastBuild/consoleText)|[![Build Status](https://jenkins.infernix.net/job/vagrant-libvirt-qa/qa_vagrant_libvirt_version=master,qa_vagrant_version=1.8.7,distro=arch/badge/icon)](https://jenkins.infernix.net/job/vagrant-libvirt-qa/qa_vagrant_libvirt_version=master,qa_vagrant_version=1.8.7,distro=arch/lastBuild/consoleText)|
25
+ |1.8.7|0.0.37|[![Build Status](https://jenkins.infernix.net/job/vagrant-libvirt-qa/qa_vagrant_libvirt_version=0.0.37,qa_vagrant_version=1.8.7,distro=ubuntu-12.04/badge/icon)](https://jenkins.infernix.net/job/vagrant-libvirt-qa/qa_vagrant_libvirt_version=0.0.37,qa_vagrant_version=1.8.7,distro=ubuntu-12.04/lastBuild/consoleText)|[![Build Status](https://jenkins.infernix.net/job/vagrant-libvirt-qa/qa_vagrant_libvirt_version=0.0.37,qa_vagrant_version=1.8.7,distro=ubuntu-14.04/badge/icon)](https://jenkins.infernix.net/job/vagrant-libvirt-qa/qa_vagrant_libvirt_version=0.0.37,qa_vagrant_version=1.8.7,distro=ubuntu-14.04/lastBuild/consoleText)|[![Build Status](https://jenkins.infernix.net/job/vagrant-libvirt-qa/qa_vagrant_libvirt_version=0.0.37,qa_vagrant_version=1.8.7,distro=ubuntu-16.04/badge/icon)](https://jenkins.infernix.net/job/vagrant-libvirt-qa/qa_vagrant_libvirt_version=0.0.37,qa_vagrant_version=1.8.7,distro=ubuntu-16.04/lastBuild/consoleText)|[![Build Status](https://jenkins.infernix.net/job/vagrant-libvirt-qa/qa_vagrant_libvirt_version=0.0.37,qa_vagrant_version=1.8.7,distro=debian-8/badge/icon)](https://jenkins.infernix.net/job/vagrant-libvirt-qa/qa_vagrant_libvirt_version=0.0.37,qa_vagrant_version=1.8.7,distro=debian-8/lastBuild/consoleText)|[![Build Status](https://jenkins.infernix.net/job/vagrant-libvirt-qa/qa_vagrant_libvirt_version=0.0.37,qa_vagrant_version=1.8.7,distro=centos-6/badge/icon)](https://jenkins.infernix.net/job/vagrant-libvirt-qa/qa_vagrant_libvirt_version=0.0.37,qa_vagrant_version=1.8.7,distro=centos-6/lastBuild/consoleText)|[![Build Status](https://jenkins.infernix.net/job/vagrant-libvirt-qa/qa_vagrant_libvirt_version=0.0.37,qa_vagrant_version=1.8.7,distro=centos-7/badge/icon)](https://jenkins.infernix.net/job/vagrant-libvirt-qa/qa_vagrant_libvirt_version=0.0.37,qa_vagrant_version=1.8.7,distro=centos-7/lastBuild/consoleText)|[![Build Status](https://jenkins.infernix.net/job/vagrant-libvirt-qa/qa_vagrant_libvirt_version=0.0.37,qa_vagrant_version=1.8.7,distro=fedora-21/badge/icon)](https://jenkins.infernix.net/job/vagrant-libvirt-qa/qa_vagrant_libvirt_version=0.0.37,qa_vagrant_version=1.8.7,distro=fedora-21/lastBuild/consoleText)|[![Build Status](https://jenkins.infernix.net/job/vagrant-libvirt-qa/qa_vagrant_libvirt_version=0.0.37,qa_vagrant_version=1.8.7,distro=fedora-22/badge/icon)](https://jenkins.infernix.net/job/vagrant-libvirt-qa/qa_vagrant_libvirt_version=0.0.37,qa_vagrant_version=1.8.7,distro=fedora-22/lastBuild/consoleText)|[![Build Status](https://jenkins.infernix.net/job/vagrant-libvirt-qa/qa_vagrant_libvirt_version=0.0.37,qa_vagrant_version=1.8.7,distro=fedora-23/badge/icon)](https://jenkins.infernix.net/job/vagrant-libvirt-qa/qa_vagrant_libvirt_version=0.0.37,qa_vagrant_version=1.8.7,distro=fedora-23/lastBuild/consoleText)|[![Build Status](https://jenkins.infernix.net/job/vagrant-libvirt-qa/qa_vagrant_libvirt_version=0.0.37,qa_vagrant_version=1.8.7,distro=fedora-24/badge/icon)](https://jenkins.infernix.net/job/vagrant-libvirt-qa/qa_vagrant_libvirt_version=0.0.37,qa_vagrant_version=1.8.7,distro=fedora-24/lastBuild/consoleText)|[![Build Status](https://jenkins.infernix.net/job/vagrant-libvirt-qa/qa_vagrant_libvirt_version=0.0.37,qa_vagrant_version=1.8.7,distro=arch/badge/icon)](https://jenkins.infernix.net/job/vagrant-libvirt-qa/qa_vagrant_libvirt_version=0.0.37,qa_vagrant_version=1.8.7,distro=arch/lastBuild/consoleText)|
26
+ |1.8.7|0.0.35|[![Build Status](https://jenkins.infernix.net/job/vagrant-libvirt-qa/qa_vagrant_libvirt_version=0.0.35,qa_vagrant_version=1.8.7,distro=ubuntu-12.04/badge/icon)](https://jenkins.infernix.net/job/vagrant-libvirt-qa/qa_vagrant_libvirt_version=0.0.35,qa_vagrant_version=1.8.7,distro=ubuntu-12.04/lastBuild/consoleText)|[![Build Status](https://jenkins.infernix.net/job/vagrant-libvirt-qa/qa_vagrant_libvirt_version=0.0.35,qa_vagrant_version=1.8.7,distro=ubuntu-14.04/badge/icon)](https://jenkins.infernix.net/job/vagrant-libvirt-qa/qa_vagrant_libvirt_version=0.0.35,qa_vagrant_version=1.8.7,distro=ubuntu-14.04/lastBuild/consoleText)|[![Build Status](https://jenkins.infernix.net/job/vagrant-libvirt-qa/qa_vagrant_libvirt_version=0.0.35,qa_vagrant_version=1.8.7,distro=ubuntu-16.04/badge/icon)](https://jenkins.infernix.net/job/vagrant-libvirt-qa/qa_vagrant_libvirt_version=0.0.35,qa_vagrant_version=1.8.7,distro=ubuntu-16.04/lastBuild/consoleText)|[![Build Status](https://jenkins.infernix.net/job/vagrant-libvirt-qa/qa_vagrant_libvirt_version=0.0.35,qa_vagrant_version=1.8.7,distro=debian-8/badge/icon)](https://jenkins.infernix.net/job/vagrant-libvirt-qa/qa_vagrant_libvirt_version=0.0.35,qa_vagrant_version=1.8.7,distro=debian-8/lastBuild/consoleText)|[![Build Status](https://jenkins.infernix.net/job/vagrant-libvirt-qa/qa_vagrant_libvirt_version=0.0.35,qa_vagrant_version=1.8.7,distro=centos-6/badge/icon)](https://jenkins.infernix.net/job/vagrant-libvirt-qa/qa_vagrant_libvirt_version=0.0.35,qa_vagrant_version=1.8.7,distro=centos-6/lastBuild/consoleText)|[![Build Status](https://jenkins.infernix.net/job/vagrant-libvirt-qa/qa_vagrant_libvirt_version=0.0.35,qa_vagrant_version=1.8.7,distro=centos-7/badge/icon)](https://jenkins.infernix.net/job/vagrant-libvirt-qa/qa_vagrant_libvirt_version=0.0.35,qa_vagrant_version=1.8.7,distro=centos-7/lastBuild/consoleText)|[![Build Status](https://jenkins.infernix.net/job/vagrant-libvirt-qa/qa_vagrant_libvirt_version=0.0.35,qa_vagrant_version=1.8.7,distro=fedora-21/badge/icon)](https://jenkins.infernix.net/job/vagrant-libvirt-qa/qa_vagrant_libvirt_version=0.0.35,qa_vagrant_version=1.8.7,distro=fedora-21/lastBuild/consoleText)|[![Build Status](https://jenkins.infernix.net/job/vagrant-libvirt-qa/qa_vagrant_libvirt_version=0.0.35,qa_vagrant_version=1.8.7,distro=fedora-22/badge/icon)](https://jenkins.infernix.net/job/vagrant-libvirt-qa/qa_vagrant_libvirt_version=0.0.35,qa_vagrant_version=1.8.7,distro=fedora-22/lastBuild/consoleText)|[![Build Status](https://jenkins.infernix.net/job/vagrant-libvirt-qa/qa_vagrant_libvirt_version=0.0.35,qa_vagrant_version=1.8.7,distro=fedora-23/badge/icon)](https://jenkins.infernix.net/job/vagrant-libvirt-qa/qa_vagrant_libvirt_version=0.0.35,qa_vagrant_version=1.8.7,distro=fedora-23/lastBuild/consoleText)|[![Build Status](https://jenkins.infernix.net/job/vagrant-libvirt-qa/qa_vagrant_libvirt_version=0.0.35,qa_vagrant_version=1.8.7,distro=fedora-24/badge/icon)](https://jenkins.infernix.net/job/vagrant-libvirt-qa/qa_vagrant_libvirt_version=0.0.35,qa_vagrant_version=1.8.7,distro=fedora-24/lastBuild/consoleText)|[![Build Status](https://jenkins.infernix.net/job/vagrant-libvirt-qa/qa_vagrant_libvirt_version=0.0.35,qa_vagrant_version=1.8.7,distro=arch/badge/icon)](https://jenkins.infernix.net/job/vagrant-libvirt-qa/qa_vagrant_libvirt_version=0.0.35,qa_vagrant_version=1.8.7,distro=arch/lastBuild/consoleText)|
27
+
28
+ ## Index
29
+
30
+
11
31
  - [Features](#features)
12
32
  - [Future work](#future-work)
13
33
  - [Installation](#installation)
@@ -30,6 +50,7 @@ can help a lot :-)
30
50
  - [CDROMs](#cdroms)
31
51
  - [Input](#input)
32
52
  - [PCI device passthrough](#pci-device-passthrough)
53
+ - [USB Redirector Devices](#usb-redirector-devices)
33
54
  - [Random number generator passthrough](#random-number-generator-passthrough)
34
55
  - [CPU Features](#cpu-features)
35
56
  - [No box and PXE boot](#no-box-and-pxe-boot)
@@ -80,6 +101,35 @@ kvm type virtual machines with `virsh` or `virt-manager`.
80
101
  Next, you must have [Vagrant
81
102
  installed](http://docs.vagrantup.com/v2/installation/index.html).
82
103
  Vagrant-libvirt supports Vagrant 1.5, 1.6, 1.7 and 1.8.
104
+ *We only test with the upstream version!* If you decide to install your distros
105
+ version and you run into problems, as a first step you should switch to upstream.
106
+
107
+ Now you need to make sure your have all the build dependencies installed for
108
+ vagrant-libvirt. This depends on your distro. An overview:
109
+
110
+ * Ubuntu 12.04/14.04/16.04, Debian:
111
+ ```shell
112
+ apt-get build-dep vagrant ruby-libvirt
113
+ apt-get install qemu libvirt-bin ebtables dnsmasq
114
+ apt-get install libxslt-dev libxml2-dev libvirt-dev zlib1g-dev ruby-dev
115
+ ```
116
+
117
+ (It is possible some users will already have libraries from the third line installed, but this is the way to make it work OOTB.)
118
+
119
+ * CentOS 6, 7, Fedora 21:
120
+ ```shell
121
+ yum install qemu libvirt libvirt-devel ruby-devel gcc qemu-kvm
122
+ ```
123
+
124
+ * Fedora 22 and up:
125
+ ```shell
126
+ dnf -y install qemu libvirt libvirt-devel ruby-devel gcc
127
+ ```
128
+
129
+ * Arch linux: please read the related [ArchWiki](https://wiki.archlinux.org/index.php/Vagrant#vagrant-libvirt) page.
130
+ ```shell
131
+ pacman -S vagrant
132
+ ```
83
133
 
84
134
  Now you're ready to install vagrant-libvirt using standard [Vagrant
85
135
  plugin](http://docs.vagrantup.com/v2/plugins/usage.html) installation methods.
@@ -93,11 +143,9 @@ $ vagrant plugin install vagrant-libvirt
93
143
  In case of problems with building nokogiri and ruby-libvirt gem, install
94
144
  missing development libraries for libxslt, libxml2 and libvirt.
95
145
 
96
- On Ubuntu, Debian, ...
97
146
 
98
- ```shell
99
- $ sudo apt-get install libxslt-dev libxml2-dev libvirt-dev zlib1g-dev ruby-dev
100
- ```
147
+ On Ubuntu, Debian, make sure you are running all three of the `apt` commands above with `sudo`.
148
+
101
149
 
102
150
  On RedHat, Centos, Fedora, ...
103
151
 
@@ -106,6 +154,8 @@ $ sudo dnf install libxslt-devel libxml2-devel libvirt-devel \
106
154
  libguestfs-tools-c ruby-devel gcc
107
155
  ```
108
156
 
157
+ On Arch linux it is recommended to follow [steps from ArchWiki](https://wiki.archlinux.org/index.php/Vagrant#vagrant-libvirt).
158
+
109
159
  If have problem with installation - check your linker. It should be `ld.gold`:
110
160
 
111
161
  ```shell
@@ -114,6 +164,11 @@ sudo alternatives --set ld /usr/bin/ld.gold
114
164
  sudo ln -fs /usr/bin/ld.gold /usr/bin/ld
115
165
  ```
116
166
 
167
+ If you have issues building ruby-libvirt, try the following:
168
+ ```shell
169
+ CONFIGURE_ARGS='with-ldflags=-L/opt/vagrant/embedded/lib with-libvirt-include=/usr/include/libvirt with-libvirt-lib=/usr/lib' GEM_HOME=~/.vagrant.d/gems GEM_PATH=$GEM_HOME:/opt/vagrant/embedded/gems PATH=/opt/vagrant/embedded/bin:$PATH vagrant plugin install vagrant-libvirt
170
+ ```
171
+
117
172
  ## Vagrant Project Preparation
118
173
 
119
174
  ### Add Box
@@ -233,8 +288,9 @@ end
233
288
  mode](https://libvirt.org/formatdomain.html#elementsCPU). Defaults to
234
289
  'host-model' if not set. Allowed values: host-model, host-passthrough,
235
290
  custom.
236
- * `cpu_model` - CPU Model. Defaults to 'qemu64' if not set. This can really
237
- only be used when setting `cpu_mode` to `custom`.
291
+ * `cpu_model` - CPU Model. Defaults to 'qemu64' if not set and `cpu_mode` is
292
+ `custom` and to '' otherwise. This can really only be used when setting
293
+ `cpu_mode` to `custom`.
238
294
  * `cpu_fallback` - Whether to allow libvirt to fall back to a CPU model close
239
295
  to the specified model if features in the guest CPU are not supported on the
240
296
  host. Defaults to 'allow' if not set. Allowed values: `allow`, `forbid`.
@@ -267,7 +323,7 @@ end
267
323
  * `keymap` - Set keymap for vm. default: en-us
268
324
  * `kvm_hidden` - [Hide the hypervisor from the
269
325
  guest](https://libvirt.org/formatdomain.html#elementsFeatures). Useful for
270
- GPU passthrough on stubborn drivers. Default is false.
326
+ [GPU passthrough](#pci-device-passthrough) on stubborn drivers. Default is false.
271
327
  * `video_type` - Sets the graphics card type exposed to the guest. Defaults to
272
328
  "cirrus". [Possible
273
329
  values](http://libvirt.org/formatdomain.html#elementsVideo) are "vga",
@@ -321,6 +377,10 @@ end
321
377
  for use by the [qemu guest
322
378
  agent](http://wiki.libvirt.org/page/Qemu_guest_agent) and the Spice/QXL
323
379
  graphics type.
380
+ * `mgmt_attach` - Decide if VM has interface in mgmt network. If set to 'false'
381
+ it is not possible to communicate with VM through `vagrant ssh` or run
382
+ provisioning. Setting to 'false' is only possible when VM doesn't use box.
383
+ Defaults set to 'true'.
324
384
 
325
385
  Specific domain settings can be set for each domain separately in multi-VM
326
386
  environment. Example below shows a part of Vagrantfile, where specific options
@@ -419,6 +479,12 @@ An examples of network interface definitions:
419
479
  # default is 127.0.0.1 if omitted
420
480
  # :libvirt__tunnel_ip => '127.0.0.1',
421
481
  :libvirt__tunnel_port => '11111'
482
+ # network with ipv6 support
483
+ test_vm1.vm.network :private_network,
484
+ :ip => "10.20.5.42",
485
+ :libvirt__guest_ipv6 => "yes",
486
+ :libvirt__ipv6_address => "2001:db8:ca2:6::1",
487
+ :libvirt__ipv6_prefix => "64"
422
488
 
423
489
  # Guest 2
424
490
  config.vm.define :test_vm2 do |test_vm2|
@@ -427,6 +493,12 @@ An examples of network interface definitions:
427
493
  # default is 127.0.0.1 if omitted
428
494
  # :libvirt__tunnel_ip => '127.0.0.1',
429
495
  :libvirt__tunnel_port => '11111'
496
+ # network with ipv6 support
497
+ test_vm2.vm.network :private_network,
498
+ :ip => "10.20.5.45",
499
+ :libvirt__guest_ipv6 => "yes",
500
+ :libvirt__ipv6_address => "2001:db8:ca2:6::1",
501
+ :libvirt__ipv6_prefix => "64"
430
502
 
431
503
 
432
504
  # Public Network
@@ -517,7 +589,9 @@ starts with `libvirt__` string. Here is a list of those options:
517
589
  * `:libvirt__guest_ipv6` - Enable or disable guest-to-guest IPv6 communication.
518
590
  See [here](https://libvirt.org/formatnetwork.html#examplesPrivate6), and
519
591
  [here](http://libvirt.org/git/?p=libvirt.git;a=commitdiff;h=705e67d40b09a905cd6a4b8b418d5cb94eaa95a8)
520
- for for more information.
592
+ for for more information. *Note: takes either 'yes' or 'no' for value*
593
+ * `:libvirt__ipv6_address` - Define ipv6 address, require also prefix.
594
+ * `:libvirt__ipv6_prefix` - Define ipv6 prefix. generate string `<ip family="ipv6" address="address" prefix="prefix" >`
521
595
  * `:libvirt__iface_name` - Define a name for the private network interface.
522
596
  With this feature one can [simulate physical link
523
597
  failures](https://github.com/vagrant-libvirt/vagrant-libvirt/pull/498)
@@ -526,6 +600,8 @@ starts with `libvirt__` string. Here is a list of those options:
526
600
  * `:model_type` - parameter specifies the model of the network adapter when you
527
601
  create a domain value by default virtio KVM believe possible values, see the
528
602
  documentation for libvirt
603
+ * `:autostart` - Automatic startup of network by the libvirt daemon.
604
+ If not specified the default is 'false'.
529
605
 
530
606
  When the option `:libvirt__dhcp_enabled` is to to 'false' it shouldn't matter
531
607
  whether the virtual network contains a DHCP server or not and vagrant-libvirt
@@ -555,20 +631,25 @@ virtual network.
555
631
 
556
632
  vagrant-libvirt uses a private network to perform some management operations on
557
633
  VMs. All VMs will have an interface connected to this network and an IP address
558
- dynamically assigned by libvirt. This is in addition to any networks you
559
- configure. The name and address used by this network are configurable at the
560
- provider level.
634
+ dynamically assigned by libvirt unless you set `:mgmt_attach` to 'false'.
635
+ This is in addition to any networks you configure. The name and address
636
+ used by this network are configurable at the provider level.
561
637
 
562
638
  * `management_network_name` - Name of libvirt network to which all VMs will be
563
639
  connected. If not specified the default is 'vagrant-libvirt'.
564
640
  * `management_network_address` - Address of network to which all VMs will be
565
641
  connected. Must include the address and subnet mask. If not specified the
566
642
  default is '192.168.121.0/24'.
643
+ * `management_network_mode` - Network mode for the libvirt management network.
644
+ Specify one of veryisolated, none, nat or route options. Further documentated
645
+ under [Private Networks](#private-network-options)
567
646
  * `management_network_guest_ipv6` - Enable or disable guest-to-guest IPv6
568
647
  communication. See
569
648
  [here](https://libvirt.org/formatnetwork.html#examplesPrivate6), and
570
649
  [here](http://libvirt.org/git/?p=libvirt.git;a=commitdiff;h=705e67d40b09a905cd6a4b8b418d5cb94eaa95a8)
571
650
  for for more information.
651
+ * `management_network_autostart` - Automatic startup of mgmt network, if not
652
+ specified the default is 'false'.
572
653
 
573
654
  You may wonder how vagrant-libvirt knows the IP address a VM received. Libvirt
574
655
  doesn't provide a standard way to find out the IP address of a running domain.
@@ -657,7 +738,7 @@ You can specify multiple inputs to the VM via `libvirt.input`. Available
657
738
  options are listed below. Note that both options are required:
658
739
 
659
740
  * `type` - The type of the input
660
- * `bus` - The bust of the input
741
+ * `bus` - The bus of the input
661
742
 
662
743
  ```ruby
663
744
  Vagrant.configure("2") do |config|
@@ -702,6 +783,62 @@ Vagrant.configure("2") do |config|
702
783
  end
703
784
  ```
704
785
 
786
+ Note! Above options affect configuration only at domain creation. It won't change VM behaviour on `vagrant reload` after domain was created.
787
+
788
+ Don't forget to [set](#domain-specific-options) `kvm_hidden` option to `true` especially if you are passthroughing NVIDIA GPUs. Otherwise GPU is visible from VM but cannot be operated.
789
+
790
+ ## USB Redirector Devices
791
+ You can specify multiple redirect devices via `libvirt.redirdev`. There are two types, `tcp` and `spicevmc` supported, for forwarding USB-devices to the guest. Available options are listed below.
792
+
793
+ * `type` - The type of the USB redirector device. (`tcp` or `spicevmc`)
794
+ * `host` - The host where the device is attached to. (mandatory for type `tcp`)
795
+ * `port` - The port where the device is listening. (mandatory for type `tcp`)
796
+
797
+ ```ruby
798
+ Vagrant.configure("2") do |config|
799
+ config.vm.provider :libvirt do |libvirt|
800
+ # add two devices using spicevmc channel
801
+ (1..2).each do
802
+ libvirt.redirdev :type => "spicevmc"
803
+ end
804
+ # add device, provided by localhost:4000
805
+ libvirt.redirdev :type => "tcp", :host => "localhost", :port => "4000"
806
+ end
807
+ end
808
+ ```
809
+
810
+ ### Filter for USB Redirector Devices
811
+ 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.
812
+
813
+ * `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).
814
+ * `vendor` - The vendor of the USB device.
815
+ * `product` - The product id of the USB device.
816
+ * `version` - The version of the USB device. Note that this is the version of `bcdDevice`
817
+ * `allow` - allow or disallow redirecting this device. (mandatory)
818
+
819
+ You can extract that information from output of `lsusb` command. Every line contains the information in format `Bus [<bus>] Device [<device>]: ID [<vendor>:[<product>]`. The `version` can be extracted from the detailed output of the device using `lsusb -D /dev/usb/[<bus>]/[<device>]`. For example:
820
+
821
+ ```shell
822
+ # get bcdDevice from
823
+ $: lsusb
824
+ Bus 001 Device 009: ID 08e6:3437 Gemalto (was Gemplus) GemPC Twin SmartCard Reader
825
+
826
+ $: lsusb -D /dev/bus/usb/001/009 | grep bcdDevice
827
+ bcdDevice 2.00
828
+ ```
829
+
830
+ In this case, the USB device with `class 0x0b`, `vendor 0x08e6`, `product 0x3437` and `bcdDevice version 2.00` is allowed to be redirected to the guest. All other devices will be refused.
831
+
832
+ ```ruby
833
+ Vagrant.configure("2") do |config|
834
+ config.vm.provider :libvirt do |libvirt|
835
+ libvirt.redirdev :type => "spicevmc"
836
+ libvirt.redirfilter :class => "0x0b" :vendor => "0x08e6" :product => "0x3437" :version => "2.00" :allow => "yes"
837
+ libvirt.redirfilter :allow => "no"
838
+ end
839
+ end
840
+ ```
841
+
705
842
  ## Random number generator passthrough
706
843
 
707
844
  You can pass through `/dev/random` to your VM by configuring the domain like this:
@@ -805,6 +942,25 @@ Vagrant.configure("2") do |config|
805
942
  end
806
943
  ```
807
944
 
945
+ Example for vm with 2 networks and only 1 is bootable and has dhcp server in this subnet, for example foreman with dhcp server
946
+ Name of network "foreman_managed" is key for define boot order
947
+ ```ruby
948
+ config.vm.define :pxeclient do |pxeclient|
949
+ pxeclient.vm.network :private_network,ip: '10.0.0.5',
950
+ libvirt__network_name: "foreman_managed",
951
+ libvirt__dhcp_enabled: false,
952
+ libvirt__host_ip: '10.0.0.1'
953
+
954
+ pxeclient.vm.provider :libvirt do |domain|
955
+ domain.memory = 1000
956
+ boot_network = {'network' => 'foreman_managed'}
957
+ domain.storage :file, :size => '100G', :type => 'qcow2'
958
+ domain.boot boot_network
959
+ domain.boot 'hd'
960
+ end
961
+ end
962
+ ```
963
+
808
964
  ## SSH Access To VM
809
965
 
810
966
  vagrant-libvirt supports vagrant's [standard ssh
@@ -842,7 +998,7 @@ config.vm.synced_folder './', '/vagrant', type: 'rsync'
842
998
  or
843
999
 
844
1000
  ```shell
845
- config.vm.synced_folder './', '/vagrant', type: '9p', disabled: false, accessmode: "squash", owner: "vagrant"
1001
+ config.vm.synced_folder './', '/vagrant', type: '9p', disabled: false, accessmode: "squash", owner: "1000"
846
1002
  ```
847
1003
 
848
1004
  or
@@ -854,6 +1010,8 @@ config.vm.synced_folder './', '/vagrant', type: '9p', disabled: false, accessmod
854
1010
  For 9p shares, a `mount: false` option allows to define synced folders without
855
1011
  mounting them at boot.
856
1012
 
1013
+ Further documentation on using 9p can be found [here](https://www.kernel.org/doc/Documentation/filesystems/9p.txt). Please do note that 9p depends on support in the guest and not all distros come with the 9p module by default.
1014
+
857
1015
  **SECURITY NOTE:** for remote libvirt, nfs synced folders requires a bridged
858
1016
  public network interface and you must connect to libvirt via ssh.
859
1017
 
@@ -12,7 +12,7 @@ module VagrantPlugins
12
12
  end
13
13
 
14
14
  def _disk_name(name, disk)
15
- "#{name}-#{disk[:device]}.#{disk[:type]}" # disk name
15
+ "#{name}-#{disk[:device]}.#{disk[:type]}" # disk name
16
16
  end
17
17
 
18
18
  def _disks_print(disks)
@@ -55,10 +55,10 @@ module VagrantPlugins
55
55
  @graphics_autoport = config.graphics_autoport
56
56
  @graphics_port = config.graphics_port
57
57
  @graphics_ip = config.graphics_ip
58
- @graphics_passwd = if config.graphics_passwd.to_s.empty?
59
- ''
60
- else
61
- "passwd='#{config.graphics_passwd}'"
58
+ @graphics_passwd = if config.graphics_passwd.to_s.empty?
59
+ ''
60
+ else
61
+ "passwd='#{config.graphics_passwd}'"
62
62
  end
63
63
  @video_type = config.video_type
64
64
  @video_vram = config.video_vram
@@ -89,8 +89,12 @@ module VagrantPlugins
89
89
  # USB device passthrough
90
90
  @usbs = config.usbs
91
91
 
92
+ # Redirected devices
93
+ @redirdevs = config.redirdevs
94
+ @redirfilters = config.redirfilters
95
+
92
96
  # RNG device passthrough
93
- @rng =config.rng
97
+ @rng = config.rng
94
98
 
95
99
  config = env[:machine].provider_config
96
100
  @domain_type = config.driver
@@ -104,7 +108,8 @@ module VagrantPlugins
104
108
  x.pool_name == @storage_pool_name
105
109
  end
106
110
  domain_volume = ProviderLibvirt::Util::Collection.find_matching(
107
- actual_volumes,"#{@name}.img")
111
+ actual_volumes, "#{@name}.img"
112
+ )
108
113
  raise Errors::DomainVolumeExists if domain_volume.nil?
109
114
  @domain_volume_path = domain_volume.path
110
115
  end
@@ -113,12 +118,12 @@ module VagrantPlugins
113
118
  # If not, we dump the storage pool xml to get its defined path.
114
119
  # the default storage prefix is typically: /var/lib/libvirt/images/
115
120
  if env[:machine].config.vm.box
116
- storage_prefix = File.dirname(@domain_volume_path) + '/' # steal
121
+ storage_prefix = File.dirname(@domain_volume_path) + '/' # steal
117
122
  else
118
123
  storage_pool = env[:machine].provider.driver.connection.client.lookup_storage_pool_by_name(@storage_pool_name)
119
124
  raise Errors::NoStoragePool if storage_pool.nil?
120
125
  xml = Nokogiri::XML(storage_pool.xml_desc)
121
- storage_prefix = xml.xpath("/pool/target/path").inner_text.to_s + '/'
126
+ storage_prefix = xml.xpath('/pool/target/path').inner_text.to_s + '/'
122
127
  end
123
128
 
124
129
  @disks.each do |disk|
@@ -144,10 +149,11 @@ module VagrantPlugins
144
149
  path: disk[:absolute_path],
145
150
  capacity: disk[:size],
146
151
  #:allocation => ?,
147
- pool_name: @storage_pool_name)
152
+ pool_name: @storage_pool_name
153
+ )
148
154
  rescue Fog::Errors::Error => e
149
155
  raise Errors::FogDomainVolumeCreateError,
150
- error_message: e.message
156
+ error_message: e.message
151
157
  end
152
158
  else
153
159
  disk[:preexisting] = true
@@ -157,9 +163,7 @@ module VagrantPlugins
157
163
  # Output the settings we're going to use to the user
158
164
  env[:ui].info(I18n.t('vagrant_libvirt.creating_domain'))
159
165
  env[:ui].info(" -- Name: #{@name}")
160
- if @uuid != ''
161
- env[:ui].info(" -- Forced UUID: #{@uuid}")
162
- end
166
+ env[:ui].info(" -- Forced UUID: #{@uuid}") if @uuid != ''
163
167
  env[:ui].info(" -- Domain type: #{@domain_type}")
164
168
  env[:ui].info(" -- Cpus: #{@cpus}")
165
169
  @cpu_features.each do |cpu_feature|
@@ -189,7 +193,7 @@ module VagrantPlugins
189
193
  env[:ui].info(" -- Boot device: #{device}")
190
194
  end
191
195
 
192
- if @disks.length > 0
196
+ unless @disks.empty?
193
197
  env[:ui].info(" -- Disks: #{_disks_print(@disks)}")
194
198
  end
195
199
 
@@ -201,7 +205,7 @@ module VagrantPlugins
201
205
  env[:ui].info(msg)
202
206
  end
203
207
 
204
- if @cdroms.length > 0
208
+ unless @cdroms.empty?
205
209
  env[:ui].info(" -- CDROMS: #{_cdroms_print(@cdroms)}")
206
210
  end
207
211
 
@@ -222,7 +226,7 @@ module VagrantPlugins
222
226
  env[:ui].info(" -- PCI passthrough: #{pci[:bus]}:#{pci[:slot]}.#{pci[:function]}")
223
227
  end
224
228
 
225
- if !@rng[:model].nil?
229
+ unless @rng[:model].nil?
226
230
  env[:ui].info(" -- RNG device model: #{@rng[:model]}")
227
231
  end
228
232
 
@@ -235,6 +239,26 @@ module VagrantPlugins
235
239
  env[:ui].info(" -- USB passthrough: #{usb_dev.join(', ')}")
236
240
  end
237
241
 
242
+ unless @redirdevs.empty?
243
+ env[:ui].info(' -- Redirected Devices: ')
244
+ @redirdevs.each do |redirdev|
245
+ msg = " -> bus=usb, type=#{redirdev[:type]}"
246
+ env[:ui].info(msg)
247
+ end
248
+ end
249
+
250
+ unless @redirfilters.empty?
251
+ env[:ui].info(' -- USB Device filter for Redirected Devices: ')
252
+ @redirfilters.each do |redirfilter|
253
+ msg = " -> class=#{redirfilter[:class]}, "
254
+ msg += "vendor=#{redirfilter[:vendor]}, "
255
+ msg += "product=#{redirfilter[:product]}, "
256
+ msg += "version=#{redirfilter[:version]}, "
257
+ msg += "allow=#{redirfilter[:allow]}"
258
+ env[:ui].info(msg)
259
+ end
260
+ end
261
+
238
262
  env[:ui].info(" -- Command line : #{@cmd_line}")
239
263
 
240
264
  # Create libvirt domain.
@@ -242,9 +266,10 @@ module VagrantPlugins
242
266
  # existing volume? Use domain creation from template..
243
267
  begin
244
268
  server = env[:machine].provider.driver.connection.servers.create(
245
- xml: to_xml('domain'))
269
+ xml: to_xml('domain')
270
+ )
246
271
  rescue Fog::Errors::Error => e
247
- raise Errors::FogCreateServerError, error_message: e.message
272
+ raise Errors::FogCreateServerError, error_message: e.message
248
273
  end
249
274
 
250
275
  # Immediately save the ID since it is created at this point.
@@ -3,20 +3,19 @@ require 'log4r'
3
3
  module VagrantPlugins
4
4
  module ProviderLibvirt
5
5
  module Action
6
-
7
6
  # Create a snapshot of base box image. This new snapshot is just new
8
7
  # cow image with backing storage pointing to base box image. Use this
9
8
  # image as new domain volume.
10
9
  class CreateDomainVolume
11
10
  include VagrantPlugins::ProviderLibvirt::Util::ErbTemplate
12
11
 
13
- def initialize(app, env)
14
- @logger = Log4r::Logger.new("vagrant_libvirt::action::create_domain_volume")
12
+ def initialize(app, _env)
13
+ @logger = Log4r::Logger.new('vagrant_libvirt::action::create_domain_volume')
15
14
  @app = app
16
15
  end
17
16
 
18
17
  def call(env)
19
- env[:ui].info(I18n.t("vagrant_libvirt.creating_domain_volume"))
18
+ env[:ui].info(I18n.t('vagrant_libvirt.creating_domain_volume'))
20
19
 
21
20
  # Get config options.
22
21
  config = env[:machine].provider_config
@@ -26,33 +25,34 @@ module VagrantPlugins
26
25
 
27
26
  # Verify the volume doesn't exist already.
28
27
  domain_volume = ProviderLibvirt::Util::Collection.find_matching(
29
- env[:machine].provider.driver.connection.volumes.all, @name)
28
+ env[:machine].provider.driver.connection.volumes.all, @name
29
+ )
30
30
  raise Errors::DomainVolumeExists if domain_volume
31
31
 
32
32
  # Get path to backing image - box volume.
33
33
  box_volume = ProviderLibvirt::Util::Collection.find_matching(
34
- env[:machine].provider.driver.connection.volumes.all, env[:box_volume_name])
34
+ env[:machine].provider.driver.connection.volumes.all, env[:box_volume_name]
35
+ )
35
36
  @backing_file = box_volume.path
36
37
 
37
38
  # Virtual size of image. Take value worked out by HandleBoxImage
38
- @capacity = env[:box_virtual_size] #G
39
+ @capacity = env[:box_virtual_size] # G
39
40
 
40
41
  # Create new volume from xml template. Fog currently doesn't support
41
42
  # volume snapshots directly.
42
43
  begin
43
44
  domain_volume = env[:machine].provider.driver.connection.volumes.create(
44
- :xml => to_xml('volume_snapshot'),
45
- :pool_name => config.storage_pool_name)
45
+ xml: to_xml('volume_snapshot'),
46
+ pool_name: config.storage_pool_name
47
+ )
46
48
  rescue Fog::Errors::Error => e
47
49
  raise Errors::FogDomainVolumeCreateError,
48
- :error_message => e.message
50
+ error_message: e.message
49
51
  end
50
52
 
51
53
  @app.call(env)
52
54
  end
53
55
  end
54
-
55
56
  end
56
57
  end
57
58
  end
58
-