Class: VagrantPlugins::ProviderVirtualBox::Driver::Base
- Inherits:
-
Object
- Object
- VagrantPlugins::ProviderVirtualBox::Driver::Base
- Defined in:
- lib/vagrant-multiprovider-snap/providers/virtualbox/driver/base.rb
Instance Method Summary collapse
- #has_snapshot? ⇒ Boolean
- #snapshot_list ⇒ Object
- #snapshot_rollback(bootmode) ⇒ Object
- #snapshot_take ⇒ Object
Instance Method Details
#has_snapshot? ⇒ Boolean
31 32 33 |
# File 'lib/vagrant-multiprovider-snap/providers/virtualbox/driver/base.rb', line 31 def has_snapshot? snapshot_list.length > 0 end |
#snapshot_list ⇒ Object
20 21 22 23 24 25 26 27 28 29 |
# File 'lib/vagrant-multiprovider-snap/providers/virtualbox/driver/base.rb', line 20 def snapshot_list info = execute("showvminfo", @uuid, "--machinereadable") snapshots = [] info.split("\n").each do |line| if line =~ /^SnapshotName="(vagrant-snap-.+?)"$/ snapshots << $1.to_s end end snapshots end |
#snapshot_rollback(bootmode) ⇒ Object
13 14 15 16 17 18 |
# File 'lib/vagrant-multiprovider-snap/providers/virtualbox/driver/base.rb', line 13 def snapshot_rollback(bootmode) halt sleep 2 # race condition on locked VMs otherwise? execute("snapshot", @uuid, "restore", snapshot_list.first) start(bootmode) end |
#snapshot_take ⇒ Object
9 10 11 |
# File 'lib/vagrant-multiprovider-snap/providers/virtualbox/driver/base.rb', line 9 def snapshot_take execute("snapshot", @uuid, "take", "vagrant-snap-#{Time.now.to_i}", "--pause") end |