How to use the virtualbox.snapshotDelete 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
virtualbox.snapshotList(VirtualBoxManager.vmName, function (error, snapshotList, currentSnapshotUUID)
        {
            if (snapshotList && snapshotList instanceof Array)
            {
                const snapshotExists = _.filter(snapshotList, function (snapshot)
                {
                    return snapshot.name === snapshotName;
                }).length > 0;

                if (snapshotExists)
                {
                    const virtualbox = require("virtualbox");
                    virtualbox.snapshotDelete(VirtualBoxManager.vmName, snapshotName, function (error)
                    {
                        if (error) throw error;
                        else
                        {
                            VirtualBoxManager._deletedSnapshots[snapshotName] = true;
                            Logger.log("Snapshot " + snapshotName + " has been deleted!");
                            callback(error);
                        }
                    });
                }
                else
                {
                    callback(null);
                }
            }
            else