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?(name) ⇒ Boolean
- #snapshot_delete(name) ⇒ Object
- #snapshot_list ⇒ Object
- #snapshot_rollback(bootmode, name) ⇒ Object
- #snapshot_take(name) ⇒ Object
Instance Method Details
#has_snapshot?(name) ⇒ Boolean
38 39 40 41 42 43 44 |
# File 'lib/vagrant-multiprovider-snap/providers/virtualbox/driver/base.rb', line 38 def has_snapshot?(name) if name.nil? return true unless snapshot_list.empty? else return true if snapshot_list.include? "#{name}" end end |
#snapshot_delete(name) ⇒ Object
13 14 15 |
# File 'lib/vagrant-multiprovider-snap/providers/virtualbox/driver/base.rb', line 13 def snapshot_delete(name) execute("snapshot", @uuid, "delete", name) end |
#snapshot_list ⇒ Object
27 28 29 30 31 32 33 34 35 36 |
# File 'lib/vagrant-multiprovider-snap/providers/virtualbox/driver/base.rb', line 27 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
17 18 19 20 21 22 23 24 25 |
# File 'lib/vagrant-multiprovider-snap/providers/virtualbox/driver/base.rb', line 17 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 |