// Destroy powers off the VM and deletes its files from disk.
547243
func (vm *VM) Destroy() error {
	err := vm.Halt()
	if err != nil {
		return err
	}

	// vbox will not release it's lock immediately after the stop
	time.Sleep(1 * time.Second)

	_, err = runner.RunCombinedError("unregistervm", vm.Name, "--delete")
	if err != nil {
		return lvm.WrapErrors(lvm.ErrDeletingVM, err)
	}
	return nil
}
484208
func (e *environ) Destroy(ctx context.ProviderCallContext) error {
	if err := common.Destroy(e, ctx); err != nil {
		return errors.Trace(maybeConvertCredentialError(err, ctx))
	}
	if err := e.cleanEnvironmentSecurityGroups(ctx); err != nil {
		return errors.Annotate(maybeConvertCredentialError(err, ctx), "cannot delete environment security groups")
	}
	return nil
}
197991
func (s *sentFolderDownloadState) destroy() []protocol.FileDownloadProgressUpdate {
	updates := make([]protocol.FileDownloadProgressUpdate, 0, len(s.files))
	for name, info := range s.files {
		updates = append(updates, protocol.FileDownloadProgressUpdate{
			Name:       name,
			Version:    info.version,
			UpdateType: protocol.UpdateTypeForget,
		})
		delete(s.files, name)
	}
	return updates
}
1167581
func (n *NomadAgent) Destroy() error {
	if err := n.Stop(); err != nil {
		return err
	}
	return os.RemoveAll(n.DataDir)
}
314619
func (c *Context) Destroy() error {
	c.debug("removing work directory: %v", c.workdir)
	return os.RemoveAll(c.workdir)
}
764870
func (d *AllocDir) Destroy() error {
	// Unmount all mounted shared alloc dirs.
	var mErr multierror.Error
	if err := d.UnmountAll(); err != nil {
		mErr.Errors = append(mErr.Errors, err)
	}

	if err := os.RemoveAll(d.AllocDir); err != nil {
		mErr.Errors = append(mErr.Errors, fmt.Errorf("failed to remove alloc dir %q: %v", d.AllocDir, err))
	}

	// Unset built since the alloc dir has been destroyed.
	d.mu.Lock()
	d.built = false
	d.mu.Unlock()
	return mErr.ErrorOrNil()
}
594542
func (env *environ) Destroy(ctx callcontext.ProviderCallContext) error {
	return env.withSession(ctx, func(env *sessionEnviron) error {
		return env.Destroy(ctx)
	})
}
316051
func (site *Site) Destroy() (*Response, error) {
	resp, err := site.client.Request("DELETE", site.apiPath(), nil, nil)
	if resp != nil && resp.Body != nil {
		resp.Body.Close()
	}
	return resp, err
}
744252
func Destroy(name string, opts *DestroyOpts) error {
	cmd := newCmd("destroy")
	if opts != nil {
		cmd = addOpt(cmd, opts.DestroyChildren, "-r")
		cmd = addOpt(cmd, opts.DestroyClones, "-R")
		cmd = addOpt(cmd, opts.ForceUnmount, "-f")
		cmd = addOpt(cmd, opts.Defer, "-d")
	}
	cmd = addNonEmpty(cmd, name)
	return zExecNoOut(cmd)
}
871526
func (w *Window) Destroy() {
	windows.remove(w.data)
	C.glfwDestroyWindow(w.data)
	panicError()
}
225076
func (d *Domain) Destroy() error {
	var err C.virError
	result := C.virDomainDestroyWrapper(d.ptr, &err)
	if result == -1 {
		return makeError(&err)
	}
	return nil
}
1118890
func jsonnet_destroy(vmRef *C.struct_JsonnetVm) {
	VMs[vmRef.id-1] = nil
	freedIDs = append(freedIDs, uint32(vmRef.id))
	C.jsonnet_internal_free_vm(vmRef)
}
658541
func (f *flexVolumeUnmounter) TearDown() error {
	path := f.GetPath()
	return f.TearDownAt(path)
}
929752
func (s *cinderVolumeSource) DestroyVolumes(ctx context.ProviderCallContext, volumeIds []string) ([]error, error) {
	return foreachVolume(ctx, s.storageAdapter, volumeIds, destroyVolume), nil
}
1205879
func (v *azureVolumeSource) DestroyVolumes(ctx context.ProviderCallContext, volumeIds []string) ([]error, error) {
	if v.maybeStorageClient == nil {
		return v.destroyManagedDiskVolumes(ctx, volumeIds)
	}
	return v.destroyUnmanagedDiskVolumes(ctx, volumeIds)
}
1164061
func (l *Lock) Destroy() error {
	// Hold the lock as we try to release
	l.l.Lock()
	defer l.l.Unlock()

	// Check if we already hold the lock
	if l.isHeld {
		return ErrLockHeld
	}

	// Look for an existing lock
	kv := l.c.KV()
	pair, _, err := kv.Get(l.opts.Key, nil)
	if err != nil {
		return fmt.Errorf("failed to read lock: %v", err)
	}

	// Nothing to do if the lock does not exist
	if pair == nil {
		return nil
	}

	// Check for possible flag conflict
	if pair.Flags != LockFlagValue {
		return ErrLockConflict
	}

	// Check if it is in use
	if pair.Session != "" {
		return ErrLockInUse
	}

	// Attempt the delete
	didRemove, _, err := kv.DeleteCAS(pair, nil)
	if err != nil {
		return fmt.Errorf("failed to remove lock: %v", err)
	}
	if !didRemove {
		return ErrLockInUse
	}
	return nil
}
488132
func (_class VDIClass) Destroy(sessionID SessionRef, self VDIRef) (_err error) {
	_method := "VDI.destroy"
	_sessionIDArg, _err := convertSessionRefToXen(fmt.Sprintf("%s(%s)", _method, "session_id"), sessionID)
	if _err != nil {
		return
	}
	_selfArg, _err := convertVDIRefToXen(fmt.Sprintf("%s(%s)", _method, "self"), self)
	if _err != nil {
		return
	}
	_, _err =  _class.client.APICall(_method, _sessionIDArg, _selfArg)
	return
}