vagrant-newdisk 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/vagrant/newdisk/actions.rb +5 -7
- data/lib/vagrant/newdisk/version.rb +1 -1
- metadata +1 -3
- data/bin/console +0 -14
- data/bin/setup +0 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fbc682c842f72a814d445e2a1c28471568de57df
|
4
|
+
data.tar.gz: eae0460ddc98349171be573b54a0fb0f729060b2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 488e58928d2ba91758f3dfa425362c946cdfdc57472a0907be23bf519c5625c3812ea47f3bbcf8ad730ba880d4146b8b4e8460a6b5e4b2248327bdc2370355b1
|
7
|
+
data.tar.gz: 3a28617cf0af81ae8bfead6a2d83ffd287426f895402313f8c4313f9315a6cba69251a2e6b22d8ba22aab9323e2cca384997d96e528a6a9a74e1cc75bd7edfcb
|
@@ -19,9 +19,9 @@ module Vagrant
|
|
19
19
|
if @enabled
|
20
20
|
size = @machine.config.newdisk.size
|
21
21
|
path = @machine.config.newdisk.path
|
22
|
-
env[:ui].
|
23
|
-
env[:ui].error("path = #{path}")
|
22
|
+
env[:ui].info "start newdisk: size = #{size}, path = #{path}"
|
24
23
|
new_disk(env, path, size)
|
24
|
+
env[:ui].success "done newdisk: size = #{size}, path = #{path}"
|
25
25
|
end
|
26
26
|
|
27
27
|
# Allow middleware chain to continue so VM is booted
|
@@ -38,6 +38,7 @@ module Vagrant
|
|
38
38
|
|
39
39
|
def attach_disk(driver, path)
|
40
40
|
disk = find_place_for_new_disk(driver)
|
41
|
+
@ui.info "Attaching new disk: #{path} at #{disk}"
|
41
42
|
driver.execute('storageattach', @machine.id, '--storagectl', disk[:controller],
|
42
43
|
'--port', disk[:port].to_s, '--device', disk[:device].to_s, '--type', 'hdd',
|
43
44
|
'--medium', path)
|
@@ -45,17 +46,14 @@ module Vagrant
|
|
45
46
|
|
46
47
|
def find_place_for_new_disk(driver)
|
47
48
|
disks = get_disks(driver)
|
48
|
-
@ui.
|
49
|
+
@ui.info "existing disks = #{disks.to_s}"
|
49
50
|
controller = disks.first[:controller]
|
50
51
|
disks = disks.select { |disk| disk[:controller] == controller }
|
51
52
|
port = disks.map { |disk| disk[:port] }.max
|
52
53
|
disks = disks.select { |disk| disk[:port] == port }
|
53
54
|
max_device = disks.map { |disk| disk[:device] }.max
|
54
55
|
|
55
|
-
|
56
|
-
new_disk = {:controller => controller, :port => port.to_i, :device => max_device.to_i + 1}
|
57
|
-
@ui.error "new disk: #{new_disk.to_s}"
|
58
|
-
new_disk
|
56
|
+
{:controller => controller, :port => port.to_i, :device => max_device.to_i + 1}
|
59
57
|
end
|
60
58
|
|
61
59
|
def get_disks(driver)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vagrant-newdisk
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Yavor Nikolov
|
@@ -51,8 +51,6 @@ files:
|
|
51
51
|
- README.md
|
52
52
|
- Rakefile
|
53
53
|
- Vagrantfile
|
54
|
-
- bin/console
|
55
|
-
- bin/setup
|
56
54
|
- lib/vagrant/newdisk.rb
|
57
55
|
- lib/vagrant/newdisk/actions.rb
|
58
56
|
- lib/vagrant/newdisk/config.rb
|
data/bin/console
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
require "bundler/setup"
|
4
|
-
require "vagrant/newdisk"
|
5
|
-
|
6
|
-
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
-
# with your gem easier. You can also use a different console, if you like.
|
8
|
-
|
9
|
-
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
-
# require "pry"
|
11
|
-
# Pry.start
|
12
|
-
|
13
|
-
require "irb"
|
14
|
-
IRB.start
|