// hotAddVHDsAtStart works the same way as hotAddVHDs but does not wait for the VM to start.
171905
func (svm *serviceVM) hotAddVHDsAtStart(mvds ...hcsshim.MappedVirtualDisk) error {
	svm.Lock()
	defer svm.Unlock()
	for i, mvd := range mvds {
		if _, ok := svm.attachedVHDs[mvd.HostPath]; ok {
			svm.attachedVHDs[mvd.HostPath].refCount++
			logrus.Debugf("lcowdriver: UVM %s: %s already present, refCount now %d", svm.config.Name, mvd.HostPath, svm.attachedVHDs[mvd.HostPath].refCount)
			continue
		}

		svm.attachCounter++
		shortContainerPath := remapLongToShortContainerPath(mvd.ContainerPath, svm.attachCounter, svm.config.Name)
		if err := svm.config.HotAddVhd(mvd.HostPath, shortContainerPath, mvd.ReadOnly, !mvd.AttachOnly); err != nil {
			svm.hotRemoveVHDsNoLock(mvds[:i]...)
			return err
		}
		svm.attachedVHDs[mvd.HostPath] = &attachedVHD{refCount: 1, attachCounter: svm.attachCounter}
	}
	return nil
}
1020457
func (s *JobExecutionSummary) SetStartedAt(v time.Time) *JobExecutionSummary {
	s.StartedAt = &v
	return s
}
1145895
func (b *Bucket) StartUprFeedWithConfig(name string, sequence uint32, data_chan_size int, dcp_buffer_size uint32) (*UprFeed, error) {

	feed := &UprFeed{
		bucket:          b,
		output:          make(chan *memcached.UprEvent, data_chan_size),
		quit:            make(chan bool),
		nodeFeeds:       make(map[string]*FeedInfo, 0),
		name:            name,
		sequence:        sequence,
		killSwitch:      make(chan bool),
		dcp_buffer_size: dcp_buffer_size,
		data_chan_size:  data_chan_size,
	}

	err := feed.connectToNodes()
	if err != nil {
		return nil, fmt.Errorf("Cannot connect to bucket %s", err.Error())
	}
	feed.connected = true
	go feed.run()

	feed.C = feed.output
	return feed, nil
}
123800
func (s *AttemptDetail) SetStartedAt(v int64) *AttemptDetail {
	s.StartedAt = &v
	return s
}
1049693
func (s *Service) DynoRestart(ctx context.Context, appIdentity string, dynoIdentity string) (DynoRestartResult, error) {
	var dyno DynoRestartResult
	return dyno, s.Delete(ctx, &dyno, fmt.Sprintf("/apps/%v/dynos/%v", appIdentity, dynoIdentity))
}
788646
func (c *kvmContainer) Start(params StartParams) error {
	var bridge string
	var interfaces []libvirt.InterfaceInfo
	if params.Network != nil {
		if params.Network.NetworkType == container.BridgeNetwork {
			bridge = params.Network.Device
			for _, iface := range params.Network.Interfaces {
				interfaces = append(interfaces, interfaceInfo{config: iface})
			}
		} else {
			err := errors.New("Non-bridge network devices not yet supported")
			logger.Infof(err.Error())
			return err
		}
	}
	logger.Debugf("create the machine %s", c.name)
	if params.StatusCallback != nil {
		_ = params.StatusCallback(status.Provisioning, "Creating instance", nil)
	}
	if err := CreateMachine(CreateMachineParams{
		Hostname:          c.name,
		Series:            params.Series,
		UserDataFile:      params.UserDataFile,
		NetworkConfigData: params.NetworkConfigData,
		NetworkBridge:     bridge,
		Memory:            params.Memory,
		CpuCores:          params.CpuCores,
		RootDisk:          params.RootDisk,
		Interfaces:        interfaces,
	}); err != nil {
		return err
	}

	logger.Debugf("Set machine %s to autostart", c.name)
	if params.StatusCallback != nil {
		_ = params.StatusCallback(status.Provisioning, "Starting instance", nil)
	}
	return AutostartMachine(c)
}
1167093
func VhdToTar(lcowUVM *uvm.UtilityVM, vhdFile string, uvmMountPath string, isContainerScratch bool, vhdSize int64) (io.ReadCloser, error) {
	return nil, fmt.Errorf("not implemented yet")
	//	logrus.Debugf("hcsshim: VhdToTar: %s isScratch: %t", vhdFile, isContainerScratch)

	//	if lcowUVM == nil {
	//		return nil, fmt.Errorf("cannot VhdToTar as no utility VM is in configuration")
	//	}

	//	//defer uvm.DebugLCOWGCS()

	//	vhdHandle, err := os.Open(vhdFile)
	//	if err != nil {
	//		return nil, fmt.Errorf("hcsshim: VhdToTar: failed to open %s: %s", vhdFile, err)
	//	}
	//	defer vhdHandle.Close()
	//	logrus.Debugf("hcsshim: VhdToTar: exporting %s, size %d, isScratch %t", vhdHandle.Name(), vhdSize, isContainerScratch)

	//	// Different binary depending on whether a RO layer or a RW scratch
	//	command := "vhd2tar"
	//	if isContainerScratch {
	//		command = fmt.Sprintf("exportSandbox -path %s", uvmMountPath)
	//	}

	//	//	tar2vhd, byteCounts, err := lcowUVM.CreateProcess(&uvm.ProcessOptions{
	//	//		Process: &specs.Process{Args: []string{"tar2vhd"}},
	//	//		Stdin:   reader,
	//	//		Stdout:  outFile,
	//	//	})

	//	// Start the binary in the utility VM
	//	proc, stdin, stdout, _, err := config.createLCOWUVMProcess(command)
	//	if err != nil {
	//		return nil, fmt.Errorf("hcsshim: VhdToTar: %s: failed to create utils process %s: %s", vhdHandle.Name(), command, err)
	//	}

	//	if !isContainerScratch {
	//		// Send the VHD contents to the utility VM processes stdin handle if not a container scratch
	//		logrus.Debugf("hcsshim: VhdToTar: copying the layer VHD into the utility VM")
	//		if _, err = copyWithTimeout(stdin, vhdHandle, vhdSize, processOperationTimeoutSeconds, fmt.Sprintf("vhdtotarstream: sending %s to %s", vhdHandle.Name(), command)); err != nil {
	//			proc.Close()
	//			return nil, fmt.Errorf("hcsshim: VhdToTar: %s: failed to copyWithTimeout on the stdin pipe (to utility VM): %s", vhdHandle.Name(), err)
	//		}
	//	}

	//	// Start a goroutine which copies the stdout (ie the tar stream)
	//	reader, writer := io.Pipe()
	//	go func() {
	//		defer writer.Close()
	//		defer proc.Close()
	//		logrus.Debugf("hcsshim: VhdToTar: copying tar stream back from the utility VM")
	//		bytes, err := copyWithTimeout(writer, stdout, vhdSize, processOperationTimeoutSeconds, fmt.Sprintf("vhdtotarstream: copy tarstream from %s", command))
	//		if err != nil {
	//			logrus.Errorf("hcsshim: VhdToTar: %s:  copyWithTimeout on the stdout pipe (from utility VM) failed: %s", vhdHandle.Name(), err)
	//		}
	//		logrus.Debugf("hcsshim: VhdToTar: copied %d bytes of the tarstream of %s from the utility VM", bytes, vhdHandle.Name())
	//	}()

	//	// Return the read-side of the pipe connected to the goroutine which is reading from the stdout of the process in the utility VM
	//	return reader, nil
}
22833
func (vm *VM) Start() error {
	src := vm.Src
	dst := vm.Dst

	_, vmxFileName := filepath.Split(src)
	vm.VmxFilePath = fmt.Sprintf("%s/%s", dst, vmxFileName)

	// FIXME: Cannot use nogui flag here, it breaks vmrun's getGuestIP
	// functionality.
	out, err := runner.RunCombinedError("start", vm.VmxFilePath)
	if err != nil {
		return lvm.WrapErrors(err, errors.New(out))
	}

	return nil
}
1323390
func (*SystemdStrategy) autostart(c context.Context, path, user string) error {
	subs := map[string]string{
		"BotCode": path,
		"User":    user,
	}
	s, err := substitute(c, string(GetAsset(systemdTmpl)), subs)
	if err != nil {
		return errors.Annotate(err, "failed to prepare template %q", systemdTmpl).Err()
	}

	logging.Infof(c, "installing: %s", systemdCfg)
	// 0644 allows the systemd config to be read by all users.
	// Useful when SSHing to the instance.
	if err := ioutil.WriteFile(systemdCfg, []byte(s), 0644); err != nil {
		return errors.Annotate(err, "failed to write: %s", systemdCfg).Err()
	}

	// Enable the service so it starts on next boot.
	logging.Infof(c, "enabling %q", systemdSrv)
	if err := exec.Command("systemctl", "enable", systemdSrv).Run(); err != nil {
		return errors.Annotate(err, "failed to enable service %q", systemdSrv).Err()
	}

	// Start the service right now.
	logging.Infof(c, "starting %q", systemdSrv)
	if err := exec.Command("systemctl", "start", systemdSrv).Run(); err != nil {
		return errors.Annotate(err, "failed to start service %q", systemdSrv).Err()
	}
	return nil
}
1262110
func (cli *Client) ContainerExecStart(ctx context.Context, execID string, config types.ExecStartCheck) error {
	resp, err := cli.post(ctx, "/exec/"+execID+"/start", nil, config, nil)
	ensureReaderClosed(resp)
	return err
}
439393
func (_m *APIClient) ContainerExecStart(ctx context.Context, execID string, config types.ExecStartCheck) error {
	ret := _m.Called(ctx, execID, config)

	var r0 error
	if rf, ok := ret.Get(0).(func(context.Context, string, types.ExecStartCheck) error); ok {
		r0 = rf(ctx, execID, config)
	} else {
		r0 = ret.Error(0)
	}

	return r0
}
71320
func (h *JHD1313M1Driver) Start() (err error) {
	bus := h.GetBusOrDefault(h.connector.GetDefaultBus())

	if h.lcdConnection, err = h.connector.GetConnection(h.lcdAddress, bus); err != nil {
		return err
	}

	if h.rgbConnection, err = h.connector.GetConnection(h.rgbAddress, bus); err != nil {
		return err
	}

	// SEE PAGE 45/46 FOR INITIALIZATION SPECIFICATION!
	// according to datasheet, we need at least 40ms after power rises above 2.7V
	// before sending commands. Arduino can turn on way befer 4.5V so we'll wait 50
	time.Sleep(50 * time.Millisecond)

	// this is according to the hitachi HD44780 datasheet
	// page 45 figure 23
	// Send function set command sequence
	init_payload := []byte{LCD_CMD, LCD_FUNCTIONSET | LCD_2LINE}
	if _, err := h.lcdConnection.Write(init_payload); err != nil {
		return err
	}

	// wait more than 4.1ms
	time.Sleep(4500 * time.Microsecond)
	// second try
	if _, err := h.lcdConnection.Write(init_payload); err != nil {
		return err
	}

	time.Sleep(150 * time.Microsecond)
	// third go
	if _, err := h.lcdConnection.Write(init_payload); err != nil {
		return err
	}

	if _, err := h.lcdConnection.Write([]byte{LCD_CMD, LCD_DISPLAYCONTROL | LCD_DISPLAYON}); err != nil {
		return err
	}

	time.Sleep(100 * time.Microsecond)
	if err := h.Clear(); err != nil {
		return err
	}

	if _, err := h.lcdConnection.Write([]byte{LCD_CMD, LCD_ENTRYMODESET | LCD_ENTRYLEFT | LCD_ENTRYSHIFTDECREMENT}); err != nil {
		return err
	}

	if err := h.setReg(0, 0); err != nil {
		return err
	}
	if err := h.setReg(1, 0); err != nil {
		return err
	}
	if err := h.setReg(0x08, 0xAA); err != nil {
		return err
	}

	if err := h.SetRGB(255, 255, 255); err != nil {
		return err
	}

	return nil
}
1190352
func (s *Task) SetStartedAt(v time.Time) *Task {
	s.StartedAt = &v
	return s
}
277806
func (s *JobDetail) SetStartedAt(v int64) *JobDetail {
	s.StartedAt = &v
	return s
}
975716
func (vm *VM) Start() error {
	if vm.MockStart != nil {
		return vm.MockStart()
	}
	return lvm.ErrNotImplemented
}
62887
func (d *HypervPS4Driver) GetVirtualMachineNetworkAdapterAddress(vmName string) (string, error) {
	return hyperv.GetVirtualMachineNetworkAdapterAddress(vmName)
}
266005
func (cache *DiskMDCacheLocal) WaitUntilStarted() error {
	select {
	case <-cache.startedCh:
		return nil
	case <-cache.startErrCh:
		return DiskMDCacheError{"error starting channel"}
	}
}