1205 Commits

Author SHA1 Message Date
Jeff Bonhag
ff53c64fbc
Fix test, add test .recover_from_resize 2020-07-09 15:09:09 -04:00
Jeff Bonhag
dfd3bc915c
Remove disks based on metadata
This commit changes the disk_cleanup behavior to remove disks based on
what has been recorded in the disk_meta file.
2020-07-09 15:09:07 -04:00
Jeff Bonhag
e01b51fa43
Disk management with a single controller
.configure_disks is responsible for determining the disk controller(s)
to use, given the machine configuration and the current disk config.
When a machine has a single controller, use it for all attachments.

When a machine has multiple controllers, attach disks to the SATA
controller and DVDs to the IDE controller.

This commit also returns additional attachment information
(controller/port/device) with the disk metadata.
2020-07-09 15:07:49 -04:00
Jeff Bonhag
c9bdcb6839
Error on unsupported storage controller type 2020-07-09 15:07:49 -04:00
Jeff Bonhag
53f7412821
Make VirtualBoxDisksDefinedExceedLimit error generic
Create a #limit method in the StorageController class so we can
customize the error message when a storage controller is full.
2020-07-09 15:07:49 -04:00
Jeff Bonhag
1e6eb0d636
Raise an error if primary disk can't be found 2020-07-09 15:07:49 -04:00
Jeff Bonhag
8561467e40
IDE controllers have two devices/port 2020-07-09 15:07:49 -04:00
Jeff Bonhag
61f43fb59f
Require controller name for #remove_disk
Also use #get_controller methods when attaching a disk.
2020-07-09 15:07:48 -04:00
Jeff Bonhag
4736fbc88f
Require storage controller for .get_next_port
This also includes #get_controller refactorings and cleanup for the
cleanup_disks capabaility.
2020-07-09 15:07:48 -04:00
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
0139d8f020
Simplify other select to detect instead 2020-06-30 14:23:34 -07:00
Brian Cain
39b5bb4beb
Simplify selecting disk from all_disks hash 2020-06-30 14:23:34 -07:00
Brian Cain
05d3045f3a
Add RDoc for list_hdds 2020-06-30 14:23:34 -07:00
Brian Cain
9c1338b335
Fix typo in logger message 2020-06-30 14:23:34 -07:00
Brian Cain
af20d4a426
Remove old comment 2020-06-30 14:23:34 -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
13c91d68a6
Only grab provider_config if provider key exists and config isn't empty 2020-06-30 14:23:34 -07:00
Brian Cain
1579ac9c3a
Update method docs to include expected opts keys 2020-06-30 14:23:34 -07:00
Brian Cain
69dff3a4c8
Use key? helper 2020-06-30 14:23:34 -07:00
Brian Cain
ae0fb6f857
Update check for provider_config availability 2020-06-30 14:23:34 -07:00
Brian Cain
a279f89d29
update how value is checked for execute in hyper-v driver 2020-06-30 14:23:34 -07:00
Brian Cain
71f6b97153
Delete old comments 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
18b9ccd0a5
Remove unused local var 2020-06-30 14:23:34 -07:00
Brian Cain
38445935dd
Ensure params are UInt32 rather than string 2020-06-30 14:23:34 -07:00
Brian Cain
f8dfcadb70
Only convert BlockSizeBytes option for Hyper-V disk provider_config 2020-06-30 14:23:34 -07:00
Brian Cain
56645b7bc5
Finish up configure_disk_test unit tests 2020-06-30 14:23:34 -07:00
Brian Cain
43eaceef13
Update disk meta keys to be consistent with Hyper-V keys 2020-06-30 14:23:34 -07:00
Brian Cain
d07e6c5c6a
Rearrange hyperv disk driver methods 2020-06-30 14:23:34 -07:00
Brian Cain
be939fcb59
Remove extra comments 2020-06-30 14:22:41 -07:00
Brian Cain
1d8db27340
Fixup handling parameters for hyper-v powershell disk scripts 2020-06-30 14:22:41 -07:00
Brian Cain
bb4541a2a5
Remove stale comment 2020-06-30 14:22:41 -07:00
Brian Cain
0c19e6da26
Fix typo 2020-06-30 14:22:41 -07:00
Brian Cain
d30482a502
Explicitly pass along optional params 2020-06-30 14:22:41 -07:00
Brian Cain
bbe9a637e7
Convert size options into byte form 2020-06-30 14:22:41 -07:00
Brian Cain
9e8343fc93
Automatically add all passed in parameters to hyper-v command 2020-06-30 14:22:41 -07:00
Brian Cain
f798afa0c0
Attempt to pass along parameters 2020-06-30 14:22:41 -07:00
Brian Cain
2de5ef0bf2
Fix typo in new_vhd powershell script name 2020-06-30 14:22:41 -07:00
Brian Cain
cc2dc9a1e1
Use disk file from config if defined 2020-06-30 14:22:41 -07:00
Brian Cain
1dbda081d2
Add notes for creating disk options 2020-06-30 14:22:41 -07:00
Brian Cain
ed0fdbf868
Add note about attaching disks 2020-06-30 14:22:41 -07:00