// activateDevice activates thin device
346928
func (p *PoolDevice) activateDevice(ctx context.Context, info *DeviceInfo) error {
	if err := p.transition(ctx, info.Name, Activating, Activated, func() error {
		return dmsetup.ActivateDevice(p.poolName, info.Name, info.DeviceID, info.Size, "")
	}); err != nil {
		return errors.Wrapf(err, "failed to activate new thin device %q (dev: %d)", info.Name, info.DeviceID)
	}

	return nil
}
1214920
func (s *CreateAgentInput) SetActivationKey(v string) *CreateAgentInput {
	s.ActivationKey = &v
	return s
}
630027
func createDeviceNode(rootfs string, node *configs.Device, bind bool) error {
	dest := filepath.Join(rootfs, node.Path)
	if err := os.MkdirAll(filepath.Dir(dest), 0755); err != nil {
		return err
	}

	if bind {
		return bindMountDeviceNode(dest, node)
	}
	if err := mknodDevice(dest, node); err != nil {
		if os.IsExist(err) {
			return nil
		} else if os.IsPermission(err) {
			return bindMountDeviceNode(dest, node)
		}
		return err
	}
	return nil
}
508160
func RemoveDevice(name string) error {
	task, err := TaskCreateNamed(deviceRemove, name)
	if task == nil {
		return err
	}

	cookie := new(uint)
	if err := task.setCookie(cookie, 0); err != nil {
		return fmt.Errorf("devicemapper: Can not set cookie: %s", err)
	}
	defer UdevWait(cookie)

	dmSawBusy = false // reset before the task is run
	dmSawEnxio = false
	if err = task.run(); err != nil {
		if dmSawBusy {
			return ErrBusy
		}
		if dmSawEnxio {
			return ErrEnxio
		}
		return fmt.Errorf("devicemapper: Error running RemoveDevice %s", err)
	}

	return nil
}
283171
func DeleteDevice(poolName string, deviceID int) error {
	task, err := TaskCreateNamed(deviceTargetMsg, poolName)
	if task == nil {
		return err
	}

	if err := task.setSector(0); err != nil {
		return fmt.Errorf("devicemapper: Can't set sector %s", err)
	}

	if err := task.setMessage(fmt.Sprintf("delete %d", deviceID)); err != nil {
		return fmt.Errorf("devicemapper: Can't set message %s", err)
	}

	dmSawBusy = false
	dmSawEnoData = false
	if err := task.run(); err != nil {
		if dmSawBusy {
			return ErrBusy
		}
		if dmSawEnoData {
			logrus.Debugf("devicemapper: Device(id: %d) from pool(%s) does not exist", deviceID, poolName)
			return nil
		}
		return fmt.Errorf("devicemapper: Error running DeleteDevice %s", err)
	}
	return nil
}
325739
func (ss *SecretSyncer) ActiveDevices(includeTypesSet DeviceTypeSet) (DeviceKeyMap, error) {
	ss.Lock()
	defer ss.Unlock()
	if ss.keys == nil {
		return nil, fmt.Errorf("no keys")
	}

	if includeTypesSet == nil {
		return nil, fmt.Errorf("need valid includeTypesSet")
	}

	res := make(DeviceKeyMap)
	for k, v := range ss.keys.Devices {
		if v.Status != DeviceStatusActive {
			continue
		}

		if includeTypesSet[v.Type] {
			res[k] = v
		}
	}
	return res, nil
}
940928
func (c *DefaultClient) PublishActivation(activation types.Activation) Token {
	appID := activation.AppID
	devID := activation.DevID
	return c.PublishDeviceEvent(appID, devID, types.ActivationEvent, activation)
}
380979
func (s *CreateIPSetInput) SetActivate(v bool) *CreateIPSetInput {
	s.Activate = &v
	return s
}
396268
func (s *NuageVSPService) AddNuageVspDevice(p *AddNuageVspDeviceParams) (*AddNuageVspDeviceResponse, error) {
	resp, err := s.cs.newRequest("addNuageVspDevice", p.toURLValues())
	if err != nil {
		return nil, err
	}

	var r AddNuageVspDeviceResponse
	if err := json.Unmarshal(resp, &r); err != nil {
		return nil, err
	}

	// If we have a async client, we need to wait for the async result
	if s.cs.async {
		b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout)
		if err != nil {
			if err == AsyncTimeoutErr {
				return &r, err
			}
			return nil, err
		}

		b, err = getRawValue(b)
		if err != nil {
			return nil, err
		}

		if err := json.Unmarshal(b, &r); err != nil {
			return nil, err
		}
	}

	return &r, nil
}
464269
func (r User_Customer_OpenIdConnect) ActivateOpenIdConnectUser(verificationCode *string, userInfo *datatypes.User_Customer, iamId *string) (err error) {
	var resp datatypes.Void
	params := []interface{}{
		verificationCode,
		userInfo,
		iamId,
	}
	err = r.Session.DoRequest("SoftLayer_User_Customer_OpenIdConnect", "activateOpenIdConnectUser", params, &r.Options, &resp)
	return
}
1312799
func (m *Migrator) activateBoltStore() error {
	op := "Moving Bolt file into place"
	m.sendProgress(op, 0, 1)

	if err := os.Rename(m.boltTempPath, m.boltPath); err != nil {
		return err
	}

	m.sendProgress(op, 1, 1)
	return nil
}
295659
func (c *Client) ActivateVCL(i *ActivateVCLInput) (*VCL, error) {
	if i.Service == "" {
		return nil, ErrMissingService
	}

	if i.Version == 0 {
		return nil, ErrMissingVersion
	}

	if i.Name == "" {
		return nil, ErrMissingName
	}

	path := fmt.Sprintf("/service/%s/version/%d/vcl/%s/main", i.Service, i.Version, i.Name)
	resp, err := c.Put(path, nil)
	if err != nil {
		return nil, err
	}

	var vcl *VCL
	if err := decodeJSON(&vcl, resp.Body); err != nil {
		return nil, err
	}
	return vcl, nil
}
569228
func (a *AWSVolumes) releaseDevice(d string, volumeID string) {
	a.mutex.Lock()
	defer a.mutex.Unlock()

	if a.deviceMap[d] != volumeID {
		glog.Fatalf("deviceMap logic error: %q -> %q, not %q", d, a.deviceMap[d], volumeID)
	}
	a.deviceMap[d] = ""
}
194906
func (g *Generator) RemoveDevice(path string) {
	if g.Config == nil || g.Config.Linux == nil || g.Config.Linux.Devices == nil {
		return
	}

	for i, device := range g.Config.Linux.Devices {
		if device.Path == path {
			g.Config.Linux.Devices = append(g.Config.Linux.Devices[:i], g.Config.Linux.Devices[i+1:]...)
			return
		}
	}
}
951728
func DeleteDevice(poolName string, deviceID uint32) error {
	_, err := dmsetup("message", poolName, "0", fmt.Sprintf("delete %d", deviceID))
	return err
}
924535
func attachFileDevice(path string, exec mount.Exec) (string, error) {
	blockDevicePath, err := getLoopDevice(path, exec)
	if err != nil && err.Error() != ErrDeviceNotFound {
		return "", err
	}

	// If no existing loop device for the path, create one
	if blockDevicePath == "" {
		klog.V(4).Infof("Creating device for path: %s", path)
		blockDevicePath, err = makeLoopDevice(path, exec)
		if err != nil {
			return "", err
		}
	}
	return blockDevicePath, nil
}
739402
func (r Account) ActivatePartner(accountId *string, hashCode *string) (resp datatypes.Account, err error) {
	params := []interface{}{
		accountId,
		hashCode,
	}
	err = r.Session.DoRequest("SoftLayer_Account", "activatePartner", params, &r.Options, &resp)
	return
}