Sha256: 5d16f85755f17983bf518747dba30cd7905f3205d108dfb87ef3a4aab4f53a77

Contents?: true

Size: 1.05 KB

Versions: 1

Compression:

Stored size: 1.05 KB

Contents

module VagrantPlugins

    module ProviderVirtualBox

        module Driver

            class Base

                def snapshot_take
                    execute("snapshot", @uuid, "take", "vagrant-snap-#{Time.now.to_i}", "--pause")
                end

                def snapshot_rollback(bootmode)
                    halt
                    sleep 2 # race condition on locked VMs otherwise?
                    execute("snapshot",  @uuid, "restore", snapshot_list.first)
                    start(bootmode)
                end

                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

            end

        end

    end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
vagrant-zz-multiprovider-snap-0.0.1 lib/vagrant-multiprovider-snap/providers/virtualbox/driver/base.rb