How to use the virtualbox.snapshotList 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.checkpointExists = function (checkpointName, callback, dontAddPrefix)
{
    if (!dontAddPrefix)
    {
        checkpointName = VirtualBoxManager.snapshotPrefix + checkpointName;
    }

    if (Config.virtualbox && Config.virtualbox.active)
    {
        const virtualbox = require("virtualbox");
        virtualbox.snapshotList(VirtualBoxManager.vmName, function (error, snapshotList, currentSnapshotUUID)
        {
            if (isNull(error))
            {
                if (snapshotList && snapshotList instanceof Array)
                {
                    const matchingSnapshots = _.filter(snapshotList, function (snapshot)
                    {
                        return snapshot.name === checkpointName;
                    });

                    if (matchingSnapshots.length > 0)
                    {
                        callback(null, true);
                    }
                    else
                    {