vagrant-persistent-storage 0.0.6 → 0.0.7

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: 779835b503c60cfda4e5a2e43a951c9a5b6e3752
4
- data.tar.gz: ba2113df5cd9a1a1543efcf0591345c6bc9dbfa6
3
+ metadata.gz: d06ebc8e252aece51a84e0d8caec5691ecbed911
4
+ data.tar.gz: 4a5a9a4961fbd7a12221554a8739946addff1593
5
5
  SHA512:
6
- metadata.gz: bf4d081fb06ffad08e1e17ca120e01e58ad9119bf3c03241280e19ed0c4f0d7ae0ab49a3e821414f8cde7a19c2bcb37454292e5b77b9ca6255986dbda31a6fb5
7
- data.tar.gz: 5fb29450883b10cf242910d8e0e4f0d9fa8e20806f7bfe26d5e28570da1a013e3da3d422e8740a54eb1bfacc39849c70e332344e5a35016af29aea94dfb73082
6
+ metadata.gz: 355de3c1853498483c3897a4ecb79cb5aa98323f0b8f2c65a6bd11cc9faa7c0f8d95cbd386286934fe5558f09907d776c4211503d888d7e05b16534f0a6e7894
7
+ data.tar.gz: 019cc98b6f1d00e35543e5a817a4517faad61b976951f6be2b4cc5db5b8b514429a29fb031e74ae63ccbc4824c48e6d8cef912c63d52c929363ed6b8e79ec90e
data/README.md CHANGED
@@ -40,6 +40,7 @@ with entries added to fstab ... subsequent runs will mount this disk with the op
40
40
  ## Contributors
41
41
 
42
42
  * [madAndroid](https://github.com/madAndroid)
43
+ * [Jeremiah Snapp](https://github.com/jeremiahsnapp)
43
44
 
44
45
  ## TODO
45
46
 
@@ -18,8 +18,8 @@ module VagrantPlugins
18
18
  return @app.call(env) if @machine.state.id != :running && [:destroy, :halt, :suspend].include?(env[:machine_action])
19
19
  # skip if machine is not saved and the action is resume
20
20
  return @app.call(env) if @machine.state.id != :saved && env[:machine_action] == :resume
21
- # skip if machine is powered off and the action is resume
22
- return @app.call(env) if @machine.state.id == :poweroff && env[:machine_action] == :resume
21
+ # skip if machine is powered off and the action is resume or up
22
+ return @app.call(env) if @machine.state.id == :poweroff && [:resume, :up].include?(env[:machine_action])
23
23
  # skip if machine is saved
24
24
  return @app.call(env) if @machine.state.id == :saved
25
25
 
@@ -6,7 +6,13 @@ module VagrantPlugins
6
6
  class Base
7
7
 
8
8
  def create_adapter
9
- execute("storagectl", @uuid, "--name", "SATA Controller", "--" + (@version.start_with?("4.3") ? "" : "sata") + "portcount", "2")
9
+ sata_controller_name = get_sata_controller_name
10
+ if sata_controller_name.nil?
11
+ sata_controller_name = "SATA Controller"
12
+ execute("storagectl", @uuid, "--name", sata_controller_name, "--" + (@version.start_with?("4.3") ? "" : "sata") + "portcount", "2", "--add", "sata")
13
+ else
14
+ execute("storagectl", @uuid, "--name", sata_controller_name, "--" + (@version.start_with?("4.3") ? "" : "sata") + "portcount", "2")
15
+ end
10
16
  end
11
17
 
12
18
  def create_storage(location, size)
@@ -14,12 +20,12 @@ module VagrantPlugins
14
20
  end
15
21
 
16
22
  def attach_storage(location)
17
- execute("storageattach", @uuid, "--storagectl", "SATA Controller", "--port", "1", "--device", "0", "--type", "hdd", "--medium", "#{location}")
23
+ execute("storageattach", @uuid, "--storagectl", get_sata_controller_name, "--port", "1", "--device", "0", "--type", "hdd", "--medium", "#{location}")
18
24
  end
19
25
 
20
26
  def detach_storage(location)
21
27
  if location and identical_files(read_persistent_storage(location), location)
22
- execute("storageattach", @uuid, "--storagectl", "SATA Controller", "--port", "1", "--device", "0", "--type", "hdd", "--medium", "none")
28
+ execute("storageattach", @uuid, "--storagectl", get_sata_controller_name, "--port", "1", "--device", "0", "--type", "hdd", "--medium", "none")
23
29
  end
24
30
  end
25
31
 
@@ -28,7 +34,7 @@ module VagrantPlugins
28
34
  sleep 3
29
35
  info = execute("showvminfo", @uuid, "--machinereadable", :retryable => true)
30
36
  info.split("\n").each do |line|
31
- return $1.to_s if line =~ /^"SATA Controller-1-0"="(.+?)"$/
37
+ return $1.to_s if line =~ /^"#{get_sata_controller_name}-1-0"="(.+?)"$/
32
38
  end
33
39
  nil
34
40
  end
@@ -37,6 +43,17 @@ module VagrantPlugins
37
43
  return File.identical?(Pathname.new(file1).realpath, Pathname.new(file2).realpath)
38
44
  end
39
45
 
46
+ def get_sata_controller_name
47
+ controllers = Hash.new
48
+ info = execute("showvminfo", @uuid, "--machinereadable", :retryable => true)
49
+ info.split("\n").each do |line|
50
+ controllers[$1] = $2 if line =~ /^storagecontrollername(\d+)="(.*)"/
51
+ sata_controller_number = $1 if line =~ /^storagecontrollertype(\d+)="IntelAhci"/
52
+ return controllers[sata_controller_number] unless controllers[sata_controller_number].nil?
53
+ end
54
+ return nil
55
+ end
56
+
40
57
  end
41
58
  end
42
59
  end
@@ -1,5 +1,5 @@
1
1
  module VagrantPlugins
2
2
  module PersistentStorage
3
- VERSION = "0.0.6"
3
+ VERSION = "0.0.7"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vagrant-persistent-storage
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sebastian Kusnier
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-11-27 00:00:00.000000000 Z
11
+ date: 2014-01-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake