/v1/server/restore_snapshot
        POST - account
        Restore the specificed snapshot to the virtual machine.
        Any data already on the virtual machine will be lost.

        Link: https://www.vultr.com/api/#server_restore_snapshot
14187
def restore_snapshot(self, subid, snapshotid, params=None):
        ''' 
        '''
        params = update_params(params, {
            'SUBID': subid,
            'SNAPSHOTID': snapshotid
        })
        return self.request('/v1/server/restore_snapshot', params, 'POST')
567970
void restoreFromSnapshot() throws IOException {
    Zxid snapshotZxid = persistence.getSnapshotZxid();
    LOG.debug("The last applied zxid in snapshot is {}", snapshotZxid);
    if (snapshotZxid != Zxid.ZXID_NOT_EXIST &&
        lastDeliveredZxid == Zxid.ZXID_NOT_EXIST) {
      // Restores from snapshot only if the lastDeliveredZxid == ZXID_NOT_EXIST,
      // which means it's the application's first time recovery.
      File snapshot = persistence.getSnapshotFile();
      try (FileInputStream fin = new FileInputStream(snapshot)) {
        LOG.debug("Restoring application's state from snapshot {}", snapshot);
        stateMachine.restore(fin);
        lastDeliveredZxid = snapshotZxid;
      }
    }
  }
860153
@Override
	public Object[] getDatabaseSnapshot(Serializable id, SharedSessionContractImplementor session)
			throws HibernateException {

		if ( log.isTraceEnabled() ) {
			log.trace( "Getting current persistent state for: " + MessageHelper.infoString( this, id, getFactory() ) );
		}

		//snapshot is a Map in the end
		final Tuple resultset = getFreshTuple( EntityKeyBuilder.fromPersister( this, id, session ), session );

		//if there is no resulting row, return null
		if ( resultset == null || resultset.getSnapshot().isEmpty() ) {
			return null;
		}
		//otherwise return the "hydrated" state (ie. associations are not resolved)
		GridType[] types = gridPropertyTypes;
		Object[] values = new Object[types.length];
		boolean[] includeProperty = getPropertyUpdateability();
		for ( int i = 0; i < types.length; i++ ) {
			if ( includeProperty[i] ) {
				values[i] = types[i].hydrate( resultset, getPropertyAliases( "", i ), session, null ); //null owner ok??
			}
		}
		return values;
	}
316898
def get_snapshots
      begin
        @volume.get_volumes(VolumeCopyType::VIRTUAL_COPY)
      rescue => ex
        Util.log_exception(ex, caller_locations(1, 1)[0].label)
        raise ex
      end
    end
1146177
function restoreBackup(backupRecord, mongoUri) {
  var receipts = backupRecord.receipts;
  var handler = getHandler(backupRecord.type);

  var restorePromises = receipts.map(function (receipt) {
    var tmpfile = util.getTempFileName() + '.bson';
    return R.pPipe(
      handler.restore.bind(handler),
      R.curry(R.flip(mds.dump.fs.file))(tmpfile),
      R.curryN(4, mongoRestoreFromFile)(tmpfile, mongoUri, receipt.collection)
    )(receipt.data);
  });

  return q.all(restorePromises).thenResolve('done');
}
89607
def snapshots
      raise Fission::Error,"VM #{@name} does not exist" unless self.exists?

      command = "#{vmrun_cmd} listSnapshots #{vmx_path.shellescape} 2>&1"
      output = `#{command}`

      raise "There was an error listing the snapshots of #{@name} :\n #{output}" unless  $?.exitstatus==0

      snaps_unfiltered = output.split("\n").select { |s| !s.include? 'Total snapshots:' }
      snaps=snaps_unfiltered.map { |s| s.strip }
      return snaps
    end
6809
def cli(env, volume_id, snapshot_id):
    """"""
    block_manager = SoftLayer.BlockStorageManager(env.client)
    success = block_manager.restore_from_snapshot(volume_id, snapshot_id)

    if success:
        click.echo('Block volume %s is being restored using snapshot %s'
                   % (volume_id, snapshot_id))
471906
def restore(self, res_id, backup_snap=None):
        
        name = self._get_name()
        out = self._cli.restore_snap(name, res_id, backup_snap)
        ex.raise_if_err(out, 'failed to restore snap {}.'.format(name),
                        default=ex.VNXSnapError)
498069
def restore(self, trial, checkpoint=None):
        
        if checkpoint is None or checkpoint.value is None:
            checkpoint = trial._checkpoint
        if checkpoint is None or checkpoint.value is None:
            return True
        if trial.runner is None:
            logger.error("Unable to restore - no runner.")
            self.set_status(trial, Trial.ERROR)
            return False
        try:
            value = checkpoint.value
            if checkpoint.storage == Checkpoint.MEMORY:
                assert type(value) != Checkpoint, type(value)
                trial.runner.restore_from_object.remote(value)
            else:
                worker_ip = ray.get(trial.runner.current_ip.remote())
                trial.sync_logger_to_new_location(worker_ip)
                with warn_if_slow("restore_from_disk"):
                    ray.get(trial.runner.restore.remote(value))
            trial.last_result = checkpoint.last_result
            return True
        except Exception:
            logger.exception("Error restoring runner for Trial %s.", trial)
            self.set_status(trial, Trial.ERROR)
            return False
884264
def get_snapshot_table(account):
    """"""
    table = formatting.KeyValueTable(["Name", "Value"], title="Account Snapshot")
    table.align['Name'] = 'r'
    table.align['Value'] = 'l'
    table.add_row(['Company Name', account.get('companyName', '-')])
    table.add_row(['Balance', utils.lookup(account, 'pendingInvoice', 'startingBalance')])
    table.add_row(['Upcoming Invoice', utils.lookup(account, 'pendingInvoice', 'invoiceTotalAmount')])
    table.add_row(['Image Templates', account.get('blockDeviceTemplateGroupCount', '-')])
    table.add_row(['Dedicated Hosts', account.get('dedicatedHostCount', '-')])
    table.add_row(['Hardware', account.get('hardwareCount', '-')])
    table.add_row(['Virtual Guests', account.get('virtualGuestCount', '-')])
    table.add_row(['Domains', account.get('domainCount', '-')])
    table.add_row(['Network Storage Volumes', account.get('networkStorageCount', '-')])
    table.add_row(['Open Tickets', account.get('openTicketCount', '-')])
    table.add_row(['Network Vlans', account.get('networkVlanCount', '-')])
    table.add_row(['Subnets', account.get('subnetCount', '-')])
    table.add_row(['Users', account.get('userCount', '-')])
    return table
498420
public static base_response restore(nitro_service client, systembackup resource) throws Exception {
		systembackup restoreresource = new systembackup();
		restoreresource.filename = resource.filename;
		return restoreresource.perform_operation(client,"restore");
	}
62164
def _pfp__restore_snapshot(self, recurse=True):
        
        super(Struct, self)._pfp__restore_snapshot(recurse=recurse)

        if recurse:
            for child in self._pfp__children:
                child._pfp__restore_snapshot(recurse=recurse)
1167659
def _remove_old_snapshots(connection, volume):
    
    if 'AutomatedEBSSnapshotsRetention' not in volume.tags:
        logger.warning(
            'Missing tag AutomatedEBSSnapshotsRetention for volume {}'.format(
                volume.id))
        return
    retention = int(volume.tags['AutomatedEBSSnapshotsRetention'])

    snapshots = connection.get_all_snapshots(filters={'volume-id': volume.id})

    # Sort the list based on the start time
    snapshots.sort(key=lambda x: x.start_time)

    # Remove snapshots we want to keep
    snapshots = snapshots[:-int(retention)]

    if not snapshots:
        logger.info('No old snapshots to remove')
        return

    for snapshot in snapshots:
        logger.info('Deleting snapshot {}'.format(snapshot.id))
        try:
            snapshot.delete()
        except EC2ResponseError as error:
            logger.warning('Could not remove snapshot: {}'.format(
                error.message))

    logger.info('Done deleting snapshots')
1284132
def restore(self):
        """"""
        if not self._snapshot:
            return
        yield from self.set_muted(self._snapshot['muted'])
        yield from self.set_volume(self._snapshot['volume'])
        yield from self.set_stream(self._snapshot['stream'])
        self.callback()
        _LOGGER.info('restored snapshot of state of %s', self.friendly_name)
929630
def snapshot_delete(repository, snapshot, hosts=None, profile=None):
    '''
    
    '''
    es = _get_instance(hosts, profile)

    try:
        result = es.snapshot.delete(repository=repository, snapshot=snapshot)

        return result.get('acknowledged', False)
    except elasticsearch.NotFoundError:
        return True
    except elasticsearch.TransportError as e:
        raise CommandExecutionError("Cannot delete snapshot {0} from repository {1}, server returned code {2} with message {3}".format(snapshot, repository, e.status_code, e.error))
1246504
@Override
    public Snapshot requestRestoreSnapshot(String snapshotId, DuracloudEndPointConfig destination, String userEmail)
        throws SnapshotException {

        checkInitialized();

        Snapshot snapshot = getSnapshot(snapshotId);

        String host = destination.getHost();
        String port = destination.getPort() + "";
        String storeId = destination.getStoreId();

        String url =
            "http"
            + (port.endsWith("443") ? "s" : "") + "://" + host + ":" + port + "/duradmin/spaces/sm/" + storeId + "/"
            + snapshotId + "?snapshot=true";
        // send email to DuraCloud team to request starting a restore
        String subject = "Snapshot Restoration Request for Snapshot ID = " + snapshotId;
        String format =
            "Please initiate a snapshot restore via the duracloud interface ( {0} ).\n"
            + "\nSnapshot ID: {1}\nHost:{2}\nPort: {3}\nStore ID: {4}\nRequestor email: {5}";
        String body = MessageFormat.format(format, url, snapshotId, host, port, storeId, userEmail);
        String[] duracloudEmailAddresses = this.config.getDuracloudEmailAddresses();
        notificationManager.sendNotification(NotificationType.EMAIL, subject, body, duracloudEmailAddresses);

        log.info("sent email to {}: message body = {}", duracloudEmailAddresses, body);

        return snapshot;
    }
642821
def restore_backup(self, backup, name, flavor, volume):
        
        flavor_ref = self.api._get_flavor_ref(flavor)
        body = {"instance": {
                "name": name,
                "flavorRef": flavor_ref,
                "volume": {"size": volume},
                "restorePoint": {"backupRef": utils.get_id(backup)},
                }}
        uri = "/%s" % self.uri_base
        resp, resp_body = self.api.method_post(uri, body=body)
        return CloudDatabaseInstance(self, resp_body.get("instance", {}))