mirror of
https://github.com/vagrant-libvirt/vagrant-libvirt.git
synced 2025-01-07 14:33:08 -06:00
Updated Libvirt-based Vagrant box search reference and edited names for consistency
This commit is contained in:
parent
4b8f274957
commit
41e5b2f362
120
README.md
120
README.md
@ -4,7 +4,7 @@
|
||||
[![Build Status](https://travis-ci.org/vagrant-libvirt/vagrant-libvirt.svg)](https://travis-ci.org/vagrant-libvirt/vagrant-libvirt)
|
||||
[![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)
|
||||
|
||||
This is a [Vagrant](http://www.vagrantup.com) plugin that adds an
|
||||
This is a [Vagrant](http://www.vagrantup.com) plugin that adds a
|
||||
[Libvirt](http://libvirt.org) provider to Vagrant, allowing Vagrant to
|
||||
control and provision machines via Libvirt toolkit.
|
||||
|
||||
@ -83,24 +83,24 @@ can help a lot :-)
|
||||
|
||||
## Installation
|
||||
|
||||
First, you should have both qemu and libvirt installed if you plan to run VMs
|
||||
on your local system. For instructions, refer to your linux distribution's
|
||||
First, you should have both QEMU and Libvirt installed if you plan to run VMs
|
||||
on your local system. For instructions, refer to your Linux distribution's
|
||||
documentation.
|
||||
|
||||
**NOTE:** Before you start using Vagrant-libvirt, please make sure your libvirt
|
||||
and qemu installation is working correctly and you are able to create qemu or
|
||||
kvm type virtual machines with `virsh` or `virt-manager`.
|
||||
**NOTE:** Before you start using vagrant-libvirt, please make sure your Libvirt
|
||||
and QEMU installation is working correctly and you are able to create QEMU or
|
||||
KVM type virtual machines with `virsh` or `virt-manager`.
|
||||
|
||||
Next, you must have [Vagrant
|
||||
installed](http://docs.vagrantup.com/v2/installation/index.html).
|
||||
Vagrant-libvirt supports Vagrant 1.5, 1.6, 1.7 and 1.8.
|
||||
*We only test with the upstream version!* If you decide to install your distros
|
||||
*We only test with the upstream version!* If you decide to install your distro's
|
||||
version and you run into problems, as a first step you should switch to upstream.
|
||||
|
||||
Now you need to make sure your have all the build dependencies installed for
|
||||
vagrant-libvirt. This depends on your distro. An overview:
|
||||
|
||||
* Ubuntu 12.04/14.04/16.04, Debian:
|
||||
* Ubuntu, Debian:
|
||||
```shell
|
||||
apt-get build-dep vagrant ruby-libvirt
|
||||
apt-get install qemu libvirt-bin ebtables dnsmasq-base
|
||||
@ -119,7 +119,7 @@ yum install qemu libvirt libvirt-devel ruby-devel gcc qemu-kvm
|
||||
dnf -y install qemu libvirt libvirt-devel ruby-devel gcc
|
||||
```
|
||||
|
||||
* Arch linux: please read the related [ArchWiki](https://wiki.archlinux.org/index.php/Vagrant#vagrant-libvirt) page.
|
||||
* Arch Linux: please read the related [ArchWiki](https://wiki.archlinux.org/index.php/Vagrant#vagrant-libvirt) page.
|
||||
```shell
|
||||
pacman -S vagrant
|
||||
```
|
||||
@ -147,7 +147,7 @@ $ sudo dnf install libxslt-devel libxml2-devel libvirt-devel \
|
||||
libguestfs-tools-c ruby-devel gcc
|
||||
```
|
||||
|
||||
On Arch linux it is recommended to follow [steps from ArchWiki](https://wiki.archlinux.org/index.php/Vagrant#vagrant-libvirt).
|
||||
On Arch Linux it is recommended to follow [steps from ArchWiki](https://wiki.archlinux.org/index.php/Vagrant#vagrant-libvirt).
|
||||
|
||||
If have problem with installation - check your linker. It should be `ld.gold`:
|
||||
|
||||
@ -169,8 +169,8 @@ CONFIGURE_ARGS='with-ldflags=-L/opt/vagrant/embedded/lib with-libvirt-include=/u
|
||||
After installing the plugin (instructions above), the quickest way to get
|
||||
started is to add Libvirt box and specify all the details manually within a
|
||||
`config.vm.provider` block. So first, add Libvirt box using any name you want.
|
||||
You can find more libvirt ready boxes at
|
||||
[Atlas](https://atlas.hashicorp.com/boxes/search?provider=libvirt). For
|
||||
You can find more Libvirt-ready boxes at
|
||||
[Vagrant Cloud](https://app.vagrantup.com/boxes/search?provider=libvirt). For
|
||||
example:
|
||||
|
||||
```shell
|
||||
@ -210,7 +210,7 @@ export VAGRANT_DEFAULT_PROVIDER=libvirt
|
||||
|
||||
Vagrant goes through steps below when creating new project:
|
||||
|
||||
1. Connect to Libvirt localy or remotely via SSH.
|
||||
1. Connect to Libvirt locally or remotely via SSH.
|
||||
2. Check if box image is available in Libvirt storage pool. If not, upload it
|
||||
to remote Libvirt storage pool as new volume.
|
||||
3. Create COW diff image of base box image for new Libvirt domain.
|
||||
@ -227,22 +227,22 @@ Vagrant goes through steps below when creating new project:
|
||||
Although it should work without any configuration for most people, this
|
||||
provider exposes quite a few provider-specific configuration options. The
|
||||
following options allow you to configure how vagrant-libvirt connects to
|
||||
libvirt, and are used to generate the [libvirt connection
|
||||
Libvirt, and are used to generate the [Libvirt connection
|
||||
URI](http://libvirt.org/uri.html):
|
||||
|
||||
* `driver` - A hypervisor name to access. For now only kvm and qemu are
|
||||
* `driver` - A hypervisor name to access. For now only KVM and QEMU are
|
||||
supported
|
||||
* `host` - The name of the server, where libvirtd is running
|
||||
* `host` - The name of the server, where Libvirtd is running
|
||||
* `connect_via_ssh` - If use ssh tunnel to connect to Libvirt. Absolutely
|
||||
needed to access libvirt on remote host. It will not be able to get the IP
|
||||
needed to access Libvirt on remote host. It will not be able to get the IP
|
||||
address of a started VM otherwise.
|
||||
* `username` - Username and password to access Libvirt
|
||||
* `password` - Password to access Libvirt
|
||||
* `id_ssh_key_file` - If not nil, uses this ssh private key to access Libvirt.
|
||||
Default is `$HOME/.ssh/id_rsa`. Prepends `$HOME/.ssh/` if no directory
|
||||
* `socket` - Path to the libvirt unix socket (e.g.
|
||||
* `socket` - Path to the Libvirt unix socket (e.g.
|
||||
`/var/run/libvirt/libvirt-sock`)
|
||||
* `uri` - For advanced usage. Directly specifies what libvirt connection URI
|
||||
* `uri` - For advanced usage. Directly specifies what Libvirt connection URI
|
||||
vagrant-libvirt should use. Overrides all other connection configuration
|
||||
options
|
||||
|
||||
@ -264,7 +264,7 @@ end
|
||||
### Domain Specific Options
|
||||
|
||||
* `disk_bus` - The type of disk device to emulate. Defaults to virtio if not
|
||||
set. Possible values are documented in libvirt's [description for
|
||||
set. Possible values are documented in Libvirt's [description for
|
||||
_target_](http://libvirt.org/formatdomain.html#elementsDisks). NOTE: this
|
||||
option applies only to disks associated with a box image. To set the bus type
|
||||
on additional disks, see the [Additional Disks](#additional-disks) section.
|
||||
@ -275,7 +275,7 @@ end
|
||||
* `nic_model_type` - parameter specifies the model of the network adapter when
|
||||
you create a domain value by default virtio KVM believe possible values, see
|
||||
the [documentation for
|
||||
libvirt](https://libvirt.org/formatdomain.html#elementsNICSModel).
|
||||
Libvirt](https://libvirt.org/formatdomain.html#elementsNICSModel).
|
||||
* `memory` - Amount of memory in MBytes. Defaults to 512 if not set.
|
||||
* `cpus` - Number of virtual cpus. Defaults to 1 if not set.
|
||||
* `cputopology` - Number of CPU sockets, cores and threads running per core. All fields of `:sockets`, `:cores` and `:threads` are mandatory, `cpus` domain option must be present and must be equal to total count of **sockets * cores * threads**. For more details see [documentation](https://libvirt.org/formatdomain.html#elementsCPU).
|
||||
@ -299,7 +299,7 @@ end
|
||||
* `cpu_model` - CPU Model. Defaults to 'qemu64' if not set and `cpu_mode` is
|
||||
`custom` and to '' otherwise. This can really only be used when setting
|
||||
`cpu_mode` to `custom`.
|
||||
* `cpu_fallback` - Whether to allow libvirt to fall back to a CPU model close
|
||||
* `cpu_fallback` - Whether to allow Libvirt to fall back to a CPU model close
|
||||
to the specified model if features in the guest CPU are not supported on the
|
||||
host. Defaults to 'allow' if not set. Allowed values: `allow`, `forbid`.
|
||||
* `numa_nodes` - Specify an array of NUMA nodes for the guest. The syntax is similar to what would be set in the domain XML. `memory` must be in MB. Symmetrical and asymmetrical topologies are supported but make sure your total count of defined CPUs adds up to `v.cpus`.
|
||||
@ -315,7 +315,7 @@ end
|
||||
* `loader` - Sets path to custom UEFI loader.
|
||||
* `volume_cache` - Controls the cache mechanism. Possible values are "default",
|
||||
"none", "writethrough", "writeback", "directsync" and "unsafe". [See
|
||||
driver->cache in libvirt
|
||||
driver->cache in Libvirt
|
||||
documentation](http://libvirt.org/formatdomain.html#elementsDisks).
|
||||
* `kernel` - To launch the guest with a kernel residing on host filesystems.
|
||||
Equivalent to qemu `-kernel`.
|
||||
@ -323,7 +323,7 @@ end
|
||||
to qemu `-initrd`.
|
||||
* `random_hostname` - To create a domain name with extra information on the end
|
||||
to prevent hostname conflicts.
|
||||
* `default_prefix` - The default libvirt guest name becomes a concatenation of the
|
||||
* `default_prefix` - The default Libvirt guest name becomes a concatenation of the
|
||||
`<current_directory>_<guest_name>`. The current working directory is the default prefix
|
||||
to the guest name. The `default_prefix` options allow you to set the guest name prefix.
|
||||
* `cmd_line` - Arguments passed on to the guest kernel initramfs or initrd to
|
||||
@ -336,8 +336,8 @@ end
|
||||
* `graphics_ip` - Sets the IP for the display protocol to bind to. Defaults to
|
||||
"127.0.0.1".
|
||||
* `graphics_passwd` - Sets the password for the display protocol. Working for
|
||||
vnc and spice. by default working without passsword.
|
||||
* `graphics_autoport` - Sets autoport for graphics, libvirt in this case
|
||||
vnc and Spice. by default working without passsword.
|
||||
* `graphics_autoport` - Sets autoport for graphics, Libvirt in this case
|
||||
ignores graphics_port value, Defaults to 'yes'. Possible value are "yes" and
|
||||
"no"
|
||||
* `keymap` - Set keymap for vm. default: en-us
|
||||
@ -354,8 +354,8 @@ end
|
||||
Defaults to "ich6".
|
||||
* `machine_type` - Sets machine type. Equivalent to qemu `-machine`. Use
|
||||
`qemu-system-x86_64 -machine help` to get a list of supported machines.
|
||||
* `machine_arch` - Sets machine architecture. This helps libvirt to determine
|
||||
the correct emulator type. Possible values depend on your version of qemu.
|
||||
* `machine_arch` - Sets machine architecture. This helps Libvirt to determine
|
||||
the correct emulator type. Possible values depend on your version of QEMU.
|
||||
For possible values, see which emulator executable `qemu-system-*` your
|
||||
system provides. Common examples are `aarch64`, `alpha`, `arm`, `cris`,
|
||||
`i386`, `lm32`, `m68k`, `microblaze`, `microblazeel`, `mips`, `mips64`,
|
||||
@ -379,7 +379,7 @@ end
|
||||
* `nic_adapter_count` - Defaults to '8'. Only use case for increasing this
|
||||
count is for VMs that virtualize switches such as Cumulus Linux. Max value
|
||||
for Cumulus Linux VMs is 33.
|
||||
* `uuid` - Force a domain UUID. Defaults to autogenerated value by libvirt if
|
||||
* `uuid` - Force a domain UUID. Defaults to autogenerated value by Libvirt if
|
||||
not set.
|
||||
* `suspend_mode` - What is done on vagrant suspend. Possible values: 'pause',
|
||||
'managedsave'. Pause mode executes a la `virsh suspend`, which just pauses
|
||||
@ -393,10 +393,10 @@ end
|
||||
specified here.
|
||||
* `autostart` - Automatically start the domain when the host boots. Defaults to
|
||||
'false'.
|
||||
* `channel` - [libvirt
|
||||
* `channel` - [Libvirt
|
||||
channels](https://libvirt.org/formatdomain.html#elementCharChannel).
|
||||
Configure a private communication channel between the host and guest, e.g.
|
||||
for use by the [qemu guest
|
||||
for use by the [QEMU guest
|
||||
agent](http://wiki.libvirt.org/page/Qemu_guest_agent) and the Spice/QXL
|
||||
graphics type.
|
||||
* `mgmt_attach` - Decide if VM has interface in mgmt network. If set to 'false'
|
||||
@ -477,11 +477,11 @@ https://libvirt.org/formatdomain.html#elementsNICSTCP
|
||||
|
||||
http://libvirt.org/formatdomain.html#elementsNICSMulticast
|
||||
|
||||
http://libvirt.org/formatdomain.html#elementsNICSUDP _(in libvirt v1.2.20 and higher)_
|
||||
http://libvirt.org/formatdomain.html#elementsNICSUDP _(in Libvirt v1.2.20 and higher)_
|
||||
|
||||
Public Network interfaces are currently implemented using the macvtap driver.
|
||||
The macvtap driver is only available with the Linux Kernel version >= 2.6.24.
|
||||
See the following libvirt documentation for the details of the macvtap usage.
|
||||
See the following Libvirt documentation for the details of the macvtap usage.
|
||||
|
||||
http://www.libvirt.org/formatdomain.html#elementsNICSDirect
|
||||
|
||||
@ -550,7 +550,7 @@ In example below, one network interface is configured for VM `test_vm1`. After
|
||||
you run `vagrant up`, VM will be accessible on IP address `10.20.30.40`. So if
|
||||
you install a web server via provisioner, you will be able to access your
|
||||
testing server on `http://10.20.30.40` URL. But beware that this address is
|
||||
private to libvirt host only. It's not visible outside of the hypervisor box.
|
||||
private to Libvirt host only. It's not visible outside of the hypervisor box.
|
||||
|
||||
If network `10.20.30.0/24` doesn't exist, provider will create it. By default
|
||||
created networks are NATed to outside world, so your VM will be able to connect
|
||||
@ -567,11 +567,11 @@ reachable by anyone with access to the public network.
|
||||
|
||||
*Note: These options are not applicable to public network interfaces.*
|
||||
|
||||
There is a way to pass specific options for libvirt provider when using
|
||||
There is a way to pass specific options for Libvirt provider when using
|
||||
`config.vm.network` to configure new network interface. Each parameter name
|
||||
starts with `libvirt__` string. Here is a list of those options:
|
||||
|
||||
* `:libvirt__network_name` - Name of libvirt network to connect to. By default,
|
||||
* `:libvirt__network_name` - Name of Libvirt network to connect to. By default,
|
||||
network 'default' is used.
|
||||
* `:libvirt__netmask` - Used only together with `:ip` option. Default is
|
||||
'255.255.255.0'.
|
||||
@ -610,7 +610,7 @@ starts with `libvirt__` string. Here is a list of those options:
|
||||
between Guests. Useful for Switch VMs like Cumulus Linux. No virtual switch
|
||||
setting like `libvirt__network_name` applies with tunnel interfaces and will
|
||||
be ignored if configured.
|
||||
* `:libvirt__tunnel_ip` - Sets the source IP of the libvirt tunnel interface.
|
||||
* `:libvirt__tunnel_ip` - Sets the source IP of the Libvirt tunnel interface.
|
||||
By default this is `127.0.0.1` for TCP and UDP tunnels and `239.255.1.1` for
|
||||
Multicast tunnels. It populates the address field in the `<source
|
||||
address="XXX">` of the interface xml configuration.
|
||||
@ -620,11 +620,11 @@ starts with `libvirt__` string. Here is a list of those options:
|
||||
* `:libvirt__tunnel_local_port` - Sets the local port used by the udp tunnel
|
||||
interface type. It populates the port field in the `<local port=XXX">`
|
||||
section of the interface xml configuration. _(This feature only works in
|
||||
libvirt 1.2.20 and higher)_
|
||||
Libvirt 1.2.20 and higher)_
|
||||
* `:libvirt__tunnel_local_ip` - Sets the local IP used by the udp tunnel
|
||||
interface type. It populates the ip entry of the `<local address=XXX">`
|
||||
section of the interface xml configuration. _(This feature only works in
|
||||
libvirt 1.2.20 and higher)_
|
||||
Libvirt 1.2.20 and higher)_
|
||||
* `:libvirt__guest_ipv6` - Enable or disable guest-to-guest IPv6 communication.
|
||||
See [here](https://libvirt.org/formatnetwork.html#examplesPrivate6), and
|
||||
[here](http://libvirt.org/git/?p=libvirt.git;a=commitdiff;h=705e67d40b09a905cd6a4b8b418d5cb94eaa95a8)
|
||||
@ -636,18 +636,18 @@ starts with `libvirt__` string. Here is a list of those options:
|
||||
failures](https://github.com/vagrant-libvirt/vagrant-libvirt/pull/498)
|
||||
* `:mac` - MAC address for the interface. *Note: specify this in lowercase
|
||||
since Vagrant network scripts assume it will be!*
|
||||
* `:libvirt__mtu` - MTU size for the libvirt network, if not defined, the
|
||||
created network will use the libvirt default (1500). VMs still need to set the
|
||||
* `:libvirt__mtu` - MTU size for the Libvirt network, if not defined, the
|
||||
created network will use the Libvirt default (1500). VMs still need to set the
|
||||
MTU accordingly.
|
||||
* `:model_type` - parameter specifies the model of the network adapter when you
|
||||
create a domain value by default virtio KVM believe possible values, see the
|
||||
documentation for libvirt
|
||||
documentation for Libvirt
|
||||
* `:libvirt__driver_name` - Define which network driver to use. [More
|
||||
info](https://libvirt.org/formatdomain.html#elementsDriverBackendOptions)
|
||||
* `:libvirt__driver_queues` - Define a number of queues to be used for network
|
||||
interface. Set equal to numer of vCPUs for best performance. [More
|
||||
info](http://www.linux-kvm.org/page/Multiqueue)
|
||||
* `:autostart` - Automatic startup of network by the libvirt daemon.
|
||||
* `:autostart` - Automatic startup of network by the Libvirt daemon.
|
||||
If not specified the default is 'false'.
|
||||
* `:bus` - The bus of the PCI device. Both :bus and :slot have to be defined.
|
||||
* `:slot` - The slot of the PCI device. Both :bus and :slot have to be defined.
|
||||
@ -668,8 +668,8 @@ virtual network.
|
||||
Default mode is 'bridge'.
|
||||
* `:type` - is type of interface.(`<interface type="#{@type}">`)
|
||||
* `:mac` - MAC address for the interface.
|
||||
* `:network_name` - Name of libvirt network to connect to.
|
||||
* `:portgroup` - Name of libvirt portgroup to connect to.
|
||||
* `:network_name` - Name of Libvirt network to connect to.
|
||||
* `:portgroup` - Name of Libvirt portgroup to connect to.
|
||||
* `:ovs` - Support to connect to an Open vSwitch bridge device. Default is
|
||||
'false'.
|
||||
* `:trust_guest_rx_filters` - Support trustGuestRxFilters attribute. Details
|
||||
@ -680,17 +680,17 @@ virtual network.
|
||||
|
||||
vagrant-libvirt uses a private network to perform some management operations on
|
||||
VMs. All VMs will have an interface connected to this network and an IP address
|
||||
dynamically assigned by libvirt unless you set `:mgmt_attach` to 'false'.
|
||||
dynamically assigned by Libvirt unless you set `:mgmt_attach` to 'false'.
|
||||
This is in addition to any networks you configure. The name and address
|
||||
used by this network are configurable at the provider level.
|
||||
|
||||
* `management_network_name` - Name of libvirt network to which all VMs will be
|
||||
* `management_network_name` - Name of Libvirt network to which all VMs will be
|
||||
connected. If not specified the default is 'vagrant-libvirt'.
|
||||
* `management_network_address` - Address of network to which all VMs will be
|
||||
connected. Must include the address and subnet mask. If not specified the
|
||||
default is '192.168.121.0/24'.
|
||||
* `management_network_mode` - Network mode for the libvirt management network.
|
||||
Specify one of veryisolated, none, nat or route options. Further documentated
|
||||
* `management_network_mode` - Network mode for the Libvirt management network.
|
||||
Specify one of veryisolated, none, nat or route options. Further documented
|
||||
under [Private Networks](#private-network-options)
|
||||
* `management_network_guest_ipv6` - Enable or disable guest-to-guest IPv6
|
||||
communication. See
|
||||
@ -892,8 +892,8 @@ Bus 001 Device 002: ID 1234:abcd Example device
|
||||
|
||||
Additionally, the following options can be used:
|
||||
|
||||
* `startupPolicy` - Is passed through to libvirt and controls if the device has
|
||||
to exist. libvirt currently allows the following values: "mandatory",
|
||||
* `startupPolicy` - Is passed through to Libvirt and controls if the device has
|
||||
to exist. Libvirt currently allows the following values: "mandatory",
|
||||
"requisite", "optional".
|
||||
|
||||
|
||||
@ -987,7 +987,7 @@ The optional action attribute describes what `action` to take when the watchdog
|
||||
```ruby
|
||||
Vagrant.configure("2") do |config|
|
||||
config.vm.provider :libvirt do |libvirt|
|
||||
# Add libvirt watchdog device model i6300esb
|
||||
# Add Libvirt watchdog device model i6300esb
|
||||
libvirt.watchdog :model => 'i6300esb', :action => 'reset'
|
||||
end
|
||||
end
|
||||
@ -1047,7 +1047,7 @@ running Microsoft Windows.
|
||||
You can specify HyperV features via `libvirt.hyperv_feature`. Available
|
||||
options are listed below. Note that both options are required:
|
||||
|
||||
* `name` - The name of the feature Hypervisor feature (see libvirt doc)
|
||||
* `name` - The name of the feature Hypervisor feature (see Libvirt doc)
|
||||
* `state` - The state for this feature which can be either `on` or `off`.
|
||||
|
||||
```ruby
|
||||
@ -1066,10 +1066,10 @@ end
|
||||
You can specify CPU feature policies via `libvirt.cpu_feature`. Available
|
||||
options are listed below. Note that both options are required:
|
||||
|
||||
* `name` - The name of the feature for the chosen CPU (see libvirts
|
||||
* `name` - The name of the feature for the chosen CPU (see Libvirt's
|
||||
`cpu_map.xml`)
|
||||
* `policy` - The policy for this feature (one of `force`, `require`,
|
||||
`optional`, `disable` and `forbid` - see libvirt documentation)
|
||||
`optional`, `disable` and `forbid` - see Libvirt documentation)
|
||||
|
||||
```ruby
|
||||
Vagrant.configure("2") do |config|
|
||||
@ -1224,8 +1224,8 @@ mounting them at boot.
|
||||
|
||||
Further documentation on using 9p can be found in [kernel docs](https://www.kernel.org/doc/Documentation/filesystems/9p.txt) and in [QEMU wiki](https://wiki.qemu.org/Documentation/9psetup#Starting_the_Guest_directly). Please do note that 9p depends on support in the guest and not all distros come with the 9p module by default.
|
||||
|
||||
**SECURITY NOTE:** for remote libvirt, nfs synced folders requires a bridged
|
||||
public network interface and you must connect to libvirt via ssh.
|
||||
**SECURITY NOTE:** for remote Libvirt, nfs synced folders requires a bridged
|
||||
public network interface and you must connect to Libvirt via ssh.
|
||||
|
||||
## QEMU Session Support
|
||||
|
||||
@ -1242,7 +1242,7 @@ Vagrant.configure("2") do |config|
|
||||
libvirt.uri = 'qemu:///session'
|
||||
# URI of QEMU system connection, use to obtain IP address for management
|
||||
libvirt.system_uri = 'qemu:///system'
|
||||
# Path to store libvirt images for the virtual machine, default is as ~/.local/share/libvirt/images
|
||||
# Path to store Libvirt images for the virtual machine, default is as ~/.local/share/libvirt/images
|
||||
libvirt.storage_pool_path = '/home/user/.local/share/libvirt/images'
|
||||
# Management network device
|
||||
libvirt.management_network_device = 'virbr0'
|
||||
@ -1305,7 +1305,7 @@ end
|
||||
|
||||
For certain functionality to be available within a guest, a private
|
||||
communication channel must be established with the host. Two notable examples
|
||||
of this are the qemu guest agent, and the Spice/QXL graphics type.
|
||||
of this are the QEMU guest agent, and the Spice/QXL graphics type.
|
||||
|
||||
Below is a simple example which exposes a virtio serial channel to the guest.
|
||||
Note: in a multi-VM environment, the channel would be created for all VMs.
|
||||
@ -1331,7 +1331,7 @@ end
|
||||
|
||||
These settings can be specified on a per-VM basis, however the per-guest
|
||||
settings will OVERRIDE any global 'config' setting. In the following example,
|
||||
we create 3 VM with the following configuration:
|
||||
we create 3 VMs with the following configuration:
|
||||
|
||||
* **master**: No channel settings specified, so we default to the provider
|
||||
setting of a single virtio guest agent channel.
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
Vagrant providers each require a custom provider-specific box format.
|
||||
This folder shows the example contents of a box for the `libvirt` provider.
|
||||
To turn this into a box create a vagrant image according documentation (don't
|
||||
To turn this into a box create a Vagrant image according documentation (don't
|
||||
forget to install rsync command) and create box with following command:
|
||||
|
||||
```
|
||||
|
8
example_box/Vagrantfile
vendored
8
example_box/Vagrantfile
vendored
@ -27,18 +27,18 @@ Vagrant.configure("2") do |config|
|
||||
#test_vm.vm.network :public_network, :ip => '10.20.30.41'
|
||||
#end
|
||||
|
||||
# Options for libvirt vagrant provider.
|
||||
# Options for Libvirt Vagrant provider.
|
||||
config.vm.provider :libvirt do |libvirt|
|
||||
|
||||
# A hypervisor name to access. Different drivers can be specified, but
|
||||
# this version of provider creates KVM machines only. Some examples of
|
||||
# drivers are kvm (qemu hardware accelerated), qemu (qemu emulated),
|
||||
# xen (Xen hypervisor), lxc (Linux Containers),
|
||||
# drivers are KVM (QEMU hardware accelerated), QEMU (QEMU emulated),
|
||||
# Xen (Xen hypervisor), lxc (Linux Containers),
|
||||
# esx (VMware ESX), vmwarews (VMware Workstation) and more. Refer to
|
||||
# documentation for available drivers (http://libvirt.org/drivers.html).
|
||||
libvirt.driver = "kvm"
|
||||
|
||||
# The name of the server, where libvirtd is running.
|
||||
# The name of the server, where Libvirtd is running.
|
||||
# libvirt.host = "localhost"
|
||||
|
||||
# If use ssh tunnel to connect to Libvirt.
|
||||
|
@ -8,7 +8,7 @@ module VagrantPlugins
|
||||
include Vagrant::Action::Builtin
|
||||
@logger = Log4r::Logger.new('vagrant_libvirt::action')
|
||||
|
||||
# remove image from libvirt storage pool
|
||||
# remove image from Libvirt storage pool
|
||||
def self.remove_libvirt_image
|
||||
Vagrant::Action::Builder.new.tap do |b|
|
||||
b.use RemoveLibvirtImage
|
||||
|
@ -323,7 +323,7 @@ module VagrantPlugins
|
||||
|
||||
env[:ui].info(" -- Command line : #{@cmd_line}") unless @cmd_line.empty?
|
||||
|
||||
# Create libvirt domain.
|
||||
# Create Libvirt domain.
|
||||
# Is there a way to tell fog to create new domain with already
|
||||
# existing volume? Use domain creation from template..
|
||||
begin
|
||||
|
@ -283,7 +283,7 @@ module VagrantPlugins
|
||||
return options[:network_name]
|
||||
end
|
||||
|
||||
# Get list of all (active and inactive) libvirt networks.
|
||||
# Get list of all (active and inactive) Libvirt networks.
|
||||
available_networks = libvirt_networks(libvirt_client)
|
||||
|
||||
return 'public' if options[:iface_type] == :public_network
|
||||
|
@ -47,9 +47,9 @@ module VagrantPlugins
|
||||
# should fix other methods so this doesn't have to be instance var
|
||||
@options = options
|
||||
|
||||
# Get a list of all (active and inactive) libvirt networks. This
|
||||
# Get a list of all (active and inactive) Libvirt networks. This
|
||||
# list is used throughout this class and should be easier to
|
||||
# process than libvirt API calls.
|
||||
# process than Libvirt API calls.
|
||||
@available_networks = libvirt_networks(
|
||||
env[:machine].provider.driver.connection.client
|
||||
)
|
||||
|
@ -14,7 +14,7 @@ module VagrantPlugins
|
||||
env[:ui].info(I18n.t('vagrant_libvirt.destroy_domain'))
|
||||
|
||||
# Must delete any snapshots before domain can be destroyed
|
||||
# Fog libvirt currently doesn't support snapshots. Use
|
||||
# Fog Libvirt currently doesn't support snapshots. Use
|
||||
# ruby-libvirt client directly. Note this is racy, see
|
||||
# http://www.libvirt.org/html/libvirt-libvirt.html#virDomainSnapshotListNames
|
||||
libvirt_domain = env[:machine].provider.driver.connection.client.lookup_domain_by_uuid(
|
||||
|
@ -19,7 +19,7 @@ module VagrantPlugins
|
||||
begin
|
||||
env[:machine].guest.capability(:halt)
|
||||
rescue
|
||||
@logger.info('Trying libvirt graceful shutdown.')
|
||||
@logger.info('Trying Libvirt graceful shutdown.')
|
||||
domain.shutdown
|
||||
end
|
||||
|
||||
|
@ -161,7 +161,7 @@ module VagrantPlugins
|
||||
|
||||
protected
|
||||
|
||||
# Fog libvirt currently doesn't support uploading images to storage
|
||||
# Fog Libvirt currently doesn't support uploading images to storage
|
||||
# pool volumes. Use ruby-libvirt client instead.
|
||||
def upload_image(image_file, pool_name, volume_name, env)
|
||||
image_size = File.size(image_file) # B
|
||||
|
@ -36,7 +36,7 @@ module VagrantPlugins
|
||||
|
||||
@logger.info("Creating storage pool 'default'")
|
||||
|
||||
# Fog libvirt currently doesn't support creating pools. Use
|
||||
# Fog Libvirt currently doesn't support creating pools. Use
|
||||
# ruby-libvirt client directly.
|
||||
begin
|
||||
@storage_pool_path = storage_pool_path(env)
|
||||
|
@ -3,7 +3,7 @@ require 'log4r'
|
||||
module VagrantPlugins
|
||||
module ProviderLibvirt
|
||||
module Action
|
||||
# Action for create new box for libvirt provider
|
||||
# Action for create new box for Libvirt provider
|
||||
class PackageDomain
|
||||
def initialize(app, env)
|
||||
@logger = Log4r::Logger.new('vagrant_libvirt::action::package_domain')
|
||||
|
@ -10,8 +10,8 @@ module VagrantPlugins
|
||||
end
|
||||
|
||||
def call(env)
|
||||
env[:ui].info('Vagrant-libvirt plugin removed box only from you LOCAL ~/.vagrant/boxes directory')
|
||||
env[:ui].info('From libvirt storage pool you have to delete image manually(virsh, virt-manager or by any other tool)')
|
||||
env[:ui].info('Vagrant-libvirt plugin removed box only from your LOCAL ~/.vagrant/boxes directory')
|
||||
env[:ui].info('From Libvirt storage pool you have to delete image manually(virsh, virt-manager or by any other tool)')
|
||||
@app.call(env)
|
||||
end
|
||||
end
|
||||
|
@ -33,7 +33,7 @@ module VagrantPlugins
|
||||
if @boot_order.count >= 1
|
||||
|
||||
# If a domain is initially defined with no box or disk or
|
||||
# with an explicit boot order, libvirt adds <boot dev="foo">
|
||||
# with an explicit boot order, Libvirt adds <boot dev="foo">
|
||||
# This conflicts with an explicit boot_order configuration,
|
||||
# so we need to remove it from the domain xml and feed it back.
|
||||
# Also see https://bugzilla.redhat.com/show_bug.cgi?id=1248514
|
||||
@ -66,7 +66,7 @@ module VagrantPlugins
|
||||
logger_msg(node, index)
|
||||
end
|
||||
|
||||
# Finally redefine the domain XML through libvirt
|
||||
# Finally redefine the domain XML through Libvirt
|
||||
# to apply the boot ordering
|
||||
env[:machine].provider
|
||||
.driver
|
||||
|
@ -41,7 +41,7 @@ module VagrantPlugins
|
||||
# parsable and sortable by epoch time
|
||||
# @example
|
||||
# development-centos-6-chef-11_1404488971_3b7a569e2fd7c554b852
|
||||
# @return [String] libvirt domain name
|
||||
# @return [String] Libvirt domain name
|
||||
def build_domain_name(env)
|
||||
config = env[:machine].provider_config
|
||||
domain_name =
|
||||
|
@ -23,7 +23,7 @@ module VagrantPlugins
|
||||
|
||||
libvirt_domain = env[:machine].provider.driver.connection.client.lookup_domain_by_uuid(env[:machine].id)
|
||||
|
||||
# libvirt API doesn't support modifying memory on NUMA enabled CPUs
|
||||
# Libvirt API doesn't support modifying memory on NUMA enabled CPUs
|
||||
# http://libvirt.org/git/?p=libvirt.git;a=commit;h=d174394105cf00ed266bf729ddf461c21637c736
|
||||
if config.numa_nodes == nil
|
||||
if config.memory.to_i * 1024 != libvirt_domain.max_memory
|
||||
|
@ -28,7 +28,7 @@ module VagrantPlugins
|
||||
end
|
||||
|
||||
# Wait for domain to obtain an ip address. Ip address is searched
|
||||
# from arp table, either localy or remotely via ssh, if libvirt
|
||||
# from arp table, either locally or remotely via ssh, if Libvirt
|
||||
# connection was done via ssh.
|
||||
env[:ip_address] = nil
|
||||
@logger.debug("Searching for IP for MAC address: #{domain.mac}")
|
||||
|
@ -20,7 +20,7 @@ module VagrantPlugins
|
||||
end
|
||||
|
||||
def usable?(machine, _raise_error = false)
|
||||
# bail now if not using libvirt since checking version would throw error
|
||||
# bail now if not using Libvirt since checking version would throw error
|
||||
return false unless machine.provider_name == :libvirt
|
||||
|
||||
# <filesystem/> support in device attach/detach introduced in 1.2.2
|
||||
@ -30,7 +30,7 @@ module VagrantPlugins
|
||||
end
|
||||
|
||||
def prepare(machine, folders, _opts)
|
||||
raise Vagrant::Errors::Error('No libvirt connection') if machine.provider.driver.connection.nil?
|
||||
raise Vagrant::Errors::Error('No Libvirt connection') if machine.provider.driver.connection.nil?
|
||||
@conn = machine.provider.driver.connection.client
|
||||
|
||||
begin
|
||||
@ -89,7 +89,7 @@ module VagrantPlugins
|
||||
|
||||
def cleanup(machine, _opts)
|
||||
if machine.provider.driver.connection.nil?
|
||||
raise Vagrant::Errors::Error('No libvirt connection')
|
||||
raise Vagrant::Errors::Error('No Libvirt connection')
|
||||
end
|
||||
@conn = machine.provider.driver.connection.client
|
||||
begin
|
||||
|
@ -20,12 +20,12 @@ module VagrantPlugins
|
||||
# A hypervisor name to access via Libvirt.
|
||||
attr_accessor :driver
|
||||
|
||||
# The name of the server, where libvirtd is running.
|
||||
# The name of the server, where Libvirtd is running.
|
||||
attr_accessor :host
|
||||
|
||||
# If use ssh tunnel to connect to Libvirt.
|
||||
attr_accessor :connect_via_ssh
|
||||
# Path towards the libvirt socket
|
||||
# Path towards the Libvirt socket
|
||||
attr_accessor :socket
|
||||
|
||||
# The username to access Libvirt.
|
||||
@ -161,7 +161,7 @@ module VagrantPlugins
|
||||
# Additional qemuargs arguments
|
||||
attr_accessor :qemu_args
|
||||
|
||||
# Use qemu session instead of system
|
||||
# Use QEMU session instead of system
|
||||
attr_accessor :qemu_use_session
|
||||
|
||||
def initialize
|
||||
@ -309,7 +309,7 @@ module VagrantPlugins
|
||||
end
|
||||
end
|
||||
|
||||
# is it better to raise our own error, or let libvirt cause the exception?
|
||||
# is it better to raise our own error, or let Libvirt cause the exception?
|
||||
raise 'Only four cdroms may be attached at a time'
|
||||
end
|
||||
|
||||
@ -586,7 +586,7 @@ module VagrantPlugins
|
||||
|
||||
# code to generate URI from a config moved out of the connect action
|
||||
def _generate_uri
|
||||
# builds the libvirt connection URI from the given driver config
|
||||
# builds the Libvirt connection URI from the given driver config
|
||||
# Setup connection uri.
|
||||
uri = @driver.dup
|
||||
virt_path = case uri
|
||||
@ -602,7 +602,7 @@ module VagrantPlugins
|
||||
raise "Require specify driver #{uri}"
|
||||
end
|
||||
if uri == 'kvm'
|
||||
uri = 'qemu' # use qemu uri for kvm domain type
|
||||
uri = 'qemu' # use QEMU uri for KVM domain type
|
||||
end
|
||||
|
||||
if @connect_via_ssh
|
||||
@ -623,13 +623,13 @@ module VagrantPlugins
|
||||
uri << '?no_verify=1'
|
||||
|
||||
if @id_ssh_key_file
|
||||
# set ssh key for access to libvirt host
|
||||
# set ssh key for access to Libvirt host
|
||||
uri << "\&keyfile="
|
||||
# if no slash, prepend $HOME/.ssh/
|
||||
@id_ssh_key_file.prepend("#{`echo ${HOME}`.chomp}/.ssh/") if @id_ssh_key_file !~ /\A\//
|
||||
uri << @id_ssh_key_file
|
||||
end
|
||||
# set path to libvirt socket
|
||||
# set path to Libvirt socket
|
||||
uri << "\&socket=" + @socket if @socket
|
||||
uri
|
||||
end
|
||||
|
@ -19,11 +19,11 @@ module VagrantPlugins
|
||||
end
|
||||
|
||||
def connection
|
||||
# If already connected to libvirt, just use it and don't connect
|
||||
# If already connected to Libvirt, just use it and don't connect
|
||||
# again.
|
||||
return @@connection if @@connection
|
||||
|
||||
# Get config options for libvirt provider.
|
||||
# Get config options for Libvirt provider.
|
||||
config = @machine.provider_config
|
||||
uri = config.uri
|
||||
|
||||
@ -50,7 +50,7 @@ module VagrantPlugins
|
||||
end
|
||||
|
||||
def system_connection
|
||||
# If already connected to libvirt, just use it and don't connect
|
||||
# If already connected to Libvirt, just use it and don't connect
|
||||
# again.
|
||||
return @@system_connection if @@system_connection
|
||||
|
||||
|
@ -54,7 +54,7 @@ module VagrantPlugins
|
||||
error_key(:wrong_box_format)
|
||||
end
|
||||
|
||||
# Fog libvirt exceptions
|
||||
# Fog Libvirt exceptions
|
||||
class FogError < VagrantLibvirtError
|
||||
error_key(:fog_error)
|
||||
end
|
||||
|
@ -4,7 +4,7 @@ rescue LoadError
|
||||
raise 'The Vagrant Libvirt plugin must be run within Vagrant.'
|
||||
end
|
||||
|
||||
# compatibility fix to define constant not available vagrant <1.6
|
||||
# compatibility fix to define constant not available Vagrant <1.6
|
||||
::Vagrant::MachineState::NOT_CREATED_ID ||= :not_created
|
||||
|
||||
module VagrantPlugins
|
||||
@ -12,7 +12,7 @@ module VagrantPlugins
|
||||
class Plugin < Vagrant.plugin('2')
|
||||
name 'libvirt'
|
||||
description <<-DESC
|
||||
Vagrant plugin to manage VMs in libvirt.
|
||||
Vagrant plugin to manage VMs in Libvirt.
|
||||
DESC
|
||||
|
||||
config('libvirt', :provider) do
|
||||
|
@ -117,7 +117,7 @@
|
||||
<% if d[:serial] %>
|
||||
<serial><%= d[:serial] %></serial>
|
||||
<% end %>
|
||||
<%# this will get auto generated by libvirt
|
||||
<%# this will get auto generated by Libvirt
|
||||
<address type='pci' domain='0x0000' bus='0x00' slot='???' function='0x0'/>
|
||||
-%>
|
||||
</disk>
|
||||
|
@ -109,7 +109,7 @@ module VagrantPlugins
|
||||
networks
|
||||
end
|
||||
|
||||
# Return a list of all (active and inactive) libvirt networks as a list
|
||||
# Return a list of all (active and inactive) Libvirt networks as a list
|
||||
# of hashes with their name, network address and status (active or not)
|
||||
def libvirt_networks(libvirt_client)
|
||||
libvirt_networks = []
|
||||
|
@ -16,7 +16,7 @@ en:
|
||||
Created volume larger than box defaults, will require manual resizing of
|
||||
filesystems to utilize.
|
||||
uploading_volume: |-
|
||||
Uploading base box image as volume into libvirt storage...
|
||||
Uploading base box image as volume into Libvirt storage...
|
||||
creating_domain_volume: |-
|
||||
Creating image (snapshot of base box volume).
|
||||
removing_domain_volume: |-
|
||||
@ -60,7 +60,7 @@ en:
|
||||
Forwarding UDP ports is not supported. Ignoring.
|
||||
|
||||
errors:
|
||||
package_not_supported: No support for package with libvirt. Create box manually.
|
||||
package_not_supported: No support for package with Libvirt. Create box manually.
|
||||
fog_error: |-
|
||||
There was an error talking to Libvirt. The error message is shown
|
||||
below:
|
||||
@ -97,7 +97,7 @@ en:
|
||||
wrong_box_format: |-
|
||||
Wrong image format specified for box.
|
||||
fog_libvirt_connection_error: |-
|
||||
Error while connecting to libvirt: %{error_message}
|
||||
Error while connecting to Libvirt: %{error_message}
|
||||
fog_create_volume_error: |-
|
||||
Error while creating a storage pool volume: %{error_message}
|
||||
fog_create_domain_volume_error: |-
|
||||
@ -108,9 +108,9 @@ en:
|
||||
Name `%{domain_name}` of domain about to create is already taken. Please try to run
|
||||
`vagrant up` command again.
|
||||
creating_storage_pool_error: |-
|
||||
There was error while creating libvirt storage pool: %{error_message}
|
||||
There was error while creating Libvirt storage pool: %{error_message}
|
||||
creating_volume_error: |-
|
||||
There was error while creating libvirt volume: %{error_message}
|
||||
There was error while creating Libvirt volume: %{error_message}
|
||||
image_upload_error: |-
|
||||
Error while uploading image to storage pool: %{error_message}
|
||||
no_domain_error: |-
|
||||
|
@ -1,6 +1,6 @@
|
||||
#!/bin/bash +x
|
||||
|
||||
# This script should help to prepare RedHat and RedHat like OS (CentOS,
|
||||
# This script should help to prepare Red Hat and Red Hat-like OS (CentOS,
|
||||
# Scientific Linux, ...) for Vagrant box usage.
|
||||
|
||||
# To create new box image, just install minimal base system in VM on top of not
|
||||
@ -18,13 +18,13 @@ if [ $# -ne 1 ]; then
|
||||
fi
|
||||
|
||||
|
||||
# On which version of RedHet are we running?
|
||||
# On which version of Red Hat are we running?
|
||||
RHEL_MAJOR_VERSION=$(sed 's/.*release \([0-9]\)\..*/\1/' /etc/redhat-release)
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Is this a RedHat distro?"
|
||||
echo "Is this a Red Hat distro?"
|
||||
exit 1
|
||||
fi
|
||||
echo "* Found RedHat ${RHEL_MAJOR_VERSION} version."
|
||||
echo "* Found Red Hat ${RHEL_MAJOR_VERSION} version."
|
||||
|
||||
|
||||
# Setup hostname vagrant-something.
|
||||
|
Loading…
Reference in New Issue
Block a user