-
Notifications
You must be signed in to change notification settings - Fork 109
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use port groups and vSwitches for networking #108
base: master
Are you sure you want to change the base?
Conversation
This creates port groups (networks) and vSwitches automatically on `vagrant up`. The networks are created like virtualbox provider. It also optionally destroys the networks and the vSwitches on machine destroy. Helper command `destroy-networks` is added for convenience, to destroy all networks matching a pattern `{vSwitchName}-{network-address}-{network-prefix}`
Thanks for the work you are doing, but do you really think there's a demand for this for Vagrant? I see some risk here... The option to destroy or not destroy the network will lead to dangling resources. Also, if you create a network using vagrant that could lead to dependency issues if those networks are used for other VMs. Terraform is a much better tool to build your infrastructure. There is work being done in the terraform provider to create vSwitches and networking. |
I can't speak for others, but the project that I'm working on have a third party component that depends on Vagrant (with support for VirtualBox & oVirt providers), switching it would be hard, so simply adding the features I need to the provider seems like the easiest route for me. So I thought it might be useful for others too. Regarding the networking, the code checks if the network is in use before destroying it. So, it may not be possible to destroy all networks initially created by this provider. The additional But if one sticks to just the default vSwitch, and let the port group be automatically created by IP address (like VirtualBox), it should work just fine. I do understand your concern, just wanted to know if you are interested in this, I'll spend a bit more time to polish things. |
I like this idea, I think it's pretty useful.
Turns out those should be
But that doesn't seem to work:
Maybe get port groups before destroying the VM, then destroy them one by one if no other VMs use those port groups? I also tried a different scenario, which is:
I got the same error. I didn't expect to get a different error, but I was hoping it might work becuse
|
I'm not sure whether you will want this and there are some more work to do on this one, but please don't merge this yet. If you are interested, I may be able to make some changes.
Essentially, it adds networks like VirtualBox provider, by using port groups and VLANs.
Details
This creates port groups (networks) and vSwitches automatically on
vagrant up
. The networks are created like virtualbox provider. It also optionally destroys the networks and the vSwitches on machine destroy.Helper command
destroy-networks
is added for convenience, to destroy all networks matching a pattern{vSwitchName}-{network-address}-{network-prefix}
It also ignores
esxi_virtual_network
option, but I can make it compatible.Example Vagrantfile
Example
vagrant up
andvagrant destroy
Click to expand!