- 积分
- 16840
在线时间 小时
最后登录1970-1-1
|

楼主 |
发表于 2018-12-8 17:56:58
|
显示全部楼层
virsh start vm1368544020451:" k8 S; e# @8 C& C( ^4 _
& E' U" _& Z) x6 l6 c" }9 R error: Failed to start domain vm1368544020451# j! M5 p W2 e/ q/ ]' m
+ V& _6 Q0 q$ p+ U1 \error: internal error process exited while connecting to monitor: kvm: -drive file=/dev/sp1368155439693/v1368544020461,if=none,id=drive-virtio-disk0,format=qcow2: could not open disk image /dev/sp1368155439693/v1368544020461: Invalid argument
' L, x8 }6 p5 f6 w# ?( y! `' Y
8 c4 O/ o- C! X" c/ I镜像格式错误,用qemu-img info 检查镜像和xml配置文件中指定的type是否一致。 {2 @6 U$ n- Q) S3 P4 g+ s
2 r0 X' ^4 R1 ?6 T# @, h# J/ x- d. R0 w( _+ t1 {' c# S; d3 n
error: Failed to start domain vm0
) J2 u' x2 H0 U8 X1 |0 Z2 w/ }/ Z, Z+ Z
error: internal error process exited while connecting to monitor: Could not access KVM kernel module: No such file or directory
0 e, H4 t! @' `2 J+ c' F* `failed to initialize KVM: No such file or directory
& d; \* _3 p/ _ p1 C3 Y" kNo accelerator found!
( l% d% D6 A7 ~0 L% C/ o+ n上面的提示信息就是因为QEMU在初始化阶段因为无法找到kvm内核模块。
, c( J1 T# G8 D4 i X6 R5 P$ N
" @1 |- s8 R1 s7 @sudo modprobe kvm #载入指定的模块2 ?+ L8 t( f: _% n' z
4 ^/ d9 H0 G+ F, | O
重启电脑,进入bios界面,设置advance选项里面的virtualization标签为Enabled
' [; Z2 ]# m6 S7 B$ w3 D1 c7 p- f2 h. }" F# f" l3 C
通过命令 lsmod | grep kvm #显示已载入的模块
0 v9 D0 ?6 _: W* A4 q
; T! u. v! c! c5 v4 T. J 虚拟机迁移:
' p# U6 N% r5 j+ H0 h# I' w: m& j4 K& D
# virsh migrate --live 1 qemu+tcp://192.168.0.121 --p2p --tunnelled --unsafe
9 w+ e! J! E' r! ~# v8 Werror: operation failed: Failed to connect to remote libvirt URI qemu+tcp://192.168.0.121(在URI后面加上/system,‘system’相当于root用户的访问权限)
% z# y+ a( ~8 G* p' F
5 j8 I/ ?* c# \9 d# b0 a6 X#virsh migrate --live 2 qemu+tcp://192.168.0.121/system --p2p --tunnelled H( y+ w% F/ Q2 I0 h
error: Unsafe migration: Migration may lead to data corruption if disks use cache != none(加上--unsafe参数)5 {& b# W8 t8 H: m
7 r% l o0 \( f! V. w! [2 y- z#virsh migrate --live 2 qemu+tcp://192.168.0.121/system --p2p --tunnelled --unsafe 6 o6 `- ]" { z; W
error: Timed out during operation: cannot acquire state change lock (启动虚拟机有时也会遇此错误),需要重启libvirtd进程
) p2 z5 o# l g6 Y. N& f7 z" }- A8 s. L+ _4 J6 |
virsh:
- u+ o$ ^2 F0 Q0 L M+ C+ m/ L9 I0 m) W; q4 `! W+ e
error: Failed to connect socket to '/var/run/libvirt/libvirt-sock': Connection refused(libvirtd 进程没有启动,libvirtd是一个监听客户端请求的进程)1 F% |& j' ]# P$ v2 B1 b8 P
% {7 t( W6 J! t% V6 a6 t
$ virsh -c qemu:///system list$ l7 k; h2 V. D
error: Failed to connect socket to '/var/run/libvirt/libvirt-sock': Permission denied
, [0 P7 b1 s# g7 V4 X6 [" cerror: failed to connect to the hypervisor
# O8 s L9 I6 _* c7 B' y
' G2 L S5 R' @1 P( u( E(当前用户没有权限,修改/etc/libvirt/libvirtd.conf,unix_sock_rw_perms = 0777,使所有用户都有权限读写)( V9 S& g# A" u0 z4 c
( Z/ N' \3 F8 e$ p T2 u' C
启动libvirtd进程出错:
1 a5 j4 m( ?/ {& |( P H$ D
9 U& ? Y# [& B* u/ E) ` /usr/local/sbin/libvirtd -d -l --config /usr/local/etc/libvirt/libvirtd.conf (编译安装的启动方式)' I* |! Z* u$ ?
error:/usr/local/sbin/libvirtd: initialization failed
1 L) I3 T# C, r& f' }$ C' a- l
& X/ s" [' d# x' {try to install libpcap-devel RPM and rebuild libvirt http://comments.gmane.org/gmane.comp.emulators.libvirt/58218
6 w3 R6 J$ N G2 L [0 [- r* v K: L" ?4 [. H H d/ }& l
apt-get install libpcap-dev
2 p7 j, k7 K2 C2 k& F1 B6 W5 F. c/ ^! ] @
上面的方法好像都没有效果,但是尝试了http://wiki.libvirt.org/page/The_daemon_cannot_be_started说的,把配置文件里的
) ?* F1 y, U1 x( i, N8 G" O: [0 k8 N7 e# V( C# j
listen_tls = 0注释取消(更奇怪的问题,在我的客户端链接不对)5 K) b6 ]; `* @
7 B# b8 R; b# m% f3 j启动虚拟机:Connection reset by peer4 U+ c: q9 V2 }- C0 b' I& z
/ N$ J6 \4 m: N% B( Z" Q
virsh start vm13559917671869 `8 ]9 c* p4 ?$ w
error: Failed to start domain vm1355991767186
/ M; K" X* n$ c' B; R xerror: Unable to read from monitor: Connection reset by peer J/ G7 Y: @ O- q( }
% H/ L! _" v0 M% N& F) K
还有可能是这样提示:" R( y3 |! |$ R$ o! \8 {& N/ @/ K
, \: H. G u5 I7 F# D+ A9 D h2 {
error: internal error process exited while connecting to monitor: Failed to allocate 16332619776 B: Cannot allocate memory
& B, W5 h2 ~! U5 \! D/ J l7 Q( [4 V( i) A+ g
这个问题可能是因为为VM分配的内存过大(甚至超过的物理主机的内存大小)
$ a t' `( j1 z0 F6 C
; @9 @! }6 ?% B d- p/ ^; nUnable to load library 'virt': libvirt.so: cannot open shared object file: No such file or directory
: ~* V3 ^! Y8 s+ m: O5 \, e2 ^ Q; A7 }) D
linux 环境:! j8 `# p* Z; a: M; E$ J% h: `: y8 [
ln -s /usr/lib/libvirt.so.0 /usr/lib/libvirt.so) ?2 _7 Q+ | Q( t, t
windows 环境
J& J2 C9 {( s4 c 将libvirt-0.dll改名为virt.dll# ~. u# x3 E/ u+ z& o
: f: P) }, Z: r' R( _6 k) n# virsh undefine vm1354695894990
2 Y: } {: y) u! t5 h) [error: Refusing to undefine while domain managed save image exists; g$ L0 O8 h, K% V( \8 q
* k; b$ _8 x' V' V
http://www.redhat.com/archives/l ... -July/msg01219.html6 B6 [2 {' G! a, N& s" E
. Q. d" X+ Z9 B managedsave4 ~: O, {7 ~: Y( g0 d
* ~1 H1 X2 _% p) `' H
解决办法:virsh undefine $domain --managed-save$ }% s5 Y- Q! \( k) m
' f- ]0 A* q" V3 d) T
在centos下面Define虚拟机时,确实没有/usr/bin/kvm,加软链接% v0 x9 k4 a# u- a' D
error: Failed to define domain from xxx.xml
' S: w. r) Q$ i8 k uerror: Cannot find QEMU binary /usr/bin/kvm: No such file or directory
; J. f7 {2 r( N9 k: }# F0 }( X5 L' _- `) ?# W& {
解决办法:ln -s /usr/libexec/qemu-kvm /usr/bin/kvm
5 Z% w! k v7 H' V( }3 q7 _ |
|