Commit Graph

760 Commits

Author SHA1 Message Date
Graham Hayes
4dd13bf219 Really Limit p9 tag to 31 bytes
Libvirt p9 file system passthrough requires the tag be less than
31 bytes. Using the mount point as the tag can easily exceed this.

In KVM passthough the "target" attribuite in the XML is acutally the
mount tag.

Fixed the mounting script to use the same MD5 to mount the right
filesystem

Fixes #323
2015-07-21 15:45:43 +01:00
Joe Julian
fc24db479f Make lookup_network_by_name the default for veryisolated networks 2015-07-20 13:01:34 -07:00
Joe Julian
9b7c9def3c Removed comment
Vagrant only requires an ip **if** `type` is set **and** is not `dhcp`. The
only other type, currently, is `nfs`. Obviously nfs requires an IP so under
that circumstance or if `type` is set to anything but dhcp, vagrant will
error if an ip is not assigned.

If `type` is `nil`, it is deleted from the hash.
2015-07-17 17:23:32 -07:00
Joe Julian
546c98c0a2 Allow veryisolated networks without IP
* Moved network lookup by IP to `lookup_network_by_ip`
* Lookup by name only if lookup by ip fails *and* forward_mode is
  `veryisolated`. This will preserve existing functionality.
* Added network creation ability to `handle_network_name_option`
** Network **must** be veryisolated to be created by name
** Network **must not** have an ip address to be used in the
   `handle_network_name_option` path.

Minor changes:
* corrected inverted autostart logic
* screen formatting

Fixes #402
2015-07-17 17:23:19 -07:00
Joe Julian
6d8c45542e Select the network by name 2015-07-17 15:31:17 -07:00
Joe Julian
6083b613d9 Merge remote-tracking branch 'upstream/master' into allow_veryisolated_networks 2015-07-17 15:21:42 -07:00
Darragh Bailey
eeb4712c72 Allow read actions to be called by other machines
Disable action locks on read actions so that Vagrant may return ssh
configuration information while other actions are being run on the
machine.

Vagrant locks each machine when an action is being performed on it, to
ensure that it cannot be modified by multiple actions at the same time.
However certain read operations such as retrieving the ssh infomation
may be called either by other machines when executing in parallel or if
the user executes 'vagrant ssh <machine>', during a provision step. When
this occurs Vagrant will throw an error telling the user that multiple
actions may not be executed in parallel and they must wait until the
existing action is finished or see if vagrant/ruby must be terminated.

Example issue is that the ansible provisioner builds an inventory file
where for each machine executing it will query the ssh_info of all other
active machines. When run serially, this will work as expected, however
in parallel it will only succeed if all the actions associated with
ssh_info are complete before any machine begins executing ansible
itself.

Fixes #420
2015-07-14 17:17:50 +01:00
Joe Julian
81688f0fd9 Allow veryisolated networks
With veryisolated networks, there is no ip address assigned thus
matching the network name and ip address fails. This allows the null ip
address to match a named network when that forward_mode is set.
2015-07-13 15:52:26 -07:00
Graham Hayes
8d06588e8f Limit p9 tag to 31 bytes
Libvirt p9 file system passthrough requires the tag be less than
31 bytes. Using the mount point as the tag can easily exceed this.

Fixes #323
2015-07-13 14:29:14 +01:00
stanley karunditu
389c2d444d set nic adapter limit as a provider variable. default remains 8 like
it was hard coded before. only use case for changing this is if using
virtualized switch VMs that have support for many interfaces.
2015-07-13 06:37:51 -04:00
stanley karunditu
789fa369c8 add libvirt interface tcp tunnel support.
Useful when configuring Virtualized Switch topologies using Switch VMs like Cumulus
Linux.

vagrant network interface auto_config is disabled in the code. This may be
re-enabled in a future update, once it is better understood how to
auto configure these types of links. All guestOS ports, for now, that are
connected to a tcp tunnel are in a link down state.

TCP tunnels allow guest OSes to exchange STP and LLDP information as
if they are directly connected to each other.

This is not possible with the default virtual switch network mode.

Reference:
https://libvirt.org/formatdomain.html#elementsNICSTCP
2015-07-11 10:49:00 -04:00
Dmitry Vasilets
ab34b7d29b Merge pull request #408 from dcbw/dcbw/pass-mac-to-vagrant
Read MAC address from libvirt and pass up to Vagrant
2015-07-01 00:38:22 +02:00
Dan Williams
ee7afab369 Read MAC address from libvirt and pass up to Vagrant
Configuring networks based solely on slot numbers doesn't work very
well, since there's no way to guarantee that the interface Vagrant
finds is the same one that vagrant-libvirt created at that index.

For example, Vagrant's Fedora configure_networks action does this:

  machine.communicate.sudo("ls /sys/class/net | grep -v lo") do |_, result|
    interface_names = result.split("\n")
  end

  interface_names = networks.map do |network|
    "#{interface_names[network[:interface]]}"
  end

which means that if your image has 'docker' pre-installed, then
interface_names[0] = "docker0" and hilarity ensues, with the first
non-management network being assigned to the vagrant-libvirt
management interface.

Since interface names are very unreliable (they can be renamed by
udev at will or when hardware changes) the only way to ensure that
the interface vagrant-libvirt attaches to the domain maps to the
correct one inside the VM is by MAC address.  Pull the MAC address
out of the libvirt config once the interface has been attached and
pass that up to Vagrant so we have a chance of doing the right thing.
2015-06-30 16:24:30 -05:00
Darragh Bailey
d4c72212eb Support volume size resize configuration
Allow control of the volume size to be increased from the box default
virtual_size value so that it is possible to use a box configured with a
minimal initial disk size and create virtual guests with larger disk
sizes.

Warn the user and ignore sizes that are less than the box size, and
inform them that a manual filesystem resize will be needed to take
advantage of the additional available disk space.

fixes: #37
2015-06-28 15:50:44 +01:00
Alex Blackie
07c6fff1ac Do not remove .ssh on package
`virt-sysprep` will, by default, remove all `.ssh` directories from all
users' home directories. Since we need to have the default Vagrant
insecure keypair in the `authorized_keys`, this causes problems later
when trying to use the packaged box, as Vagrant is unable to log in.

`virt-sysprep` has the ability to disable options via the `--operations`
argument; the `ssh-userdir` option should be disabled.
2015-06-18 10:44:40 -07:00
Dmitry Vasilets
9b5801be50 simplify 2015-06-09 22:29:11 +02:00
Darragh Bailey
bc517934c2 Use storage pool to identify correct volume
Compare storage pool on the found volumes to avoid selecting a disk from
a different and unreachable to the domain storage pool.

Users may move between storage pools by configuring the driver which
will mean that it is possible to find the same image name in multiple
storage pools and incorrectly perform operations based on the one not
associated with the currently specified pool.

When using persistent images to attach to storage this will cause domain
creation to fail since although the image was found in one of the
storage pools, it may not be connected since it does not exist in the
storage pool requested for the VM.
2015-06-09 18:24:10 +01:00
Darragh Bailey
ac7563e6c3 Fixes #387: Break from mutex synchronize before calling next action
Exit the synchronize block before performing calling the next item in
the middleware chain otherwise the mutex lock applies to the entire
provision sequence from that point onwards until the entire chain has
returned to the same point.

Executing a return statement inside a block does not exit the block
automatically. Instead only when the statement returned has been
processed is the wrapping block exited.

Since the return call is actually calling the next action in the chain,
this change ensures that the mutex is not held for subsequent actions
and thus allows vagrant to perform remaining actions in parallel.

Without this all provisioning of machines will always occur serially
instead of parallel when requested.
2015-06-08 16:10:34 +01:00
dima
d12405ed82 0.0.30 2015-06-04 22:46:55 +02:00
Dmitry Vasilets
33850c2567 Merge pull request #383 from dc-bradwadsworth/add_boot_order
Add boot order
2015-06-03 08:18:25 +02:00
Brad Wadsworth
56818642e5 fixed indent and added example 2015-06-02 20:31:21 -05:00
Brad Wadsworth
0b2ebc102b edited domain.xml.erb 2015-06-01 10:26:31 -05:00
Brad Wadsworth
23d0a5b012 changes to boot order option 2015-06-01 10:19:06 -05:00
coding
ba9050984e Make NFS correctly detect host/guest addresses.
The logic is that we first gather all usable guest addresses, then
use routing information (through a udp socket) to figure out host
IP for use to connect to guest.
2015-06-01 11:55:27 +08:00
Brad Wadsworth
6c0d15288e added boot_order option 2015-05-29 16:32:20 -05:00
Ivan Nečas
ba619e04bb Don't raise an error when ip address is not found when calling ssh_info
Vagrant defines that, when the ssh info is not available, the method
should return nil, instead of raising exception:
https://github.com/mitchellh/vagrant/blob/v1.7.2/lib/vagrant/plugin/v2/provider.rb#L52-L75

Also, as per
efd1d5e11b/plugins/providers/virtualbox/provider.rb (L60) , not getting into waiting for the ssh info
when the machine is not running.

The motivation for this patch is the ansible integration issues when raising
the errors and waiting for the ssh info. See also:
https://github.com/mitchellh/vagrant/pull/5743
2015-05-27 12:57:08 +02:00
Romuald du Song
2e01a54fc3 add step to remove stale volume on destroy action 2015-05-23 21:49:51 +02:00
dima
b6babcdade 0.0.29 2015-05-22 06:44:40 +02:00
Christian Kampka
298a45d3d8 Add ability to specify the machine architecture via the domain arguments 2015-05-18 07:30:48 +02:00
dima
4de1560027 improve package process 2015-05-17 19:47:07 +02:00
dima
9ad2389a92 remove temp dir after package creation 2015-05-17 16:39:05 +02:00
Shuanglei Tao
6ffad6104f Replace ifconfig with ip addr 2015-05-17 19:59:17 +08:00
Shuanglei Tao
0deb63911b Mounting nfs remotely through bridged public network, fixes #366 2015-05-17 19:10:38 +08:00
Shuanglei Tao
91c768158a Ensure VM booted and network configured before creating synced folders 2015-05-17 19:02:41 +08:00
Shuanglei Tao
0a23a986b3 Set private key for proxy_command 2015-05-17 18:37:13 +08:00
dima
08037d1941 port tools/create_box.sh to package action. close #11 2015-05-16 17:35:00 +02:00
dima
9fcd9f5873 clean file 2015-05-16 12:05:01 +02:00
Dmitry Vasilets
063ebfc08d Merge pull request #368 from relenda/hotfix-9p-target-template
Fixed wrong target spec in 9p-fs template
2015-05-16 11:00:29 +02:00
Yucong Sun
834c6b74a9 Remove extra StartDomain/WaitTillUp
Possibly a merge error introduced by 

8d4f16a3f8
2015-05-16 16:41:10 +08:00
Patrick Truebe
a2ec37159c Fixed wrong target spec in 9p-fs template 2015-05-15 15:29:20 +02:00
dima
c551196411 fix for custom path 2015-05-14 10:06:55 +02:00
dima
182809e721 improve storage remove process. close #364 2015-05-13 08:16:03 +02:00
dima
4a959d5dcf 0.0.28 2015-05-11 19:12:07 +02:00
dima
c1da985934 fix deps 2015-05-11 19:11:28 +02:00
dima
88d9d9025d 0.0.27 2015-05-10 22:17:44 +02:00
dima
c80062dc38 typo 2015-05-10 19:35:20 +02:00
Dmitry Vasilets
4cd1236e9a simplify 2015-05-07 12:38:32 +02:00
Felix Kaiser
ae37f17de8 Add :libvirt_host_ip and :libvirt_dhcp_start/stop
This allows networks with gateways on addresses other
than .1 (.254 is a popular choice).

Resolves #357.
2015-05-06 21:03:12 +02:00
Nobuaki Sukegawa
c5a6fd08f0 Fix trivial bug where graphics_passwd could not be used with spice 2015-05-07 00:52:32 +09:00
Dmitry Vasilets
d107b899c8 Merge pull request #356 from dcbw/dcbw/fix-vm-ip-multiple-leases
Fix retrieving VM IP address if there are multiple leases for the same VM
2015-05-02 08:57:23 +02:00