// PowerOn powers on given VM.
193849
func (c *VSphereCloud) PowerOn(vm string) error {
	f := find.NewFinder(c.Client.Client, true)
	ctx, cancel := context.WithCancel(context.Background())
	defer cancel()

	dc, err := f.Datacenter(ctx, c.Datacenter)
	if err != nil {
		return err
	}
	f.SetDatacenter(dc)

	vmRef, err := f.VirtualMachine(ctx, vm)
	if err != nil {
		return err
	}
	task, err := vmRef.PowerOn(ctx)
	if err != nil {
		return err
	}
	task.Wait(ctx)
	return nil
}
165322
func (r Virtual_Guest) GetLastKnownPowerState() (resp datatypes.Virtual_Guest_Power_State, err error) {
	err = r.Session.DoRequest("SoftLayer_Virtual_Guest", "getLastKnownPowerState", nil, &r.Options, &resp)
	return
}
320554
func (_m *Protocol) SetPower(state bool) error {
	ret := _m.Called(state)

	var r0 error
	if rf, ok := ret.Get(0).(func(bool) error); ok {
		r0 = rf(state)
	} else {
		r0 = ret.Error(0)
	}

	return r0
}
737829
func powerOfTwoEqualOrGreater(n int) int {
	if n <= minBlockSize {
		return minBlockSize
	}
	if n&(n-1) == 0 {
		// if n is already power of 2, return it
		return n
	}

	n--
	n = n | (n >> 1)
	n = n | (n >> 2)
	n = n | (n >> 4)
	n = n | (n >> 8)
	n = n | (n >> 16)
	n = n | (n >> 16 >> 16) // make it work with 64 bit int; no effect on 32bit.
	n++

	return n
}
790039
func (vals *ValidatorSet) TotalVotingPower() int64 {
	if vals.totalVotingPower == 0 {
		vals.updateTotalVotingPower()
	}
	return vals.totalVotingPower
}
817517
func (c *engineIPC) Vservers() (map[string]*seesaw.Vserver, error) {
	var vm seesaw.VserverMap
	if err := c.client.Call("SeesawEngine.Vservers", c.ctx, &vm); err != nil {
		return nil, err
	}
	return vm.Vservers, nil
}
103815
func power2(x uint) uint {
	x--
	x |= x >> 1
	x |= x >> 2
	x |= x >> 4
	x |= x >> 8
	x |= x >> 16
	x |= x >> 32
	x++
	return x
}
872269
func (d *HypervPS4Driver) ReplaceVirtualMachineNetworkAdapter(vmName string, virtual bool) error {
	return hyperv.ReplaceVirtualMachineNetworkAdapter(vmName, virtual)
}
1293885
func pow2(v int64) int64 {
	for i := int64(2); i < 1<<62; i *= 2 {
		if i >= v {
			return i
		}
	}
	panic("unreachable")
}
314964
func (vs *Set) ChangePower(id crypto.PublicKey, power *big.Int) *big.Int {
	address := id.GetAddress()
	// Calculate flow into this validator (positive means in, negative means out)
	flow := vs.Flow(id, power)
	vs.totalPower.Add(vs.totalPower, flow)

	if vs.trim && power.Sign() == 0 {
		delete(vs.publicKeys, address)
		delete(vs.powers, address)
	} else {
		vs.publicKeys[address] = crypto.NewAddressable(id)
		vs.powers[address] = new(big.Int).Set(power)
	}
	return flow
}
115949
func PowCross(i int, power float64) featureCross {
	return &functionalCross{
		functionName: "^" + strconv.FormatFloat(power, 'f', -1, 64),
		boundVars:    []int{i},
		crossFn: func(vars []float64) []float64 {

			return []float64{math.Pow(vars[i], power)}
		},
	}
}
1063702
func NewPowerSupplyClass() (PowerSupplyClass, error) {
	fs, err := NewFS(DefaultMountPoint)
	if err != nil {
		return nil, err
	}

	return fs.NewPowerSupplyClass()
}
1026239
func (api *API) VirtualDNS(virtualDNSID string) (*VirtualDNS, error) {
	uri := "/user/virtual_dns/" + virtualDNSID
	res, err := api.makeRequest("GET", uri, nil)
	if err != nil {
		return nil, errors.Wrap(err, errMakeRequestError)
	}

	response := &VirtualDNSResponse{}
	err = json.Unmarshal(res, &response)
	if err != nil {
		return nil, errors.Wrap(err, errUnmarshalError)
	}

	return response.Result, nil
}
52555
func (c *Client) SetPower(state bool) error {
	return c.protocol.SetPower(state)
}
706839
func (m *MotorDriver) IsOn() bool {
	if m.isDigital() {
		return m.CurrentState == 1
	}
	return m.CurrentSpeed > 0
}
690938
func (d *Device) TurnOn(timeout time.Duration) error {
	location := parseLocation(d.Scan.Location)
	_, err := sendSOAP(
		timeout,
		location,
		"urn:Belkin:service:basicevent:1",
		"/upnp/control/basicevent1",
		"SetBinaryState",
		"<BinaryState>1</BinaryState>",
	)
	return err
}
729460
func (vm *VM) Halt() error {
	state, err := vm.GetState()
	if err != nil {
		return err
	}
	if state == lvm.VMHalted {
		return nil
	}
	_, err = runner.RunCombinedError("controlvm", vm.Name, "poweroff")
	if err != nil {
		return lvm.WrapErrors(lvm.ErrStoppingVM, err)
	}
	return nil
}