Commit Graph

179 Commits

Author SHA1 Message Date
Mitchell Hashimoto f1f4f276a0 Set the virtualbox config scope 2013-01-13 12:38:51 -08:00
Mitchell Hashimoto 965427c540 Properly upgrade V1 hostonly/bridged networks to V2 config 2013-01-13 01:07:55 -08:00
Mitchell Hashimoto 212e634c3b Make Provision a built-in action.
This allows other providers to just use it.
2013-01-12 16:22:37 -08:00
Mitchell Hashimoto 22571bf05b Rescue the EHOSTDOWN error for SSH 2013-01-12 12:47:49 -08:00
Mitchell Hashimoto 124a2ee5d3 Add the --provider optional flag to `box add` 2013-01-11 21:24:57 -08:00
Mitchell Hashimoto 2d8a048946 Merge branch 'abstract-networks'
This introduces the new network configuration syntax for Vagrant 1.1
and forward.

== The Problem

With multiple providers, the concept of networking as it stands in Vagrant
1.0.x becomes really muddy. We have `config.vm.forward_port` and
`config.vm.network :hostonly` and `config.vm.network :bridged`. But what
if someone writes an AWS provider? What is a bridged network in AWS? It
just doesn't make sense.

Networking working out of the box with Vagrant is a core part of what
makes Vagrant "magic" to new users. It is a core part of what makes Vagrant
simple to use. One option to punt networking to provider-specific
configuration was considered, but I found the whole idea of networking
too core to Vagrant to simply punt.

Because of this, a whole new method of networking is introduced.

== The Solution

The solution is to have a high-level notion of networking for Vagrant
configuration. This should cover the most _common_ cases of networking, and
every provider should do their best to implement these high-level
abstractions, to ensure the "just works" nature of Vagrant.

In addition to this high-level networking, low-level networking options
should be exposed on the provider configuration. This allows users to do
advanced provider-specific networking configuration if they want, but aren't
required to.

== High-Level Abstractions

=== Available Types

The high-level abstractions built into Vagrant will be the following:

* Forwarded ports - A mapping of host port to guest port that one can hit
  using `localhost`.
* Private network - A private network, the machine should ideally be
  protected from public access.
* Public network - A public network, one that is easily accessible by
  others.

I'm not sure if these are the proper abstractions. They can change up
until 2.0, but these are what we have so far.

Theoretically, here is how mappings would work. Note that this is just
an example, and the mappings in practice of such providers may or
may not map to this as follows.

**VirtualBox**
* Forwarded ports - NAT network, forwared ports.
* Private network - Hostonly network, static IP assigned.
* Public network - Bridged network, IP assigned via DHCP from router.

**VMWare**
* Forwarded ports - NAT network, forwarded ports.
* Private network - Hostonly network, static IP assigned.
* Public network - Bridged network, IP assigned via DHCP from router.

**AWS**
* Forwarded ports - Unimplemented.
* Private network - Public DNS in EC2, private IP in VPC.
* Public network - Elastic IP in EC2 and VPC.

=== Syntax

Networks are configured at the top-level of a Vagrantfile:

```ruby
Vagrant.configure("2") do |config|
  # ...

  config.vm.network :forwarded_port, 80, 8080
  config.vm.network :private_network, "192.168.1.12"
  config.vm.network :public_network
end
```

Providers should do their best to honor these configurations.

=== Advanced Options

While providers should do their best to satisfy the requirements for the
high-level abstractions, it is expected that provider-specific configuration
may be possible per network, even for the high-level configurations. For
this, provider-prefixed configuration options should be done:

```ruby
config.vm.network :forwarded_port, 80, 8000,
  :vmware__device => "vmnet8"

config.vm.network :public_network,
  :aws__elastic_ip => "1.2.3.4",
  :vmware__device => "en0"
```

If at all possible, providers should **not** require advanced options for
these to function.

== Low-level Configuration

While the high-level configuration should satisfy the common case and make
Vagrant work out of the box for most providers, one of the large benefits of
many providers is the ability to do certain networking tricks. For example,
KVM, Hyper-V, vSphere, etc. can create and be a part of true VLANs, which
may be required for certain upstream networking rules/ACLs. For things like
this, the network configuration should go directly into the provider
configuration in some way.

Examples:

```ruby
config.vm.provider :virtualbox do |vb|
  vb.network_adapter 2, :hostonly
  vb.network_adapter 3, :nat
end

config.vm.provider :aws do |aws|
  aws.routing_table = "route-123456"
end
```

It is up to the provider implementation to define the configuration
syntax as well as the implementation details of such an option. Other
providers are unable to see provider configurations other than their own
so it is truly private to the provider.
2013-01-11 16:18:09 -08:00
Mitchell Hashimoto 48eaa93745 Raise proper error if there aren't any NIC slots available 2013-01-11 15:57:08 -08:00
Mitchell Hashimoto 7cd663391e Forwarded ports allow for scoped hash overrides 2013-01-11 15:52:45 -08:00
Mitchell Hashimoto 102e8f23d6 Use scoped hash overrides for high-level config 2013-01-11 15:50:09 -08:00
Mitchell Hashimoto ccc4da0d32 Remove the old networking code 2013-01-11 15:23:20 -08:00
Mitchell Hashimoto 48995f6036 Support mac address and nic_type for host only networks 2013-01-11 15:22:55 -08:00
Mitchell Hashimoto d09dc91d1b Add support for bridged networks again 2013-01-11 15:21:09 -08:00
Mitchell Hashimoto 37e158c9b2 Configure networks on the VM 2013-01-11 15:06:38 -08:00
Mitchell Hashimoto da7f227fff Forwarded ports use the new high-level configuration 2013-01-11 14:51:49 -08:00
Mitchell Hashimoto 7e5f175d2c Check port collisions now uses the new high-level networking 2013-01-11 14:44:27 -08:00
Mitchell Hashimoto 2d8f9baf7f New Network VirtualBox middleware to handle the changes.
Note this is a WIP (hence committed on a branch)
2013-01-11 14:16:00 -08:00
Mitchell Hashimoto 8299ac38bd Rework v1 forward_port call to append forward port networks 2013-01-10 12:06:08 -08:00
Mitchell Hashimoto 09126b20d3 Merge pull request #1283 from eladroz/master
Fixing guest code for RH & SUSE
2013-01-06 17:38:09 -08:00
Jordi Llonch 793ad58e96 fedora 17 & 18 support 2013-01-07 05:23:07 +11:00
Mitchell Hashimoto 7a9363e8a1 Fix ordering of forwarded_port call 2013-01-04 16:35:13 -10:00
Mitchell Hashimoto 559cf25b5f Temporarily disable Network action while it is broken 2013-01-04 16:25:20 -10:00
Mitchell Hashimoto 2d3c0b7148 VirtualBox forwarding port uses new `network` calls 2013-01-04 16:22:38 -10:00
Mitchell Hashimoto a2cf0270a3 Remove network validation on config. We'll re-add this later. 2013-01-04 16:13:02 -10:00
Mitchell Hashimoto 640b296f5a Explicitly set error handling for port collision on resume 2013-01-04 16:11:40 -10:00
Mitchell Hashimoto be36c702d6 Booting new VirtualBox VM should check for port collisions 2013-01-04 16:08:37 -10:00
Mitchell Hashimoto 5c950d8200 Remove old `forward_port` method for configuration. Use `network` 2013-01-04 15:48:54 -10:00
Mitchell Hashimoto a4896293ff Merge pull request #1260 from hdorio/master
Attempt to fix #1108, #1109, tcp and udp port on the same port number
2013-01-03 17:13:07 -08:00
Elad Rosenheim 0915186b26 Fix guest plugin for RH & SUSE 2012-12-31 10:38:36 +02:00
Mitchell Hashimoto cd969e1e05 Remove the dotfile_name configuration option.
The dotfile is gone now so the configuration option is obselete
2012-12-26 21:45:24 -08:00
Mitchell Hashimoto d54d58c09c Call `finalize!` properly on provider configurations 2012-12-26 21:44:43 -08:00
Mitchell Hashimoto e955596939 Set a default for the "gui" option for VirtualBox 2012-12-25 09:18:47 -08:00
Mitchell Hashimoto 54a2f6b89e Change boot_mode to a provider config `gui`.
OLD:

config.vm.boot_mode = :gui

NEW:

config.vm.provider :virtualbox do |vb|
  vb.gui = true
end
2012-12-25 09:00:06 -08:00
Mitchell Hashimoto 2cfc5986d2 Wording changes in the status command. VM => machine 2012-12-24 10:00:28 -08:00
Mitchell Hashimoto 8fe0f86dbd The --provider flag for `up` now actually does something. 2012-12-23 21:23:08 -08:00
Mitchell Hashimoto 8cc4910fa9 Merge commit that got missed. Ignore changes in this comit. Read message
This branch brings in a whole lot of awesome. The name does not do it
justice. The list of things that comes into play here:

* "virtualbox" is no longer hardcoded anywhere in core. It is the default
  provider, yes, but it is 100% possible now to slip in another provider
  and have it work.

* `vagrant up --provider` is a thing. This allows you to specify an
  alternate provider. Note that the other commands don't support
  `--provider` yet so its not THAT useful, but its getting really close.

* True V2 configuration is in place. That means that `Vagrant.configure`
  calls now are loading a completely new configuration version, and old
  1.0.x Vagrantfiles are V1 configuration. V1 configuration is upgraded
  automatically internally, so backwards compatibility is maintained.
  Magic, people, magic.

* `config.vm.provider` is the major new configuration option. This is
  how provider-specific configuration will be done. For example, Vagrant
  has always provided a way to make a pass of `VBoxManage` calls to
  customize your VM via `config.vm.customize` in V1. This now exists
  as a VirtualBox configuration option. See the example here:
  https://gist.github.com/98f5a0df6a05286dfb73

* Unit tests no longer depend on VirtualBox being installed, because for
  unit tests we slip in a "no-op" provider, which is a fully valid
  Vagrant provider plug-in that does... NOTHING! Brilliant!

* Lots of core middleware executor improvements that make writing and
  using middleware stacks a lot more enjoyable. Enjoy a set of "standard
  library middlewares" provided by Vagrant in Vagrant::Action::Builtin.

The multi-provider is really shaping up here.
2012-12-23 16:34:09 -08:00
Mitchell Hashimoto 178c47992c Remove unused files 2012-12-23 16:29:26 -08:00
Mitchell Hashimoto a671fdcbcb Upgrade sub-VM defines from old config 2012-12-23 16:29:26 -08:00
Mitchell Hashimoto 3808ea377f Upgrade all other default configurations to V2 2012-12-23 16:29:26 -08:00
Mitchell Hashimoto bf53abca76 VM config upgrades provisioners 2012-12-23 16:29:25 -08:00
Mitchell Hashimoto ed6123ac77 Upgrade all VM configs except provisioners (TODO still) 2012-12-23 16:29:25 -08:00
Mitchell Hashimoto 9f6b091575 Comment clarification 2012-12-23 16:29:25 -08:00
Mitchell Hashimoto 9f893534f1 Upgrade VM customizations 2012-12-23 16:29:25 -08:00
Mitchell Hashimoto e88d735cb6 Make configured VM providers default to an empty one 2012-12-23 16:29:25 -08:00
Mitchell Hashimoto 553d4a828a Make sure provider config is always available even if no block was given 2012-12-23 16:29:25 -08:00
Mitchell Hashimoto 6478139cee Move config.vm.customize to VirtualBox specific option 2012-12-23 16:29:25 -08:00
Mitchell Hashimoto 66849fda20 When recovering on import and destroying, force it 2012-12-23 16:29:25 -08:00
Mitchell Hashimoto 1ee470a551 Begin work on supporting provider-specific configuration
This works by registering a `config` with `:provider => true` with the
same name as your provider. Vagrant will then automatically configure
the provider when `config.vm.provider` is used.
2012-12-23 16:29:24 -08:00
Mitchell Hashimoto 666f9f802d When upgrading V1 `vm` config, don't set on new if it wasn't set before 2012-12-23 16:29:24 -08:00
Mitchell Hashimoto b6c6614fd8 Basic upgrade support for the `vm` config settings. VERY basic. 2012-12-23 16:29:24 -08:00
Mitchell Hashimoto 5adcb0fc43 Merge pull request #1232 from paulmars/master
Altered messages so they were _not_ self referencing.
2012-12-21 12:15:02 -08:00