// remove SMB mapping
178545
func removeSMBMapping(remotepath string) (string, error) {
	cmd := exec.Command("powershell", "/c", `Remove-SmbGlobalMapping -RemotePath $Env:smbremotepath -Force`)
	cmd.Env = append(os.Environ(), fmt.Sprintf("smbremotepath=%s", remotepath))
	output, err := cmd.CombinedOutput()
	return string(output), err
}
782839
func (v VolumePathHandler) RemoveMapPath(mapPath string) error {
	if len(mapPath) == 0 {
		return fmt.Errorf("Failed to remove map path. mapPath is empty")
	}
	klog.V(5).Infof("RemoveMapPath: mapPath %s", mapPath)
	err := os.RemoveAll(mapPath)
	if err != nil && !os.IsNotExist(err) {
		return err
	}
	return nil
}
562873
func (r *HashRing) RemoveMembers(members ...membership.Member) bool {
	r.Lock()
	changed := false
	var removed []string
	for _, server := range members {
		if r.removeMemberNoLock(server) {
			removed = append(removed, server.GetAddress())
			changed = true
		}
	}

	if changed {
		r.computeChecksumsNoLock()
		r.EmitEvent(events.RingChangedEvent{
			ServersRemoved: removed,
		})
	}
	r.Unlock()
	return changed
}
1114333
func (client *Client) RemoveInstances(args *RemoveInstancesArgs) (resp *RemoveInstancesResponse, err error) {
	response := RemoveInstancesResponse{}
	err = client.InvokeByFlattenMethod("RemoveInstances", args, &response)

	if err != nil {
		return nil, err
	}
	return &response, nil
}
267052
func (c *ServiceConfigs) Remove(name string) {
	c.mu.Lock()
	delete(c.m, name)
	c.mu.Unlock()
}
42885
func (m ServiceMap) Remove(serviceID string) error {
	if _, ok := m[serviceID]; !ok {
		return fmt.Errorf("service not found")
	}
	delete(m, serviceID)
	return nil
}
50623
func (l *serverList) removeServerByKey(targetKey *metadata.Key) {
	for i, s := range l.servers {
		if targetKey.Equal(s.Key()) {
			copy(l.servers[i:], l.servers[i+1:])
			l.servers[len(l.servers)-1] = nil
			l.servers = l.servers[:len(l.servers)-1]
			return
		}
	}
}
277119
func (uvm *UtilityVM) RemoveVSMB(hostPath string) (err error) {
	op := "uvm::RemoveVSMB"
	log := logrus.WithFields(logrus.Fields{
		logfields.UVMID: uvm.id,
		"host-path":     hostPath,
	})
	log.Debug(op + " - Begin Operation")
	defer func() {
		if err != nil {
			log.Data[logrus.ErrorKey] = err
			log.Error(op + " - End Operation - Error")
		} else {
			log.Debug(op + " - End Operation - Success")
		}
	}()

	if uvm.operatingSystem != "windows" {
		return errNotSupported
	}

	uvm.m.Lock()
	defer uvm.m.Unlock()
	share, err := uvm.findVSMBShare(hostPath)
	if err != nil {
		return fmt.Errorf("%s is not present as a VSMB share in %s, cannot remove", hostPath, uvm.id)
	}

	share.refCount--
	if share.refCount > 0 {
		return nil
	}

	modification := &hcsschema.ModifySettingRequest{
		RequestType:  requesttype.Remove,
		Settings:     hcsschema.VirtualSmbShare{Name: share.name},
		ResourcePath: "VirtualMachine/Devices/VirtualSmb/Shares",
	}
	if err := uvm.Modify(modification); err != nil {
		return fmt.Errorf("failed to remove vsmb share %s from %s: %+v: %s", hostPath, uvm.id, modification, err)
	}

	delete(uvm.vsmbShares, hostPath)
	return nil
}
631173
func (p *partition) remove(key []byte) {
	p.mu.Lock()
	delete(p.store, string(key))
	p.mu.Unlock()
}
1221314
func MapRemoveByKeyListOp(binName string, keys []interface{}, returnType mapReturnType) *Operation {
	return newCDTCreateOperationValue1(_CDT_MAP_REMOVE_KEY_LIST, _MAP_MODIFY, binName, keys, returnType)
}
505495
func (s *inMemStore) Remove(sess Session) {
	s.mux.Lock()
	defer s.mux.Unlock()

	s.logPrintln("Session removed:", sess.ID())
	delete(s.sessions, sess.ID())
}
805181
func (sto *overlayStorage) RemoveBlobs(ctx context.Context, blobs []blob.Ref) error {
	if sto.deleted == nil {
		return blobserver.ErrNotImplemented
	}

	err := sto.upper.RemoveBlobs(ctx, blobs)
	if err != nil {
		return err
	}

	m := sto.deleted.BeginBatch()
	for _, br := range blobs {
		m.Set(br.String(), "1")
	}
	return sto.deleted.CommitBatch(m)
}
506707
func (s *VPCRouterSetting) RemoveDHCPStaticMapping(ipAddress string, macAddress string) {
	if s.DHCPStaticMapping == nil {
		return
	}

	if s.DHCPStaticMapping.Config == nil {
		s.DHCPStaticMapping.Enabled = "False"
		return
	}

	dest := []*VPCRouterDHCPStaticMappingConfig{}
	for _, c := range s.DHCPStaticMapping.Config {
		if c.IPAddress != ipAddress || c.MACAddress != macAddress {
			dest = append(dest, c)
		}
	}
	s.DHCPStaticMapping.Config = dest

	if len(s.DHCPStaticMapping.Config) == 0 {
		s.DHCPStaticMapping.Enabled = "False"
		s.DHCPStaticMapping.Config = nil
		return
	}
	s.DHCPStaticMapping.Enabled = "True"

}
951572
func (m *SecureMap) Remove(key interface{}) {
	m.lock.Lock()
	delete(m.data, key)
	m.lock.Unlock()
}
99380
func (c *Client) RemoveBlobs(ctx context.Context, blobs []blob.Ref) error {
	if c.sto != nil {
		return c.sto.RemoveBlobs(ctx, blobs)
	}
	pfx, err := c.prefix()
	if err != nil {
		return err
	}
	url_ := fmt.Sprintf("%s/camli/remove", pfx)
	params := make(url.Values)             // "blobN" -> BlobRefStr
	needsDelete := make(map[blob.Ref]bool) // BlobRefStr -> true
	for n, b := range blobs {
		if !b.Valid() {
			return errors.New("Cannot delete invalid blobref")
		}
		key := fmt.Sprintf("blob%v", n+1)
		params.Add(key, b.String())
		needsDelete[b] = true
	}

	req, err := http.NewRequest("POST", url_, strings.NewReader(params.Encode()))
	if err != nil {
		return fmt.Errorf("Error creating RemoveBlobs POST request: %v", err)
	}
	req = req.WithContext(ctx)
	req.Header.Add("Content-Type", "application/x-www-form-urlencoded")
	c.authMode.AddAuthHeader(req)
	resp, err := c.httpClient.Do(req)
	if err != nil {
		resp.Body.Close()
		return fmt.Errorf("Got status code %d from blobserver for remove %s", resp.StatusCode, params.Encode())
	}
	var remResp handlers.RemoveResponse
	decodeErr := httputil.DecodeJSON(resp, &remResp)
	if resp.StatusCode != 200 {
		resp.Body.Close()
		if decodeErr == nil {
			return fmt.Errorf("invalid http response %d in remove response: %v", resp.StatusCode, remResp.Error)
		} else {
			return fmt.Errorf("invalid http response %d in remove response", resp.StatusCode)
		}
	}
	if decodeErr != nil {
		return fmt.Errorf("failed to parse remove response: %v", err)
	}
	for _, br := range remResp.Removed {
		delete(needsDelete, br)
	}
	if len(needsDelete) > 0 {
		return fmt.Errorf("failed to remove blobs %s", strings.Join(stringKeys(needsDelete), ", "))
	}
	return nil
}
955106
func (uvm *UtilityVM) RemoveSCSI(hostPath string) (err error) {
	op := "uvm::RemoveSCSI"
	log := logrus.WithFields(logrus.Fields{
		logfields.UVMID: uvm.id,
		"host-path":     hostPath,
	})
	log.Debug(op + " - Begin Operation")
	defer func() {
		if err != nil {
			log.Data[logrus.ErrorKey] = err
			log.Error(op + " - End Operation - Error")
		} else {
			log.Debug(op + " - End Operation - Success")
		}
	}()

	uvm.m.Lock()
	defer uvm.m.Unlock()

	if uvm.scsiControllerCount == 0 {
		return ErrNoSCSIControllers
	}

	// Make sure is actually attached
	controller, lun, uvmPath, err := uvm.findSCSIAttachment(hostPath)
	if err != nil {
		return err
	}

	if uvm.scsiLocations[controller][lun].isLayer {
		uvm.scsiLocations[controller][lun].refCount--
		if uvm.scsiLocations[controller][lun].refCount > 0 {
			return nil
		}
	}

	if err := uvm.removeSCSI(hostPath, uvmPath, controller, lun); err != nil {
		return fmt.Errorf("failed to remove SCSI disk %s from container %s: %s", hostPath, uvm.id, err)

	}
	return nil
}
1249668
func (b *Bulk) Remove(selectors ...interface{}) {
	action := b.action(bulkRemove)
	for _, selector := range selectors {
		if selector == nil {
			selector = bson.D{}
		}
		action.docs = append(action.docs, &deleteOp{
			Collection: b.c.FullName,
			Selector:   selector,
			Flags:      1,
			Limit:      1,
		})
	}
}