Commit Graph

27 Commits

Author SHA1 Message Date
nico.vanelslande 163e1997a6 Make virtualbox vm_exists? more resilient to VirtualBox transient failures.
We know that the vm does not exist if we get VBOX_E_OBJECT_NOT_FOUND.
For any other error, this may well be VirtualBox getting confused and it is probably
worth retrying...
2016-05-31 13:23:56 +01:00
Seth Vargo d565c2f07e Check both stderr and stdout
Different vbox versions print this to different streams, so check both
just to be sure
2016-03-17 10:52:10 -04:00
Evgeniy N 890820eaf6 Add snapshot commands
Fixed error remains in other versions:
  return [] if e.extra_data[:stdout].include?("does not have")
should be
  return [] if e.extra_data[:stderr].include?("does not have")

Many methods are the same in different version_X, and should be moved to Base class.
2016-02-18 11:47:07 +06:00
Mitchell Hashimoto 05fbb4ced2 providers/virtualbox: more support 2015-10-01 08:50:47 -04:00
Paul Hinze 88ab9f7402 providers/virtualbox: read netmask from dhcpservers
This should fix the cleaning up of the default VirtualBox dhcpserver,
which we've been fighting with for ages over in #3083. We were checking
for a structure _including_ a netmask, but the driver was not populating
netmask.
2015-01-21 10:51:39 -08:00
Seth Vargo d2874064f4 Use .key? instead of .has_key? 2015-01-05 18:29:01 -05:00
William Kolean 084d2c06de enable symlinks before adding shared folder 2015-01-01 16:00:17 -05:00
Paul Hinze 25ff636ee2 providers/virtualbox: cleanup default vbox dhcp server
fixes #3083

Detect the presence of the default DHCP server that comes in a fresh
VirtualBox install and clean it up to prevent it from colliding with
Vagrant-managed network config.

In order to accomplish this, we:

 - add a `remove_dhcp_server` call to the virtualbox driver
 - fix dhcp options parsing to allow `:dhcp_{ip,lower,upper}`
   configuration options to make it through (so a user can override the
   removal behavior with some explicit configuration)
 - add the full `:network_name` to the details returned from
   `:read_dhcp_servers`, so we can have a durable value to pass to
   `:remove_dhcp_server`

Note that we do have to eat one more `VBoxManage list dhcpservers` for
each network interface to support this, but this seemed like a nominal
cost
2014-11-30 22:03:52 -06:00
Paul Hinze 24b6f21d1d providers/virtualbox: extract reading dhcpservers from hostonlyifs
This is just a refactor, no behavior change.

Instead of stitching together dhcpserver info in the structure returned
from `read_host_only_interfaces`, sprout a new driver method called
`read_dhcp_servers` to return that information separately.

This means that driver clients (well there's really only _one_ client in
`ProviderVirtualBox::Action::Network`) have to do a bit more work to get
interface and DHCP server information.

But this gives us (a) a cleaner and more consistent driver interface and
(b) groundwork for a fix for #3083, which will require interacting with
DHCP servers outside of the context of host-only interfaces.
2014-11-30 22:03:52 -06:00
Jeff Ramnani bd5fd7ab18 Fix #4658. Bad NFS exports file on OS X & BSD hosts.
For FreeBSD guests, Virtualbox can sometimes report the private network
interface IP address as "0.0.0.0".  This will cause an invalid NFS
exports file to be generated for FreeBSD and OS X hosts.

Fixed by not allowing Virtualbox to report a guest IP address of
"0.0.0.0".
2014-10-20 12:35:30 -05:00
Kalman Hazins bb052366f7 Change symbols inside hashes to 1.9 JSON-like syntax 2014-05-22 12:35:12 -04:00
Adam Spiers 082bf37df8 backport GH-3277 fix for missing interpolation to older drivers
The original fix for the "missing interpolation argument :stderr" bug
was in d4b3f226, but it only addressed the driver for VirtualBox 4.3:

  https://github.com/mitchellh/vagrant/issues/3277

This backports the fix to the drivers for VirtualBox 4.0, 4.1, and 4.2.
2014-04-30 16:06:20 +01:00
Mitchell Hashimoto b08c1a62ce Removing some old files 2014-04-29 16:48:12 -07:00
Mitchell Hashimoto afb61b1466 providers/virtualbox: synced folder supports the "disable" method 2014-04-21 13:55:12 -07:00
Freddie Rosario ccf14bb398 Applying bugfix for cableconnected issue to earlier releases of virtualbox 4.x series 2014-01-28 11:05:44 -05:00
Paul Hinze c25172d0f7 providers/virtualbox: support DHCP interfaces for NFS
Previously, we required a host-only interface with a static IP for NFS
to work in VirtualBox, because we needed access to the guest's IP in
order to properly configure mount commands.

After boot, VirtualBox exposes the IP addresses of a guest's network
adapters via the "guestproperty" interface.

This adds support for reading VirtualBox guest properties to the
VirtualBox driver and utilizes that support to prepare NFS settings,
which removes the necessity for a static IP for NFS to work.

In this commit we also start building out scaffolding for unit testing
vbox actions and drivers.

Test plan:
 - Prepare a Vagrantfile with the following:
   * private network with type: :dhcp
   * synced folder with nfs: true
 - Boot a VM from this Vagrantfile using the virtualbox provider
 - Machine should boot successfully with working synced folder
2013-12-03 10:21:28 -05:00
Mitchell Hashimoto 2d957cdaab providers/virtualbox: internal networks [GH-2020] 2013-11-25 11:13:46 -08:00
Mitchell Hashimoto 56eb53d8af Merge pull request #2483 from andyfowler/retryable-customize
providers/virtualbox: use Retryable for Virtualbox customize & sane_defaults actions
2013-11-23 16:12:20 -08:00
Mitchell Hashimoto c00b045f53 providers/virtualbox: retry suspended check [GH-2479] 2013-11-23 11:20:22 -08:00
Andy Fowler b13122cab7 use Retryable for virtualbox customize + defaults
when up-ing several boxes at once, VBoxManage modifyvm gets cranky and throws random lock errors. this adds the existing retryable logic to
the customize and sane_defaults actions, both of which fire a bunch of
modifyvm commands, all of which are fine to run multiple times.
2013-11-09 18:16:47 -05:00
Stephan Meissl 889233ed94 Automatically enable symlinks on vboxsf for VirtualBox 4.1 (see #713 and 387692f9c8). 2013-10-23 23:00:07 +02:00
Mitchell Hashimoto fd644c5105 Forward ports can specify host/guest IP to bind to [GH-1121] 2013-07-10 20:30:15 -07:00
Mitchell Hashimoto 373a1d8633 Properly expand cygwin paths to Windows path for vboxmanage 2013-04-06 22:06:33 -07:00
Mitchell Hashimoto c8b829c4d2 Properly resolve cygwin paths in Cygwin environments [GH-1366] 2013-03-13 21:50:41 -07:00
Mitchell Hashimoto 1392d9b4a5 Detect if a VM name is already taken for VirtualBox 2013-01-30 23:22:45 -08:00
Mitchell Hashimoto 9d2f26604e Properly handle paused VirtualBox VMs [GH-1184] 2013-01-30 22:47:45 -08:00
Mitchell Hashimoto 44b4b9dfef Move drivers to the VirtualBox plugin. Use Machine class.
This starts the transition of replacing VM with Machine. Machine still
isn't ready to fully replace VM but by moving it now, I'm able to find
the spots that need to be fixed. At this point `vagrant status` works
with the new provider interface.
2012-07-24 21:32:38 -07:00