Class: VagrantZFS::Middleware::CloneZFS
- Inherits:
-
Object
- Object
- VagrantZFS::Middleware::CloneZFS
- Defined in:
- lib/vagrant_zfs/middleware/clone_zfs.rb
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app, env) ⇒ CloneZFS
constructor
A new instance of CloneZFS.
Constructor Details
#initialize(app, env) ⇒ CloneZFS
Returns a new instance of CloneZFS.
4 5 6 |
# File 'lib/vagrant_zfs/middleware/clone_zfs.rb', line 4 def initialize(app, env) @app = app end |
Instance Method Details
#call(env) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/vagrant_zfs/middleware/clone_zfs.rb', line 8 def call(env) uuid = env[:vm].uuid env[:vm].config.zfs.cloned_folders.each do |name, data| source_fs = ZFS(data[:filesystem]) snapshot = source_fs.snapshot(uuid) new_fs = snapshot.clone!("#{data[:filesystem]}-#{uuid}") env[:vm].config.vm.share_folder name, data[:guestpath], new_fs.mountpoint, data[:options] end @app.call(env) end |