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, name) ⇒ Object
- #snapshot_take(name) ⇒ Object
Instance Method Details
#has_snapshot? ⇒ Boolean
34 35 36 |
# File 'lib/vagrant-multiprovider-snap/providers/virtualbox/driver/base.rb', line 34 def has_snapshot? snapshot_list.length > 0 end |
#snapshot_list ⇒ Object
23 24 25 26 27 28 29 30 31 32 |
# File 'lib/vagrant-multiprovider-snap/providers/virtualbox/driver/base.rb', line 23 def snapshot_list info = execute("showvminfo", @uuid, "--machinereadable") snapshots = [] info.split("\n").each do |line| if line =~ /^SnapshotName[^=]*="(.+?)"$/ snapshots << $1.to_s end end snapshots end |
#snapshot_rollback(bootmode, name) ⇒ Object
13 14 15 16 17 18 19 20 21 |
# File 'lib/vagrant-multiprovider-snap/providers/virtualbox/driver/base.rb', line 13 def snapshot_rollback(bootmode, name) # don't try to power off if we're already off unless [:poweroff, :aborted].include?(read_state) halt sleep 2 # race condition on locked VMs otherwise? end execute("snapshot", @uuid, "restore", name || snapshot_list.last) start(bootmode) end |
#snapshot_take(name) ⇒ Object
9 10 11 |
# File 'lib/vagrant-multiprovider-snap/providers/virtualbox/driver/base.rb', line 9 def snapshot_take(name) execute("snapshot", @uuid, "take", name || "vagrant-snap-#{Time.now.to_i}", "--pause") end |