How to use the virtualbox.snapshotTake function in virtualbox

To help you get started, we’ve selected a few virtualbox examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github feup-infolab / dendro / src / utils / virtualbox / vm_manager.js View on Github external
VirtualBoxManager.createCheckpoint = function (checkpointName, callback, dontAddPrefix)
{
    if (!dontAddPrefix)
    {
        checkpointName = VirtualBoxManager.snapshotPrefix + checkpointName;
    }

    if (Config.virtualbox && Config.virtualbox.active && Config.virtualbox.create_snapshots)
    {
        const virtualbox = require("virtualbox");
        virtualbox.snapshotTake(VirtualBoxManager.vmName, checkpointName, function (error, uuid)
        {
            if (error)
            {
                callback(1, "Error taking snapshot!");
            }
            else
            {
                if (uuid)
                {
                    console.log("Snapshot has been taken!");
                    console.log("UUID: ", uuid);
                    callback(null);
                }
                else
                {
                    callback(2, "Null checkpoint id returned when creating a new checkpoint!");