// Destroy destroys the pod container cgroup paths
974612
func (m *podContainerManagerImpl) Destroy(podCgroup CgroupName) error {
	// Try killing all the processes attached to the pod cgroup
	if err := m.tryKillingCgroupProcesses(podCgroup); err != nil {
		klog.V(3).Infof("failed to kill all the processes attached to the %v cgroups", podCgroup)
		return fmt.Errorf("failed to kill all the processes attached to the %v cgroups : %v", podCgroup, err)
	}

	// Now its safe to remove the pod's cgroup
	containerConfig := &CgroupConfig{
		Name:               podCgroup,
		ResourceParameters: &ResourceConfig{},
	}
	if err := m.cgroupManager.Destroy(containerConfig); err != nil {
		return fmt.Errorf("failed to delete cgroup paths for %v : %v", podCgroup, err)
	}
	return nil
}
594542
func (env *environ) Destroy(ctx callcontext.ProviderCallContext) error {
	return env.withSession(ctx, func(env *sessionEnviron) error {
		return env.Destroy(ctx)
	})
}
539429
func (a *Artifact) Destroy() error {
	// Create a new parameter struct.
	p := a.client.Template.NewDeleteTemplateParams(a.template.Id)

	// Destroy the template.
	log.Printf("Destroying template: %s", a.template.Name)
	_, err := a.client.Template.DeleteTemplate(p)
	if err != nil {
		// This is a very poor way to be told the ID does no longer exist :(
		if strings.Contains(err.Error(), fmt.Sprintf(
			"Invalid parameter id value=%s due to incorrect long value format, "+
				"or entity does not exist", a.template.Id)) {
			return nil
		}

		return fmt.Errorf("Error destroying template %s: %s", a.template.Name, err)
	}

	return nil
}
1298866
func (p *provider) Destroy(sid string) {
	p.mu.Lock()
	if sess, found := p.sessions[sid]; found {
		p.deleteSession(sess)
	}
	p.mu.Unlock()
}
42472
func (a *adapter) Destroy(app string) error {
	// Check first if the map of file pointers even contains the file pointer we want so we can avoid
	// waiting for / obtaining a lock unnecessarily
	f, ok := a.files[app]
	if ok {
		// Ensure no other goroutine is trying to modify the file pointer map while we're trying to
		// clean up
		a.mutex.Lock()
		defer a.mutex.Unlock()
		exists, err := fileExists(f.Name())
		if err != nil {
			return err
		}
		if exists {
			if err := os.Remove(f.Name()); err != nil {
				return err
			}
		}
		delete(a.files, app)
	}
	return nil
}
847425
func (env *environ) Destroy(ctx context.ProviderCallContext) error {
	ports, err := env.IngressRules(ctx)
	if err != nil {
		return errors.Trace(err)
	}

	if len(ports) > 0 {
		if err := env.ClosePorts(ctx, ports); err != nil {
			return errors.Trace(err)
		}
	}

	return destroyEnv(env, ctx)
}
1177069
func (n *NodeDevice) Destroy() error {
	var err C.virError
	result := C.virNodeDeviceDestroyWrapper(n.ptr, &err)
	if result == -1 {
		return makeError(&err)
	}
	return nil
}
172625
func (s *Session) Destroy() error {
	if s.m == nil {
		return ErrNotPassMiddleware
	}
	return s.m.Destroy(s)
}
657963
func (rp *Ringpop) Destroy() {
	if rp.node != nil {
		rp.node.Destroy()
	}

	rp.stopTimers()

	rp.setState(destroyed)
}
511192
func (a *Artifact) Destroy() error {
	return a.driver.DeleteImage(context.TODO(), *a.Image.Id)
}
779468
func (vm *VM) Destroy() error {
	s, err := vm.getService()
	if err != nil {
		return err
	}

	return s.delete()
}
1266352
func (vpcApi *VpcApi) Destroy(id string) (bool, error) {
	_, err := vpcApi.entityService.Delete(id, []byte{}, map[string]string{})
	return err == nil, err
}
809907
func (opts *FlushOptions) Destroy() {
	C.rocksdb_flushoptions_destroy(opts.c)
	opts.c = nil
}
1207729
func (p *StoragePool) Destroy() error {
	var err C.virError
	result := C.virStoragePoolDestroyWrapper(p.ptr, &err)
	if result == -1 {
		return makeError(&err)
	}
	return nil
}
703518
func (o *OracleEnviron) Destroy(ctx context.ProviderCallContext) error {
	return common.Destroy(o, ctx)
}
8039
func (window *Window) Destroy() error {
	lastErr := GetError()
	ClearError()
	C.SDL_DestroyWindow(window.cptr())
	err := GetError()
	if err != nil {
		return err
	}
	SetError(lastErr)
	return nil
}
252007
func Destroy(
	controllerName string,
	env ControllerDestroyer,
	ctx context.ProviderCallContext,
	store jujuclient.ControllerStore,
) error {
	details, err := store.ControllerByName(controllerName)
	if errors.IsNotFound(err) {
		// No controller details, nothing to do.
		return nil
	} else if err != nil {
		return errors.Trace(err)
	}
	if err := env.DestroyController(ctx, details.ControllerUUID); err != nil {
		return errors.Trace(err)
	}
	err = store.RemoveController(controllerName)
	if err != nil && !errors.IsNotFound(err) {
		return errors.Trace(err)
	}
	return nil
}