596 Commits

Author SHA1 Message Date
Jeff Bonhag
958023dbb9
Create #get_controller method in driver
This makes it easier to check if the required controller can be found,
and automatically raise an error if it is not.

Add a #storage_bus method to the StorageController class as a shorthand
way to check the general storage controller type.
2020-07-09 15:07:48 -04:00
Jeff Bonhag
3a515cc7d6
Error if the required storage controller not found
This commit adds a new error type that can be raised whenever a storage
controller of the required type is not found. This indicates that a user
needs to either add the storage controller manually or change their disk
configuration.

It also removes the last hardcoded instance of "SATA Controller" as a
default argument.
2020-07-09 15:07:48 -04:00
Jeff Bonhag
4480eb0d88
Freeze values 2020-07-09 15:07:47 -04:00
Jeff Bonhag
5abde797e4
Forward #storage_controller to driver 2020-07-09 15:07:47 -04:00
Jeff Bonhag
61f59de69b
Extract StorageController object 2020-07-09 15:07:47 -04:00
Jeff Bonhag
2e879aa06f
Scan storage controllers for DVD cleanup 2020-07-09 15:07:47 -04:00
Jeff Bonhag
8739c04aa9
Mock out storage controllers 2020-07-09 15:07:47 -04:00
Jeff Bonhag
8407d79100
Refactor disk configuration to use dynamic names
This commit adds a new VirtualBox provider helper method to return a
list of storage controllers so Vagrant can find a storage controller
with the desired characteristics (type IDE or SATA).

This still needs to get wired up to the disk cleanup method.
2020-07-09 15:07:46 -04:00
Jeff Bonhag
c52eb1b44c
Feature: ISO attachment for VirtualBox
This builds on the existing disk functionality, and adds some special
IDE controller-related flavor.

Considerations for IDE controllers:
- Primary/secondary attachments, so that each port can have two devices
  attached
- Adding the ability to address a specific controller name for disk
  attachment

This also prevents a user from attaching multiple instances of the same
ISO file, because VirtualBox will assign each of these the same UUID
which makes disconnection difficult. However, if multiple copies of the
ISO are attached to different devices, removing the DVD config will
cause the duplicate devices to be removed.

We may want to consider additional work to make the storage controllers
truly generic.
2020-07-09 15:07:27 -04:00
Brian Cain
88c2bc2be1
Merge pull request #11541 from briancain/feature/hyperv-disk-mgmt
[Feature] Hyper-V Virtual Hard Disk Management
2020-07-06 15:24:29 -07:00
Brian Cain
b36db04b3d
Validate and get default disk extensions for provider
This commit updates the hyperv and virtualbox provider caps to validate
and also return the default disk extension.
2020-06-30 14:23:34 -07:00
Brian Cain
4130cfe497
Properly check for disk paths when cleaning up disks in hyper-v 2020-06-30 14:23:34 -07:00
Brian Cain
42718437ab
Initial commit of cloud_init setup action
This commit introduces a new builtin action for preparing and
configuring guests cloud_init configs as an iso to be attached later by
the disk actions
2020-06-29 11:00:16 -07:00
Sophia Castellarin
111f58ef38
Merge pull request #11628 from soapy1/vagrant-destroy-power-off
Option to forcefully/gracefully destroy virtualbox vm
2020-06-12 15:00:01 -05:00
sophia
1a758d839b Option to gracefully destroy vm 2020-05-29 15:36:40 -04:00
sophia
fe7968315b Add option to allow/disable fstab modification
Defaults to allow modification of fstab
2020-05-29 15:29:21 -04:00
sophia
1dc761a6c4 Refactor out persisting a mount to it's own guest cap 2020-05-29 15:26:48 -04:00
sophia
b511d23ae1 Refresh fstab when folders synced 2020-05-29 15:26:48 -04:00
Jeff Bonhag
f593bb54d2
Fix #8704: Raise an error if the guest IP ends with .1 (#11500)
If the VirtualBox guest property /VirtualBox/GuestInfo/Net/1/V4/IP
returns an IP address ending in .1, raise an error.

This addresses an issue that was revealed as an NFS error, where Vagrant
was creating an exports file with the wrong IP address. This was thought
to be caused by the presence of a docker0 interface, but it manifested
itself even without Docker installed.

This issue is difficult to reproduce, but hopefully this PR will get us
closer to the root cause.
2020-04-20 13:28:37 -04:00
sophia
39d7cd8997 Wrap all progress type outputs with rewriting to enable --no-tty 2020-04-03 16:28:59 -04:00
Jeff Bonhag
a10b2c3108
Fix #11403: Parse list dhcpservers output on VirtualBox 6.1 (#11404)
This commit creates a custom `read_dhcp_servers` method in the
VirtualBox 6.1 driver to handle changes made in the ouput of
`VBoxManage list dhcpservers`.

Tests for VirtualBox 6.1+ can no longer use the shared examples for the
VirtualBox 4.x driver, because the `read_dhcp_servers` change is not
backwards compatible.

This commit also creates the boilerplate for a VirtualBox 6.x shared
example in case we want to put tests there in the future.
2020-02-18 15:14:31 -05:00
Brian Cain
96d7c19c06
Abstract out recovery method for resizing disk failures
This commit moves out the recovery steps for failures when Vagrant
attempts to resize disks. It wraps itsemf in a begin/rescue in case an
additional error occurs, we can still surface the original error that
caused the resizing to fail.
2020-02-13 09:42:18 -08:00
Brian Cain
625bbf9cc8
Add more specific rescue exceptions for when errors occur for resizing
disks
2020-02-12 16:26:18 -08:00
Brian Cain
42133ad34e
Move strings into locales file 2020-02-12 16:22:02 -08:00
Brian Cain
37f8df174c
Freeze all values in valid disk ext default types 2020-02-12 16:00:23 -08:00
Brian Cain
dafb60ad4f
Update experimental feature flag for disk 2020-02-12 15:38:34 -08:00
Brian Cain
c5f4534487
Add virtualbox capability for validating disk extension types 2020-02-12 13:21:09 -08:00
Brian Cain
2174f4c219
Write up recovery message for when vagrant fails to resize vmdk disks 2020-02-12 10:24:38 -08:00
Brian Cain
d5e12dab17
Store backup disk location as local var 2020-02-12 09:56:41 -08:00
Brian Cain
1826d210a0
Recover from cloning and resizin disk failures
This commit adds some recovery if Vagrant fails to reattach or clone a
vmdk disk that needs to be resized. It first moves the original disk
(after cloning) to a backup file. If something fails, it will reattach
the original disk to the guest and continue to raise the exception.
2020-02-11 16:02:24 -08:00
Brian Cain
6fcc5fa31a
Raise error if guest has no available ports for attaching disks 2020-02-11 13:06:57 -08:00
Brian Cain
4866709c67
Move disk cloning to virtualbox driver 5 2020-02-10 15:17:23 -08:00
Brian Cain
5bc0b28116
Update how to check for empty string 2020-02-10 13:21:27 -08:00
Brian Cain
00d7ecb57f
Remove explicit return for disk configure methods 2020-02-10 13:04:47 -08:00
Brian Cain
b2a89f8711
Remove old comment on vbox driver disk method 2020-02-10 12:58:11 -08:00
Brian Cain
773a3aeb7e
Add optional hash arguments to driver methods 2020-02-10 12:58:11 -08:00
Brian Cain
b9a72ce8ff
Make get_port_and_device disk method a driver method instead 2020-02-10 12:58:11 -08:00
Brian Cain
252a7f7a4e
Do not clean up and detach primary disk 2020-02-10 12:58:11 -08:00
Brian Cain
8654b2bb67
Add note about provider specific disk configs 2020-02-10 12:58:11 -08:00
Brian Cain
72576d3046
Rename method for clarity for what it handles 2020-02-10 12:58:11 -08:00
Brian Cain
6ea3c3f40e
Move current_disk work into own method 2020-02-10 12:58:11 -08:00
Brian Cain
e4782e9d6a
Add method doc for method 2020-02-10 12:58:11 -08:00
Brian Cain
236815f2ff
Attempt to connect vagrant managed disks to guest if not attached 2020-02-10 12:58:11 -08:00
Brian Cain
d215d9d785
Only log warning when cleaning up disks
If a disk exists but isn't attached to a guest, don't attempt to remove
disk from guest.
2020-02-10 12:58:11 -08:00
Brian Cain
2e53c21fea
Return empty hash instead of null from configure_disks 2020-02-10 12:58:11 -08:00
Brian Cain
df742603cb
Add code comment about when SATA controller has no more open ports 2020-02-10 12:58:11 -08:00
Brian Cain
3d4d0be58f
Attach disk to next available port to avoid port fragmentation
This commit ensures that vagrant attaches a new disk to the _next
available_ port, rather than the last one "used". This can occur if a
disk has been removed in a previous run, leaving a port open
2020-02-10 12:58:11 -08:00
Brian Cain
c0fb8af1a3
Fix NUMBER typo 2020-02-10 12:58:11 -08:00
Brian Cain
2db81b049b
Only look at SATA Controller disk images 2020-02-10 12:58:11 -08:00
Brian Cain
f6a5a3ae41
Simplify determining next port to use 2020-02-10 12:58:11 -08:00