// StopVM stops VM by domain UUID
StopVM stops VM by domain UUID
// StopVM stops VM by domain UUID
func (vt *VMTool) StopVM(domainID string, timeout int64) error {
	domain, err := vt.conn.GetDomainByUUIDString(domainID)
	if err != nil {
		return err
	}
	if timeout == 0 {
		if err = domain.Destroy(); err != nil {
			return fmt.Errorf("failed to destroy domain(%q): %v", domainID, err)
		}
	} else {
		err = wait.PollImmediate(1*time.Second, time.Duration(timeout)*time.Second, domainStopped(domainID, domain))
		if err != nil {
			glog.Warning("Try to destroy VM(%q) due to shutdown VM failed: %v", domainID, err)
			if err = domain.Destroy(); err != nil {
				return fmt.Errorf("failed to destroy domain(%q): %v", domainID, err)
			}
		}
	}
	return nil
}
func ( vt * VMTool ) StopVM ( domainID string , timeout int64 ) error { domain , err := vt . conn . GetDomainByUUIDString ( domainID ) if err != nil { return err } if timeout == 0 { if err = domain . Destroy ( ) ; err != nil { return fmt . Errorf ( " " , domainID , err ) } } else { err = wait . PollImmediate ( 1 * time . Second , time . Duration ( timeout ) * time . Second , domainStopped ( domainID , domain ) ) if err != nil { glog . Warning ( " " , domainID , err ) if err = domain . Destroy ( ) ; err != nil { return fmt . Errorf ( " " , domainID , err ) } } } return nil }
StopVM stops VM by domain UUID
StopVM stops VM by domain UUID
// TODO(Crazykev): cleanup other resources