Пример #1
0
func vncRecordFB(host, vm, filename string) error {
	c, err := NewVNCClient(host, vm)
	if err != nil {
		return err
	}

	// is this rhost already being recorded?
	if _, ok := vncFBRecording[c.Rhost]; ok {
		return fmt.Errorf("fb recording for %v %v already running", host, vm)
	}

	c.file, err = os.Create(filename)
	if err != nil {
		return err
	}

	c.Conn, err = vnc.Dial(c.Rhost)
	if err != nil {
		return err
	}

	r := &vncFBRecord{c}
	vncFBRecording[c.Rhost] = r

	go r.Run()

	return nil
}
Пример #2
0
func vncPlaybackKB(host, vm, filename string) error {
	c, err := NewVNCClient(host, vm)
	if err != nil {
		return err
	}

	// is this rhost already being recorded?
	if _, ok := vncKBPlaying[c.Rhost]; ok {
		return fmt.Errorf("kb playback for %v %v already running", host, vm)
	}

	c.file, err = os.Open(filename)
	if err != nil {
		return err
	}

	c.Conn, err = vnc.Dial(c.Rhost)
	if err != nil {
		return err
	}

	r := &vncKBPlayback{c}
	vncKBPlaying[c.Rhost] = r

	go r.Run()

	return nil
}
Пример #3
0
func vncRecordFB(vm *KvmVM, filename string) error {
	vncRecordingLock.Lock()
	defer vncRecordingLock.Unlock()

	// is this namespace:vm already being recorded?
	id := fmt.Sprintf("%v:%v", vm.Namespace, vm.Name)
	if _, ok := vncFBRecording[id]; ok {
		return fmt.Errorf("fb recording for %v already running", vm.Name)
	}

	c, err := NewVNCClient(vm)
	if err != nil {
		return err
	}

	c.file, err = os.Create(filename)
	if err != nil {
		return err
	}

	c.Conn, err = vnc.Dial(c.Rhost)
	if err != nil {
		return err
	}

	r := &vncFBRecord{c}
	vncFBRecording[c.ID] = r

	go r.Record()

	return nil
}
Пример #4
0
// Creates a new VNC connection, the initial playback reader, and starts the
// vnc playback
func vncPlaybackKB(vm *KvmVM, filename string) error {
	vncPlayingLock.Lock()
	defer vncPlayingLock.Unlock()

	// Is this playback already running?
	id := fmt.Sprintf("%v:%v", vm.Namespace, vm.Name)
	if _, ok := vncPlaying[id]; ok {
		return fmt.Errorf("kb playback %v already playing", vm.Name)
	}

	c, err := NewVNCClient(vm)
	if err != nil {
		return err
	}

	c.file, err = os.Open(filename)
	if err != nil {
		return err
	}

	c.Conn, err = vnc.Dial(c.Rhost)
	if err != nil {
		return err
	}

	pr := &PlaybackReader{
		file:    c.file,
		scanner: bufio.NewScanner(c.file),
	}

	p := NewVncKbPlayback(c, pr)

	vncPlaying[c.ID] = p

	go p.Play()
	return nil
}