|
|
楼主 |
发表于 2018-12-8 17:56:58
|
显示全部楼层
virsh start vm1368544020451:
: E* \& a0 i* E) Q& [' |$ u/ f0 G& m4 J7 l: G |: M
error: Failed to start domain vm13685440204511 V3 h. |+ j7 H
% U" \9 r- i* f8 @. x, }7 `4 f
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 argument8 {, o. V" |0 F7 j
2 e! Y) R9 ~8 I2 Q
镜像格式错误,用qemu-img info 检查镜像和xml配置文件中指定的type是否一致。
* L7 R8 |) |$ {' n+ p) T
( v# |: Y) ~3 T
! T5 ~/ u% _6 P5 K' T3 Yerror: Failed to start domain vm0
) X+ b1 D, s" U. E$ ^: y
3 o! x* [) J# A1 [error: internal error process exited while connecting to monitor: Could not access KVM kernel module: No such file or directory0 i/ x4 `* M# U8 W% W& Q
failed to initialize KVM: No such file or directory) b8 D( m! R6 A" m# g% l. d
No accelerator found!
# l8 Y% N7 x1 E1 W$ Q( {$ C( P; D: d上面的提示信息就是因为QEMU在初始化阶段因为无法找到kvm内核模块。1 k! x% {, {( N) _
+ ]/ @( ~5 P; M& ]) W. R
sudo modprobe kvm #载入指定的模块( P! N' @( e5 s1 n: P. L) q
6 z) X* D) W$ e/ I9 [重启电脑,进入bios界面,设置advance选项里面的virtualization标签为Enabled: x, S1 k3 E1 A1 z
" M; s a; q4 w% @通过命令 lsmod | grep kvm #显示已载入的模块
* `4 \0 J5 o/ \! y( G; s" }$ f- v% K) H) M9 E4 C8 j" u" S5 g# U1 v2 l2 W
虚拟机迁移:1 \$ d4 D$ L+ j [: N, c& a9 K
- }( t5 K7 \/ U2 T
# virsh migrate --live 1 qemu+tcp://192.168.0.121 --p2p --tunnelled --unsafe * ~( w9 D4 x4 q4 @
error: operation failed: Failed to connect to remote libvirt URI qemu+tcp://192.168.0.121(在URI后面加上/system,‘system’相当于root用户的访问权限)
! ?. H8 M2 O" C5 b. f0 c/ Q% g' ^- L
% n6 U4 o$ p4 M#virsh migrate --live 2 qemu+tcp://192.168.0.121/system --p2p --tunnelled
0 C6 s6 r$ ]+ B. L error: Unsafe migration: Migration may lead to data corruption if disks use cache != none(加上--unsafe参数) a. r* w# p" N9 |- R; | r; k. p
: B2 F1 P2 G Y8 C#virsh migrate --live 2 qemu+tcp://192.168.0.121/system --p2p --tunnelled --unsafe
2 E {7 y1 r5 z# @1 ?/ Q4 rerror: Timed out during operation: cannot acquire state change lock (启动虚拟机有时也会遇此错误),需要重启libvirtd进程& A6 D: F* a/ H! _
2 x$ f" Q$ ]% X8 o7 ]virsh:
9 K5 o1 H9 L8 s/ D8 y. X0 Q( P( R0 @/ R1 V; @8 f
error: Failed to connect socket to '/var/run/libvirt/libvirt-sock': Connection refused(libvirtd 进程没有启动,libvirtd是一个监听客户端请求的进程)
& i7 V% f1 g& ] y, B3 Y2 u4 Y* f+ N- p4 D
$ virsh -c qemu:///system list0 R2 f; @, A6 F- ^: s+ C
error: Failed to connect socket to '/var/run/libvirt/libvirt-sock': Permission denied$ U- } `4 z* r' [: B- T8 ^! Q) t1 ~
error: failed to connect to the hypervisor& [' e2 K1 @% T8 f' R. H
8 y* |9 }6 A r; E% Q(当前用户没有权限,修改/etc/libvirt/libvirtd.conf,unix_sock_rw_perms = 0777,使所有用户都有权限读写)
3 E% M& |2 ~# ` r) Y7 L8 X8 h" n+ Y/ C5 C* B& u$ d9 @& C
启动libvirtd进程出错:5 b& Z R9 r# s6 c2 A0 ?
! P6 T! p: q1 U7 D7 a- U /usr/local/sbin/libvirtd -d -l --config /usr/local/etc/libvirt/libvirtd.conf (编译安装的启动方式)
2 t2 v: Z5 w9 ?2 C* qerror:/usr/local/sbin/libvirtd: initialization failed
: Q/ C5 L; V- l- C! A: ~
6 C t5 E z. e, o7 L9 D) {/ Btry to install libpcap-devel RPM and rebuild libvirt http://comments.gmane.org/gmane.comp.emulators.libvirt/58218
' y; U/ v" P6 Y3 y% J/ U% Y- Y
$ y0 _5 G5 {$ ?" h4 gapt-get install libpcap-dev
9 R8 H) o+ \7 s; h" M/ G$ g, O# I+ h+ ^ v$ m4 p" Q# ~+ E' E
上面的方法好像都没有效果,但是尝试了http://wiki.libvirt.org/page/The_daemon_cannot_be_started说的,把配置文件里的
9 a$ g) d& A5 G, D' c5 V3 x0 H5 p, y. K7 S2 I \
listen_tls = 0注释取消(更奇怪的问题,在我的客户端链接不对)7 M. g/ K) o. K& C2 r( g
% y% s1 }- \$ ?4 \1 E7 T. x$ E: O' h启动虚拟机:Connection reset by peer2 |) V( K7 F; l+ r r
( m: }/ V: v: v" V1 g) Y; t: h
virsh start vm1355991767186
: G4 L! ]& H- Yerror: Failed to start domain vm1355991767186/ |0 o# M3 N" v+ {* `, q+ `% p
error: Unable to read from monitor: Connection reset by peer
3 h% p" f% m' {- X0 W& ~! {, t- X! N; Z) _1 c5 u( L, H
还有可能是这样提示:
# m# {! u+ s* F" z' N% i4 V& v1 H8 `& e5 h, N6 P
error: internal error process exited while connecting to monitor: Failed to allocate 16332619776 B: Cannot allocate memory% h# E7 Y. L' i7 t: d9 M
. |- W# a& y1 A8 p) i2 E* x这个问题可能是因为为VM分配的内存过大(甚至超过的物理主机的内存大小)
0 q- r/ r$ U! m* O" ?: \1 j& a+ l- e
; j: @# D, `% Y9 P1 zUnable to load library 'virt': libvirt.so: cannot open shared object file: No such file or directory
6 N# Y' Q( R. D2 h) _
) [" e. i0 `7 @, z4 W" U6 Jlinux 环境:
0 | w4 k9 r/ t+ l7 y5 N) p a ln -s /usr/lib/libvirt.so.0 /usr/lib/libvirt.so
# f: }- v7 b' d8 B5 m0 V/ X5 Gwindows 环境
! z6 q' `# o3 j$ {3 Y8 i 将libvirt-0.dll改名为virt.dll
2 m, W6 g0 Y* v- e - j) a( J" z; [+ _# E4 i, c
# virsh undefine vm1354695894990$ a) _7 n6 @0 c' E- ]3 ?& G, P) _
error: Refusing to undefine while domain managed save image exists' R2 z$ I) l1 K, b6 M. C ~4 c
3 N; @1 | |4 b+ j8 U9 Fhttp://www.redhat.com/archives/l ... -July/msg01219.html4 o( x8 D! x8 @5 T' r8 {" M8 G
0 o: A+ q) y1 m managedsave
0 c0 D. u' {# u4 k) T0 k$ _9 u3 Q% b+ `, A S+ N/ I+ J- d
解决办法:virsh undefine $domain --managed-save
1 ?0 b% }6 A; v/ y6 t1 R: @/ i
$ ~. v: B G* o/ E# l" d: e在centos下面Define虚拟机时,确实没有/usr/bin/kvm,加软链接
7 X9 L+ {+ V# x3 A: w. Kerror: Failed to define domain from xxx.xml
2 C' g( O; e# B/ uerror: Cannot find QEMU binary /usr/bin/kvm: No such file or directory
- r! y6 R+ d, x( b J
$ r% Y, {3 Q! s. ^解决办法:ln -s /usr/libexec/qemu-kvm /usr/bin/kvm% N6 h- F& J# ]8 J
|
|