// Delete the pool which is created in 'Init' function
166190
func DMCleanup(dm *DeviceMapper) error {
	var parms string
	// Delete the thin pool for test
	parms = fmt.Sprintf("dmsetup remove \"/dev/mapper/%s\"", dm.PoolName)
	if res, err := exec.Command("/bin/sh", "-c", parms).CombinedOutput(); err != nil {
		glog.Error(string(res))
		return fmt.Errorf(string(res))
	}
	// Delete the loop device
	parms = fmt.Sprintf("losetup -d %s", dm.MetadataLoopFile)
	if res, err := exec.Command("/bin/sh", "-c", parms).CombinedOutput(); err != nil {
		glog.Error(string(res))
		return fmt.Errorf(string(res))
	}
	parms = fmt.Sprintf("losetup -d %s", dm.DataLoopFile)
	if res, err := exec.Command("/bin/sh", "-c", parms).CombinedOutput(); err != nil {
		glog.Error(string(res))
		return fmt.Errorf(string(res))
	}
	return nil
}
1157512
func (vn *VecN) destroy() {
	if vn == nil || vn.vec == nil {
		return
	}

	if shouldPool {
		returnToPool(vn.vec)
	}
	vn.vec = nil
}
178306
func (b *BigIP) DeleteGTMAPoolMember(fullPathToAPool, serverFullPath, poolMemberFullPath string) error {
	fullPathToPoolMember := buildPoolMemberFullPath(serverFullPath, poolMemberFullPath)
	return b.delete(uriGtm, uriPool, string(ARecord), fullPathToAPool, uriPoolMember, fullPathToPoolMember)
}
54089
func (p *Pool) Close() {
	p.mutex.Lock()
	defer p.mutex.Unlock()
	if p.closed {
		return
	}
	p.closed = true
	for e := p.l.Front(); e != nil; e = e.Next() {
		conn, _ := e.Value.(*Conn)
		conn.Close()
	}
	p.l.Init()
	p.currentNumberOfConn = p.l.Len()
	p.unusableNumberOfConn = 0
	p.cond.Broadcast()
}
891049
func (s *Server) RemoveResourcePool(poolID string, _ *struct{}) error {
	return s.f.RemoveResourcePool(s.context(), poolID)
}
401223
func (p *Pool) Close() error {
	p.mu.RLock()
	defer p.mu.RUnlock()
	if p.closed {
		return nil
	}

	p.pool.Close()

	return nil
}
506469
func (b *BigIP) RemovePoolMember(pool string, config *PoolMember) error {
	member := config.FullPath
	return b.delete(uriLtm, uriPool, pool, uriPoolMember, member)
}
380210
func (pool *AddressBasedPool) RemoveConn(addr string) {
	pool.Lock()
	if conn, ok := pool.conns[addr]; ok {
		conn.Close()
		delete(pool.conns, addr)
	}
	pool.Unlock()
}
668059
func (p *PoolDevice) RemovePool(ctx context.Context) error {
	deviceNames, err := p.metadata.GetDeviceNames(ctx)
	if err != nil {
		return errors.Wrap(err, "can't query device names")
	}

	var result *multierror.Error

	// Deactivate devices if any
	for _, name := range deviceNames {
		if err := p.DeactivateDevice(ctx, name, true); err != nil {
			result = multierror.Append(result, errors.Wrapf(err, "failed to remove %q", name))
		}
	}

	if err := dmsetup.RemoveDevice(p.poolName, dmsetup.RemoveWithForce, dmsetup.RemoveWithRetries, dmsetup.RemoveDeferred); err != nil {
		result = multierror.Append(result, errors.Wrapf(err, "failed to remove pool %q", p.poolName))
	}

	return result.ErrorOrNil()
}
607527
func (f *sessionUDPFactory) InitPool(msgSize int) {
	f.udpPool.New = func() interface{} {
		return &sessionUDP{
			f:   f,
			m:   make([]byte, msgSize),
			oob: make([]byte, udpOOBSize),
		}
	}
}
284755
func (r *RedisStore) Delete(token string) error {
	conn := r.pool.Get()
	defer conn.Close()

	_, err := conn.Do("DEL", r.prefix+token)
	return err
}
513966
func (c *poolCreateCommand) Init(args []string) (err error) {
	modelType, err := c.ModelType()
	if err != nil {
		return errors.Trace(err)
	}
	if modelType == model.CAAS && len(args) > 0 {
		if len(args) == 1 {
			args = []string{args[0], string(provider.K8s_ProviderType)}
		}
		if strings.Contains(args[1], "=") {
			newArgs := []string{args[0], string(provider.K8s_ProviderType)}
			args = append(newArgs, args[1:]...)
		}
	}
	if len(args) < 2 {
		return errors.New("pool creation requires names, provider type and optional attributes for configuration")
	}

	c.poolName = args[0]
	c.provider = args[1]

	// poolName and provider can contain any character, except for '='.
	// However, the last arguments are always expected to be key=value pairs.
	// Since it's possible for users to mistype, we want to check here for cases
	// such as:
	//    $ juju create-storage-pool poolName key=value
	//    $ juju create-storage-pool key=value poolName
	// as either a provider or a pool name are missing.

	if strings.Contains(c.poolName, "=") || strings.Contains(c.provider, "=") {
		return errors.New("pool creation requires names and provider type before optional attributes for configuration")
	}

	options, err := keyvalues.Parse(args[2:], false)
	if err != nil {
		return err
	}

	c.attrs = make(map[string]interface{})
	if len(options) == 0 {
		return nil
	}
	for key, value := range options {
		c.attrs[key] = value
	}
	return nil
}
152335
func (s *PoolService) NewDeleteStoragePoolParams(id string) *DeleteStoragePoolParams {
	p := &DeleteStoragePoolParams{}
	p.p = make(map[string]interface{})
	p.p["id"] = id
	return p
}
53821
func (p *Project) Delete() error {
	p.Log.Debugf("deleting %d functions", len(p.Functions))

	for _, fn := range p.Functions {
		if _, err := fn.GetConfig(); err != nil {
			if awserr, ok := err.(awserr.Error); ok && awserr.Code() == "ResourceNotFoundException" {
				p.Log.Infof("function %q hasn't been deployed yet or has been deleted manually on AWS Lambda", fn.Name)
				continue
			}
			return fmt.Errorf("function %s: %s", fn.Name, err)
		}

		if err := fn.Delete(); err != nil {
			return fmt.Errorf("function %s: %s", fn.Name, err)
		}
	}

	return nil
}
671064
func (ivs *Intervals) Dispose() {
	for i := 0; i < len(*ivs); i++ {
		(*ivs)[i] = nil
	}

	*ivs = (*ivs)[:0]
	intervalsPool.Put(*ivs)
}
685069
func (s *GeoDirectionalPoolsService) Delete(k GeoDirectionalPoolKey) (*http.Response, error) {
	return s.client.delete(k.URI(), nil)
}
16519
func (p *pool) remove(id uint32) {
	p.Lock()
	defer p.Unlock()
	delete(p.plugins, id)
}