Class: VagrantPlugins::ProviderVirtualBox::Driver::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/vagrant-multiprovider-snap/providers/virtualbox/driver/base.rb

Instance Method Summary collapse

Instance Method Details

#snapshot_listObject



20
21
22
23
24
25
26
27
28
29
30
# File 'lib/vagrant-multiprovider-snap/providers/virtualbox/driver/base.rb', line 20

def snapshot_list
    # XXX blows up if no snapshots on the VM - how to prevent this?
    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) ⇒ 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_takeObject



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