beaker-vagrant 0.2.1 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 442e5662e70ec7b271fe5bc069c9b21f302db394
|
4
|
+
data.tar.gz: 4ea668eb97e1fb2cea88cff369b01cff7b490973
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0d213b0730388cadf6e92389468f3b5613aa7562b4a484865339f410e695b7085852c2640858667954ba40cb781407c6d28606131eff2b6dbd55c160e9e2aa97
|
7
|
+
data.tar.gz: 8d98786ed2aae6b82002567fab605e1ceb9ad28cff7dcbde1b9c0c59c6b1a95b67f30c5ff5e6669115218b6b4e0cc425e759708af98c21366bcbb56889ae5a9b
|
data/docs/vagrant.md
CHANGED
@@ -160,7 +160,7 @@ In the above, beaker will forward port 10080 and 8080 on the Host to port 80 and
|
|
160
160
|
|
161
161
|
### Volumes Support
|
162
162
|
|
163
|
-
When using the Vagrant Hypervisor, beaker can create attached volumes which appear as extra disks on the guest. The size of the volume should be specified in megabytes.
|
163
|
+
When using the Vagrant Hypervisor, beaker can create attached volumes which appear as extra disks on the guest. The size of the volume should be specified in megabytes. You can override the type of storage controller used to attach the disk by specifying `volume_storage_controller` with values of `AHCI`, `LSILogic`, `USB`, or `PIIX4`.
|
164
164
|
|
165
165
|
**Example hosts file**
|
166
166
|
|
@@ -178,6 +178,7 @@ When using the Vagrant Hypervisor, beaker can create attached volumes which appe
|
|
178
178
|
volumes:
|
179
179
|
second_disk:
|
180
180
|
size: 5120
|
181
|
+
volume_storage_controller: USB
|
181
182
|
|
182
183
|
# vagrant plugins #
|
183
184
|
|
@@ -1,6 +1,14 @@
|
|
1
1
|
require 'beaker/hypervisor/vagrant'
|
2
2
|
|
3
3
|
class Beaker::VagrantVirtualbox < Beaker::Vagrant
|
4
|
+
|
5
|
+
CONTROLLER_OPTIONS = {
|
6
|
+
LSILogic: [ '--add', 'scsi', '--portcount', '16', '--controller', 'LSILogic', '--bootable', 'off' ],
|
7
|
+
IntelAHCI: [ '--add', 'sata', '--portcount', '2', '--controller', 'IntelAHCI', '--bootable', 'off' ],
|
8
|
+
PIIX4: [ '--add', 'ide', '--portcount', '2', '--controller', 'PIIX4', '--bootable', 'off' ],
|
9
|
+
USB: [ '--add', 'usb', '--portcount', '8', '--controller', 'USB', '--bootable', 'off' ]
|
10
|
+
}.freeze
|
11
|
+
|
4
12
|
def provision(provider = 'virtualbox')
|
5
13
|
super
|
6
14
|
end
|
@@ -23,20 +31,21 @@ class Beaker::VagrantVirtualbox < Beaker::Vagrant
|
|
23
31
|
provider_section << " vb.vbguest.auto_update = false" if options[:vbguest_plugin] == 'disable'
|
24
32
|
|
25
33
|
# Guest volume support
|
26
|
-
# - Creates a new
|
27
|
-
# the default controller is limited in its number of supported ports (2).
|
28
|
-
# The AHCI emulation is generic enough for acceptance testing, and
|
29
|
-
# presents the devices as SCSI devices in /sys/class/scsi_disk.
|
34
|
+
# - Creates a new controller (AHCI by default)
|
30
35
|
# - Creates the defined volumes in beaker's temporary folder and attaches
|
31
36
|
# them to the controller in order starting at port 0. This presents disks
|
32
37
|
# as 2:0:0:0, 3:0:0:0 ... much like you'd see on commercial storage boxes
|
33
38
|
if host['volumes']
|
39
|
+
controller = host['volume_storage_controller'].nil? ? 'IntelAHCI' : host['volume_storage_controller']
|
40
|
+
unless CONTROLLER_OPTIONS.keys.include? controller.to_sym
|
41
|
+
raise "Unknown controller type #{controller}"
|
42
|
+
end
|
43
|
+
if controller == 'USB'
|
44
|
+
provider_section << self.vb_customize_vm('modifyvm', [ '--usb', 'on' ])
|
45
|
+
end
|
34
46
|
provider_section << self.vb_customize_vm('storagectl', [
|
35
|
-
'--name',
|
36
|
-
|
37
|
-
'--controller', 'IntelAHCI',
|
38
|
-
'--portcount', host['volumes'].length
|
39
|
-
])
|
47
|
+
'--name', "Beaker #{controller} Controller" ] + CONTROLLER_OPTIONS[controller.to_sym]
|
48
|
+
)
|
40
49
|
host['volumes'].keys.each_with_index do |volume, index|
|
41
50
|
volume_path = "#{host.name}-#{volume}.vdi"
|
42
51
|
provider_section << self.vb_customize('createhd', [
|
@@ -44,7 +53,7 @@ class Beaker::VagrantVirtualbox < Beaker::Vagrant
|
|
44
53
|
'--size', host['volumes'][volume]['size'],
|
45
54
|
])
|
46
55
|
provider_section << self.vb_customize_vm('storageattach', [
|
47
|
-
'--storagectl',
|
56
|
+
'--storagectl', "Beaker #{controller} Controller",
|
48
57
|
'--port', index,
|
49
58
|
'--device', 0,
|
50
59
|
'--type', 'hdd',
|
@@ -51,4 +51,37 @@ describe Beaker::VagrantVirtualbox do
|
|
51
51
|
expect( vagrantfile ).to include( %Q{ vb.customize ["modifyvm", :id, "--ioapic", "on"]})
|
52
52
|
end
|
53
53
|
|
54
|
+
it "correctly provisions storage with the USB controller" do
|
55
|
+
path = vagrant.instance_variable_get( :@vagrant_path )
|
56
|
+
hosts = make_hosts({:volumes => { 'test_disk' => { size: '5120' }}, :volume_storage_controller => 'USB' })
|
57
|
+
|
58
|
+
vagrant.make_vfile( hosts )
|
59
|
+
vagrantfile = File.read( File.expand_path( File.join( path, 'Vagrantfile' )))
|
60
|
+
expect( vagrantfile ).to include(%Q{ vb.customize ['modifyvm', :id, '--usb', 'on']})
|
61
|
+
expect( vagrantfile ).to include(%Q{ vb.customize ['storagectl', :id, '--name', 'Beaker USB Controller', '--add', 'usb', '--portcount', '8', '--controller', 'USB', '--bootable', 'off']})
|
62
|
+
expect( vagrantfile ).to include(%Q{ vb.customize ['createhd', '--filename', 'vm1-test_disk.vdi', '--size', '5120']})
|
63
|
+
expect( vagrantfile ).to include(%Q{ vb.customize ['storageattach', :id, '--storagectl', 'Beaker USB Controller', '--port', '0', '--device', '0', '--type', 'hdd', '--medium', 'vm1-test_disk.vdi']})
|
64
|
+
end
|
65
|
+
|
66
|
+
it "correctly provisions storage with the LSILogic controller" do
|
67
|
+
path = vagrant.instance_variable_get( :@vagrant_path )
|
68
|
+
hosts = make_hosts({:volumes => { 'test_disk' => { size: '5120' }}, :volume_storage_controller => 'LSILogic' })
|
69
|
+
|
70
|
+
vagrant.make_vfile( hosts )
|
71
|
+
vagrantfile = File.read( File.expand_path( File.join( path, 'Vagrantfile' )))
|
72
|
+
expect( vagrantfile ).to include(%Q{ vb.customize ['storagectl', :id, '--name', 'Beaker LSILogic Controller', '--add', 'scsi', '--portcount', '16', '--controller', 'LSILogic', '--bootable', 'off']})
|
73
|
+
expect( vagrantfile ).to include(%Q{ vb.customize ['createhd', '--filename', 'vm1-test_disk.vdi', '--size', '5120']})
|
74
|
+
expect( vagrantfile ).to include(%Q{ vb.customize ['storageattach', :id, '--storagectl', 'Beaker LSILogic Controller', '--port', '0', '--device', '0', '--type', 'hdd', '--medium', 'vm1-test_disk.vdi']})
|
75
|
+
end
|
76
|
+
|
77
|
+
it "correctly provisions storage with the default controller" do
|
78
|
+
path = vagrant.instance_variable_get( :@vagrant_path )
|
79
|
+
hosts = make_hosts({:volumes => { 'test_disk' => { size: '5120' }}})
|
80
|
+
|
81
|
+
vagrant.make_vfile( hosts )
|
82
|
+
vagrantfile = File.read( File.expand_path( File.join( path, 'Vagrantfile' )))
|
83
|
+
expect( vagrantfile ).to include(%Q{ vb.customize ['storagectl', :id, '--name', 'Beaker IntelAHCI Controller', '--add', 'sata', '--portcount', '2', '--controller', 'IntelAHCI', '--bootable', 'off']})
|
84
|
+
expect( vagrantfile ).to include(%Q{ vb.customize ['createhd', '--filename', 'vm1-test_disk.vdi', '--size', '5120']})
|
85
|
+
expect( vagrantfile ).to include(%Q{ vb.customize ['storageattach', :id, '--storagectl', 'Beaker IntelAHCI Controller', '--port', '0', '--device', '0', '--type', 'hdd', '--medium', 'vm1-test_disk.vdi']})
|
86
|
+
end
|
54
87
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: beaker-vagrant
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rishi Javia, Kevin Imber, Tony Vu
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-02-
|
11
|
+
date: 2018-02-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|