vagrant-zfs-box 0.0.2 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +15 -0
- data/LICENSE +22 -0
- data/README.md +64 -0
- data/lib/vagrant_init.rb +1 -0
- data/lib/vagrant_zfs.rb +5 -2
- data/lib/vagrant_zfs/action.rb +4 -0
- data/lib/vagrant_zfs/{actions → action}/box/destroy.rb +0 -0
- data/lib/vagrant_zfs/{actions → action}/box/unpackage.rb +0 -0
- data/lib/vagrant_zfs/{actions → action}/vm/destroy.rb +17 -1
- data/lib/vagrant_zfs/{actions → action}/vm/import.rb +0 -0
- data/lib/vagrant_zfs/zfs.rb +2 -1
- data/vagrant-zfs-box.gemspec +25 -0
- metadata +19 -16
- data/lib/vagrant_zfs/actions.rb +0 -4
- data/lib/vagrant_zfs/version.rb +0 -3
checksums.yaml
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
---
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
YmUyOTBlZWIxODRhYjZlNzg1NjQxY2ZhMTlkNDQ2NTcyZTgwYjY1MA==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
NDFjMzQxZDk3NmY3YWMwNzUzYzY3MjQ3YjY3YzczNTdmMzY3ODZlOA==
|
7
|
+
SHA512:
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
YmZkOGE5ZmFiZTk2ZGNjYzBlNGNhYmYyOTllODA5NmZlZDZiNGM4Y2Y5MzAy
|
10
|
+
YjE5Nzk1NTc4NWZmMjVmMDEwMmM5NWViZjhiYWM3OTQxMTkyZDUzZTBkY2U2
|
11
|
+
YThiOTZmZjU1YzE5YjZiMmEyMWE3ZTFhODBjNDRkNTgyMDExMTQ=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
ZDY4NTgzYWY3NGNjOGRkMWRhMmU4OGFiYjA5Y2E3MzQwYzc3ZjliNjAzOTBl
|
14
|
+
MTNjMjNlZWEyNDkwYWEwYzI0NGMxOGM2MTk4N2MxMWJmNTBkNzVlZmQ0ODM0
|
15
|
+
NjNkODYzMjVmNzQ5NDZlZDEzNGI0ODE0NGY0MjJmOTYyMTJkOTY=
|
data/LICENSE
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2013 Lars Tobias Skjong-Børsting
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,64 @@
|
|
1
|
+
ZFS plugin for Vagrant
|
2
|
+
======================
|
3
|
+
|
4
|
+
This is a plugin for Vagrant that allows you to instantly create and destroy
|
5
|
+
vagrantboxes using the snapshot and clone functionality of the ZFS filesystem.
|
6
|
+
|
7
|
+
Why?
|
8
|
+
====
|
9
|
+
|
10
|
+
To save time when creating and destroying boxes. If you create and destroy many boxes, you probably don't like waiting for the basebox of several hundred megabytes to be copied to the VirtualBox VMs directory. Using this you don't have to wait.
|
11
|
+
|
12
|
+
As an example, on a laptop with an OCZ Vertex 3 240GB SSD and an Intel Core i7 @ 2.6GHz, running "vagrant up" from "not created":
|
13
|
+
|
14
|
+
+--------------------+--------------------------+
|
15
|
+
| Without ZFS plugin | 1 minute 26 seconds |
|
16
|
+
+--------------------+--------------------------+
|
17
|
+
| With ZFS plugin | 20 seconds |
|
18
|
+
+--------------------+--------------------------+
|
19
|
+
|
20
|
+
Usage
|
21
|
+
=====
|
22
|
+
To use the instant-create functionality, you must use a box that was added using the plugin. This can be done the usual way, either:
|
23
|
+
|
24
|
+
vagrant box add base http://files.vagrantup.com/lucid32.box
|
25
|
+
|
26
|
+
or just adding the box_url in the Vagrantfile and just running 'vagrant up'. The 'box add' operation will create a new ZFS filesystem and mount it at
|
27
|
+
|
28
|
+
~/.vagrant.d/boxes/base
|
29
|
+
|
30
|
+
and then the box will be unpacked into that directory. Do the usual 'vagrant init' and add the box name and optionally the box_url.
|
31
|
+
|
32
|
+
require 'vagrant_zfs'
|
33
|
+
Vagrant::Config.run do |config|
|
34
|
+
config.vm.box = "base"
|
35
|
+
config.vm.box_url = "/Volumes/STORE/boxes/lucid32.box"
|
36
|
+
config.zfs.zpool = 'SSD'
|
37
|
+
end
|
38
|
+
|
39
|
+
There is a config option to specify which zpool to use for the filesystem. This is only works when using the 'vagrant up' method.
|
40
|
+
|
41
|
+
To create a new box from this basebox, do it the usual way:
|
42
|
+
|
43
|
+
vagrant up
|
44
|
+
|
45
|
+
This will take a ZFS snapshot of the basebox filesystem, then clone and mount it at:
|
46
|
+
|
47
|
+
~/.vagrant.d/instances/mybox_1360066480
|
48
|
+
|
49
|
+
then create the VM using, register it, attach the disk from the clone and boot it.
|
50
|
+
|
51
|
+
Destroy
|
52
|
+
=======
|
53
|
+
|
54
|
+
To destroy the instance, do as usual:
|
55
|
+
|
56
|
+
vagrant destroy
|
57
|
+
|
58
|
+
This will destroy the box in the usual way, and in addition destroy the ZFS clone and snapshot that were created for it.
|
59
|
+
|
60
|
+
To destroy the basebox, do as usual:
|
61
|
+
|
62
|
+
vagrant box remove base
|
63
|
+
|
64
|
+
This will destroy the ZFS filesystem that was created for it.
|
data/lib/vagrant_init.rb
CHANGED
data/lib/vagrant_zfs.rb
CHANGED
@@ -1,10 +1,13 @@
|
|
1
|
+
module VagrantZFS
|
2
|
+
VERSION = "0.0.4"
|
3
|
+
end
|
4
|
+
|
1
5
|
require 'vagrant'
|
2
6
|
require 'vagrant/action/builder'
|
3
7
|
require 'vagrant_zfs/zfs_config'
|
4
8
|
require 'vagrant_zfs/zfs'
|
5
9
|
require 'vagrant_zfs/vboxmanage'
|
6
|
-
require 'vagrant_zfs/
|
7
|
-
require 'vagrant_zfs/version'
|
10
|
+
require 'vagrant_zfs/action'
|
8
11
|
|
9
12
|
Vagrant.config_keys.register(:zfs) { ZfsConfig }
|
10
13
|
Vagrant.actions[:box_remove].replace(Vagrant::Action::Box::Destroy, VagrantZFS::Action::Box::Destroy)
|
File without changes
|
File without changes
|
@@ -7,7 +7,23 @@ module VagrantZFS
|
|
7
7
|
@app = app
|
8
8
|
end
|
9
9
|
|
10
|
+
def zpool
|
11
|
+
# Is the zpool specified in the Vagrantfile?
|
12
|
+
if @env['global_config'].zfs.zpool
|
13
|
+
@env['global_config'].zfs.zpool
|
14
|
+
else
|
15
|
+
# If we have only one zpool available, go with that.
|
16
|
+
zpools = VagrantZFS::ZFS.zpool_list
|
17
|
+
if zpools.length == 1
|
18
|
+
zpools.first
|
19
|
+
else
|
20
|
+
raise Exception, "zpool not specified and more than one available."
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
10
25
|
def call(env)
|
26
|
+
@env = env
|
11
27
|
env[:ui].info I18n.t("vagrant.actions.vm.destroy.destroying")
|
12
28
|
|
13
29
|
cmd = "VBoxManage showvminfo #{env[:vm].uuid}"
|
@@ -18,7 +34,7 @@ module VagrantZFS
|
|
18
34
|
raise Exception, "Could not find instance name for VM #{env[:vm].uuid}"
|
19
35
|
end
|
20
36
|
|
21
|
-
zpool
|
37
|
+
puts "ZPOOL: #{zpool}"
|
22
38
|
fs = "#{zpool}/vagrant_#{env[:vm].config.vm.box}"
|
23
39
|
clonename = "#{fs}/#{instance_name}"
|
24
40
|
snapname = "#{fs}@#{instance_name}"
|
File without changes
|
data/lib/vagrant_zfs/zfs.rb
CHANGED
@@ -17,7 +17,8 @@ module VagrantZFS
|
|
17
17
|
end
|
18
18
|
|
19
19
|
def self.create fs_name, mountpoint
|
20
|
-
|
20
|
+
zfs_opts="-o atime=off -o compression=lzjb"
|
21
|
+
cmd = "create #{zfs_opts} -o mountpoint=#{mountpoint} #{fs_name}"
|
21
22
|
self.exec cmd
|
22
23
|
end
|
23
24
|
|
@@ -0,0 +1,25 @@
|
|
1
|
+
Gem::Specification.new do |s|
|
2
|
+
s.name = 'vagrant-zfs-box'
|
3
|
+
s.version = '0.0.4'
|
4
|
+
s.date = '2014-01-20'
|
5
|
+
s.summary = "ZFS plugin for Vagrant 1.0"
|
6
|
+
s.description = "ZFS plugin that uses snapshots and clones to speed up box creation for Vagrant 1.0"
|
7
|
+
s.authors = ["Lars Tobias Skjong-Borsting"]
|
8
|
+
s.email = 'larstobi@conduct.no'
|
9
|
+
s.extra_rdoc_files = %w[README.md LICENSE vagrant-zfs-box.gemspec]
|
10
|
+
s.files = %w[
|
11
|
+
lib/vagrant/downloaders/file.rb
|
12
|
+
lib/vagrant_init.rb
|
13
|
+
lib/vagrant_zfs/action/box/destroy.rb
|
14
|
+
lib/vagrant_zfs/action/box/unpackage.rb
|
15
|
+
lib/vagrant_zfs/action/vm/destroy.rb
|
16
|
+
lib/vagrant_zfs/action/vm/import.rb
|
17
|
+
lib/vagrant_zfs/action.rb
|
18
|
+
lib/vagrant_zfs/vboxmanage.rb
|
19
|
+
lib/vagrant_zfs/zfs.rb
|
20
|
+
lib/vagrant_zfs/zfs_config.rb
|
21
|
+
lib/vagrant_zfs.rb
|
22
|
+
]
|
23
|
+
s.homepage =
|
24
|
+
'http://rubygems.org/gems/vagrant-zfs-box'
|
25
|
+
end
|
metadata
CHANGED
@@ -1,57 +1,60 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vagrant-zfs-box
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
5
|
-
prerelease:
|
4
|
+
version: 0.0.4
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Lars Tobias Skjong-Borsting
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 2014-01-20 00:00:00.000000000 Z
|
13
12
|
dependencies: []
|
14
13
|
description: ZFS plugin that uses snapshots and clones to speed up box creation for
|
15
14
|
Vagrant 1.0
|
16
15
|
email: larstobi@conduct.no
|
17
16
|
executables: []
|
18
17
|
extensions: []
|
19
|
-
extra_rdoc_files:
|
18
|
+
extra_rdoc_files:
|
19
|
+
- README.md
|
20
|
+
- LICENSE
|
21
|
+
- vagrant-zfs-box.gemspec
|
20
22
|
files:
|
23
|
+
- LICENSE
|
24
|
+
- README.md
|
21
25
|
- lib/vagrant/downloaders/file.rb
|
22
26
|
- lib/vagrant_init.rb
|
27
|
+
- lib/vagrant_zfs.rb
|
28
|
+
- lib/vagrant_zfs/action.rb
|
29
|
+
- lib/vagrant_zfs/action/box/destroy.rb
|
30
|
+
- lib/vagrant_zfs/action/box/unpackage.rb
|
31
|
+
- lib/vagrant_zfs/action/vm/destroy.rb
|
32
|
+
- lib/vagrant_zfs/action/vm/import.rb
|
33
|
+
- lib/vagrant_zfs/vboxmanage.rb
|
23
34
|
- lib/vagrant_zfs/zfs.rb
|
24
|
-
- lib/vagrant_zfs/version.rb
|
25
|
-
- lib/vagrant_zfs/actions/box/destroy.rb
|
26
|
-
- lib/vagrant_zfs/actions/box/unpackage.rb
|
27
|
-
- lib/vagrant_zfs/actions/vm/destroy.rb
|
28
|
-
- lib/vagrant_zfs/actions/vm/import.rb
|
29
35
|
- lib/vagrant_zfs/zfs_config.rb
|
30
|
-
-
|
31
|
-
- lib/vagrant_zfs/vboxmanage.rb
|
32
|
-
- lib/vagrant_zfs.rb
|
36
|
+
- vagrant-zfs-box.gemspec
|
33
37
|
homepage: http://rubygems.org/gems/vagrant-zfs-box
|
34
38
|
licenses: []
|
39
|
+
metadata: {}
|
35
40
|
post_install_message:
|
36
41
|
rdoc_options: []
|
37
42
|
require_paths:
|
38
43
|
- lib
|
39
44
|
required_ruby_version: !ruby/object:Gem::Requirement
|
40
|
-
none: false
|
41
45
|
requirements:
|
42
46
|
- - ! '>='
|
43
47
|
- !ruby/object:Gem::Version
|
44
48
|
version: '0'
|
45
49
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
46
|
-
none: false
|
47
50
|
requirements:
|
48
51
|
- - ! '>='
|
49
52
|
- !ruby/object:Gem::Version
|
50
53
|
version: '0'
|
51
54
|
requirements: []
|
52
55
|
rubyforge_project:
|
53
|
-
rubygems_version:
|
56
|
+
rubygems_version: 2.2.1
|
54
57
|
signing_key:
|
55
|
-
specification_version:
|
58
|
+
specification_version: 4
|
56
59
|
summary: ZFS plugin for Vagrant 1.0
|
57
60
|
test_files: []
|
data/lib/vagrant_zfs/actions.rb
DELETED
data/lib/vagrant_zfs/version.rb
DELETED