vagrant-persistent-storage 0.0.15 → 0.0.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f1753a327642759189697913b1a53f035d39cec9
|
4
|
+
data.tar.gz: dc5f41fd225674a0e8b676fe57f60f21eabb0dc0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ae461e26b183879b7c37289494c56f6b065346a3698da310ed3de76b767d4015328a16fa14378639978c3bb1c2ac72fb4ce556513d69a13d0ebeb6d0d31d3e48
|
7
|
+
data.tar.gz: a1b126e45bbd13065ce7779c1e70923ad1edaf5808d0d05db14f988fd0c724e663856f91512b641ff5ecc7bd3c9fb2da2f9353bff1aac01cab648ce8ecda6788
|
data/README.md
CHANGED
@@ -42,6 +42,17 @@ The disk is initialized and added to it's own volume group as specfied in the co
|
|
42
42
|
this defaults to 'vagrant'. An ext4 filesystem is created and the disk mounted appropriately,
|
43
43
|
with entries added to fstab ... subsequent runs will mount this disk with the options specified
|
44
44
|
|
45
|
+
## Windows Guests
|
46
|
+
|
47
|
+
Windows Guests must use the WinRM communicator by setting `vm.communicator = 'winrm'`. An additional option is provided to
|
48
|
+
allow you to set the drive letter using:
|
49
|
+
|
50
|
+
```
|
51
|
+
config.persistent_storage.drive_letter = 'Z'
|
52
|
+
```
|
53
|
+
|
54
|
+
Options that are irrelevent to Windows are ignored, such as `mountname`, `filesystem`, `mountpoint` and `volgroupname`.
|
55
|
+
|
45
56
|
## Troubleshooting
|
46
57
|
|
47
58
|
If your box are not using LVM you must set `config.persistent_storage.use_lvm = false`.
|
@@ -59,6 +70,7 @@ If your box are not using LVM you must set `config.persistent_storage.use_lvm =
|
|
59
70
|
* [Ciprian Zaharie](https://github.com/bucatzel)
|
60
71
|
* [aishahalim](https://github.com/aishahalim)
|
61
72
|
* [Dick Tang](https://github.com/dictcp)
|
73
|
+
* [dsmaher](https://github.com/dsmaher)
|
62
74
|
|
63
75
|
## TODO
|
64
76
|
|
@@ -18,6 +18,7 @@ module VagrantPlugins
|
|
18
18
|
attr_accessor :diskdevice
|
19
19
|
attr_accessor :filesystem
|
20
20
|
attr_accessor :volgroupname
|
21
|
+
attr_accessor :drive_letter
|
21
22
|
|
22
23
|
alias_method :create?, :create
|
23
24
|
alias_method :mount?, :mount
|
@@ -41,6 +42,7 @@ module VagrantPlugins
|
|
41
42
|
@diskdevice = UNSET_VALUE
|
42
43
|
@filesystem = UNSET_VALUE
|
43
44
|
@volgroupname = UNSET_VALUE
|
45
|
+
@drive_letter = UNSET_VALUE
|
44
46
|
end
|
45
47
|
|
46
48
|
def finalize!
|
@@ -58,6 +60,7 @@ module VagrantPlugins
|
|
58
60
|
@diskdevice = 0 if @diskdevice == UNSET_VALUE
|
59
61
|
@filesystem = 0 if @filesystem == UNSET_VALUE
|
60
62
|
@volgroupname = 0 if @volgroupname == UNSET_VALUE
|
63
|
+
@drive_letter = 0 if @drive_letter == UNSET_VALUE
|
61
64
|
end
|
62
65
|
|
63
66
|
def validate(machine)
|
@@ -113,7 +116,7 @@ module VagrantPlugins
|
|
113
116
|
:is_class => volgroupname.class.to_s,
|
114
117
|
})
|
115
118
|
end
|
116
|
-
|
119
|
+
|
117
120
|
mount_point_path = Pathname.new("#{machine.config.persistent_storage.location}")
|
118
121
|
if ! mount_point_path.absolute?
|
119
122
|
errors << I18n.t('vagrant_persistent_storage.config.not_a_path', {
|
@@ -5,7 +5,6 @@ require 'erb'
|
|
5
5
|
module VagrantPlugins
|
6
6
|
module PersistentStorage
|
7
7
|
module ManageStorage
|
8
|
-
|
9
8
|
def populate_template(m)
|
10
9
|
mnt_name = m.config.persistent_storage.mountname
|
11
10
|
mnt_point = m.config.persistent_storage.mountpoint
|
@@ -18,6 +17,15 @@ module VagrantPlugins
|
|
18
17
|
mount = m.config.persistent_storage.mount
|
19
18
|
format = m.config.persistent_storage.format
|
20
19
|
|
20
|
+
## windows filesystem options
|
21
|
+
drive_letter = m.config.persistent_storage.drive_letter
|
22
|
+
|
23
|
+
if m.config.vm.communicator == :winrm
|
24
|
+
os = "windows"
|
25
|
+
else
|
26
|
+
os = "linux"
|
27
|
+
end
|
28
|
+
|
21
29
|
vg_name = 'vps' unless vg_name != 0
|
22
30
|
disk_dev = '/dev/sdb' unless disk_dev != 0
|
23
31
|
mnt_name = 'vps' unless mnt_name != 0
|
@@ -28,8 +36,25 @@ module VagrantPlugins
|
|
28
36
|
else
|
29
37
|
device = "#{disk_dev}1"
|
30
38
|
end
|
31
|
-
|
32
|
-
|
39
|
+
if drive_letter == 0
|
40
|
+
drive_letter = ""
|
41
|
+
else
|
42
|
+
drive_letter = "letter=#{drive_letter}"
|
43
|
+
end
|
44
|
+
|
45
|
+
if os == "windows"
|
46
|
+
## shell script for windows to create NTFS partition and assign drive letter
|
47
|
+
disk_operations_template = ERB.new <<-EOF
|
48
|
+
<% if format == true %>
|
49
|
+
foreach ($disk in get-wmiobject Win32_DiskDrive -Filter "Partitions = 0"){
|
50
|
+
$disk.DeviceID
|
51
|
+
$disk.Index
|
52
|
+
"select disk "+$disk.Index+"`r clean`r create partition primary`r format fs=ntfs unit=65536 quick`r active`r assign #{drive_letter}" | diskpart >> disk_operation_log.txt
|
53
|
+
}
|
54
|
+
<% end %>
|
55
|
+
EOF
|
56
|
+
else
|
57
|
+
## shell script to format disk, create/manage LVM, mount disk
|
33
58
|
disk_operations_template = ERB.new <<-EOF
|
34
59
|
#!/bin/bash
|
35
60
|
# fdisk the disk if it's not a block device already:
|
@@ -69,24 +94,38 @@ echo "#{mnt_point} mounting returned: $?" >> disk_operation_log.txt
|
|
69
94
|
<% end %>
|
70
95
|
exit $?
|
71
96
|
EOF
|
97
|
+
end
|
72
98
|
|
73
99
|
buffer = disk_operations_template.result(binding)
|
74
|
-
|
75
|
-
|
100
|
+
tmp_script = Tempfile.new("disk_operations_#{mnt_name}.sh")
|
101
|
+
|
102
|
+
if os == 'windows'
|
103
|
+
target_script = "disk_operations_#{mnt_name}.ps1"
|
104
|
+
else
|
105
|
+
target_script = "/tmp/disk_operations_#{mnt_name}.sh"
|
106
|
+
end
|
76
107
|
|
77
108
|
File.open("#{tmp_script.path}", 'wb') do |f|
|
78
109
|
f.write buffer
|
79
110
|
end
|
80
111
|
m.communicate.upload(tmp_script.path, target_script)
|
81
|
-
|
112
|
+
unless os == 'windows'
|
113
|
+
m.communicate.sudo("chmod 755 #{target_script}")
|
114
|
+
end
|
82
115
|
end
|
83
116
|
|
84
117
|
def run_disk_operations(m)
|
85
118
|
return unless m.communicate.ready?
|
86
119
|
mnt_name = m.config.persistent_storage.mountname
|
87
120
|
mnt_name = 'vps' unless mnt_name != 0
|
88
|
-
|
89
|
-
|
121
|
+
if m.config.vm.communicator == :winrm
|
122
|
+
target_script = "disk_operations_#{mnt_name}.ps1"
|
123
|
+
m.communicate.sudo("powershell -executionpolicy bypass -file #{target_script}")
|
124
|
+
else
|
125
|
+
target_script = "/tmp/disk_operations_#{mnt_name}.sh"
|
126
|
+
m.communicate.sudo("#{target_script}")
|
127
|
+
end
|
128
|
+
|
90
129
|
end
|
91
130
|
|
92
131
|
def manage_volumes(m)
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# -*- mode: ruby -*-
|
2
|
+
# vi: set ft=ruby :
|
3
|
+
|
4
|
+
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
|
5
|
+
VAGRANTFILE_API_VERSION = "2"
|
6
|
+
|
7
|
+
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
|
8
|
+
|
9
|
+
# Every Vagrant virtual environment requires a box to build off of.
|
10
|
+
config.vm.box = "myWindowsBox"
|
11
|
+
|
12
|
+
# These are required for Windows machines running under vagrant
|
13
|
+
config.vm.communicator = "winrm"
|
14
|
+
config.winrm.username = "Administrator"
|
15
|
+
config.winrm.password = "Password!"
|
16
|
+
|
17
|
+
# configure a persistent storage for mysql data
|
18
|
+
config.persistent_storage.enabled = true
|
19
|
+
config.persistent_storage.location = "virtualdrive.vdi"
|
20
|
+
config.persistent_storage.size = 5000
|
21
|
+
|
22
|
+
end
|
metadata
CHANGED
@@ -1,41 +1,41 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vagrant-persistent-storage
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.16
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sebastian Kusnier
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-06-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '0'
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rspec
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '0'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- -
|
38
|
+
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
41
|
description: A Vagrant plugin that creates a persistent storage and attaches it to
|
@@ -46,7 +46,7 @@ executables: []
|
|
46
46
|
extensions: []
|
47
47
|
extra_rdoc_files: []
|
48
48
|
files:
|
49
|
-
- .gitignore
|
49
|
+
- ".gitignore"
|
50
50
|
- Gemfile
|
51
51
|
- LICENSE
|
52
52
|
- README.md
|
@@ -67,6 +67,7 @@ files:
|
|
67
67
|
- locales/en.yml
|
68
68
|
- sample-vm/.gitignore
|
69
69
|
- sample-vm/Vagrantfile
|
70
|
+
- sample-win-vm/Vagrantfile
|
70
71
|
- vagrant-persistent-storage.gemspec
|
71
72
|
homepage: https://github.com/kusnier/vagrant-persistent-storage
|
72
73
|
licenses:
|
@@ -78,12 +79,12 @@ require_paths:
|
|
78
79
|
- lib
|
79
80
|
required_ruby_version: !ruby/object:Gem::Requirement
|
80
81
|
requirements:
|
81
|
-
- -
|
82
|
+
- - ">="
|
82
83
|
- !ruby/object:Gem::Version
|
83
84
|
version: '0'
|
84
85
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
85
86
|
requirements:
|
86
|
-
- -
|
87
|
+
- - ">="
|
87
88
|
- !ruby/object:Gem::Version
|
88
89
|
version: '0'
|
89
90
|
requirements: []
|