// StartVM starts VM by domain UUID
StartVM starts VM by domain UUID
// StartVM starts VM by domain UUID
func (vt *VMTool) StartVM(domainID string) error {
	domain, err := vt.conn.GetDomainByUUIDString(domainID)
	if err != nil {
		return fmt.Errorf("failed to look up domain(%q): %v", domainID, err)
	}
	state, err := domain.GetState()
	if err != nil {
		return fmt.Errorf("failed to get domain(%q) state: %v", domainID, err)
	}
	if state != DOMAIN_SHUTOFF {
		return fmt.Errorf("unexpected domain(%q) state(%v) when try to StartVM", domainID, state)
	}
	if err = domain.Create(); err != nil {
		return fmt.Errorf("failed to create domain(%q): %v", domainID, err)
	}
	err = wait.PollImmediate(200*time.Millisecond, 10*time.Second, domainRunning(domainID, domain))
	if err == wait.ErrWaitTimeout {
		return fmt.Errorf("timeout(10s) waiting for VM(%s) running", domainID)
	}
	return err
}
func ( vt * VMTool ) StartVM ( domainID string ) error { domain , err := vt . conn . GetDomainByUUIDString ( domainID ) if err != nil { return fmt . Errorf ( " " , domainID , err ) } state , err := domain . GetState ( ) if err != nil { return fmt . Errorf ( " " , domainID , err ) } if state != DOMAIN_SHUTOFF { return fmt . Errorf ( " " , domainID , state ) } if err = domain . Create ( ) ; err != nil { return fmt . Errorf ( " " , domainID , err ) } err = wait . PollImmediate ( 200 * time . Millisecond , 10 * time . Second , domainRunning ( domainID , domain ) ) if err == wait . ErrWaitTimeout { return fmt . Errorf ( " " , domainID ) } return err }
StartVM starts VM by domain UUID
StartVM starts VM by domain UUID
// Get domain // Validate domain state // Create domain // Check domain state