|
|
楼主 |
发表于 2018-12-8 17:56:58
|
显示全部楼层
virsh start vm1368544020451:
3 u7 V% ?1 K* @6 d6 |1 ^9 }* O. f2 v" l4 S8 Q
error: Failed to start domain vm1368544020451% M% V0 o* i( L8 Z R' N4 e
/ N% U) \" g2 a2 Z2 u3 Uerror: 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* a+ [2 Q8 |+ M+ n& _/ v
, X r; {- [1 v
镜像格式错误,用qemu-img info 检查镜像和xml配置文件中指定的type是否一致。
/ `/ F8 u$ E7 v) |$ ~
9 O( y2 ~9 K; t; F* q0 D
) h" M5 |* b# ^error: Failed to start domain vm0# B: W. L7 r+ ?" e
0 s l1 }0 h# f# `" f) t$ `error: internal error process exited while connecting to monitor: Could not access KVM kernel module: No such file or directory
' V! L) f+ t! G; P$ F9 B) D8 Bfailed to initialize KVM: No such file or directory1 I, s4 [+ J _ x
No accelerator found!7 h; m" h% R3 J6 Q- ~+ `* i1 _/ y1 H3 x
上面的提示信息就是因为QEMU在初始化阶段因为无法找到kvm内核模块。
! i9 T: t Y* h0 N
5 v5 n4 f4 s8 I1 }sudo modprobe kvm #载入指定的模块
" K$ H8 Q" D. Y, ^: d6 }. N+ {; }' l6 [; R! d0 ?
重启电脑,进入bios界面,设置advance选项里面的virtualization标签为Enabled
+ h5 h7 q8 S+ N2 y1 W5 e. U
, d6 J6 W' X& _9 G! c% q9 @通过命令 lsmod | grep kvm #显示已载入的模块
0 [- I$ d; T. Y' a- |6 v1 L8 k ~8 ?4 ?. ?6 ~
虚拟机迁移:
2 r* P3 f% x* {+ g9 z
2 o. v. v6 T+ |- V2 o& |# virsh migrate --live 1 qemu+tcp://192.168.0.121 --p2p --tunnelled --unsafe 4 }7 ]( R+ |! h- i9 e# _
error: operation failed: Failed to connect to remote libvirt URI qemu+tcp://192.168.0.121(在URI后面加上/system,‘system’相当于root用户的访问权限)
- _( b. C2 @4 J- h
. b8 O3 q8 D0 u1 I7 W1 x8 T#virsh migrate --live 2 qemu+tcp://192.168.0.121/system --p2p --tunnelled
( O( C5 `7 k3 B* e2 S# S/ a% [2 c9 [ error: Unsafe migration: Migration may lead to data corruption if disks use cache != none(加上--unsafe参数)
; i7 L8 A$ N* Q2 J
& A5 d% I: H; X! Z- E/ g#virsh migrate --live 2 qemu+tcp://192.168.0.121/system --p2p --tunnelled --unsafe 8 n. S3 K4 l. F- |7 {
error: Timed out during operation: cannot acquire state change lock (启动虚拟机有时也会遇此错误),需要重启libvirtd进程9 b: t; H( o- A, {, C8 ?% B
" [( R+ @5 r4 {virsh:
( \7 i3 l3 C( s6 F0 d
' `% L, u! B7 C) W& nerror: Failed to connect socket to '/var/run/libvirt/libvirt-sock': Connection refused(libvirtd 进程没有启动,libvirtd是一个监听客户端请求的进程)
: L; K. A+ \3 @1 d/ I* _0 q. W0 n4 F" i
$ virsh -c qemu:///system list B4 w' u, R2 T$ i- \$ `/ ~7 w) n: R
error: Failed to connect socket to '/var/run/libvirt/libvirt-sock': Permission denied
/ C+ ^5 f+ V' H( ~6 Berror: failed to connect to the hypervisor. z, \2 U' k3 V% o# |& D
3 y7 `$ o1 Y" M$ v9 p
(当前用户没有权限,修改/etc/libvirt/libvirtd.conf,unix_sock_rw_perms = 0777,使所有用户都有权限读写)
' U8 m# H9 D8 y5 H- y0 f+ Y
+ L4 L4 ]# \: w {2 a% ~. U3 d启动libvirtd进程出错:
7 g" J W+ J. x9 C
5 Z/ m5 v7 ?' b5 C) ?2 v3 V- q* Z /usr/local/sbin/libvirtd -d -l --config /usr/local/etc/libvirt/libvirtd.conf (编译安装的启动方式)! j( R2 t" G' h
error:/usr/local/sbin/libvirtd: initialization failed
3 Y8 f- C$ U/ s- ~8 e
, s' ^0 [9 q- G' _$ b# C* F5 H# w2 B2 Rtry to install libpcap-devel RPM and rebuild libvirt http://comments.gmane.org/gmane.comp.emulators.libvirt/58218+ I- _1 _6 G4 z' z! D4 g
3 \; |+ q$ }( i& r# d0 qapt-get install libpcap-dev
& R' ]8 t" T6 W6 C4 n/ w: c& N2 W2 r% J5 A c7 c$ ]
上面的方法好像都没有效果,但是尝试了http://wiki.libvirt.org/page/The_daemon_cannot_be_started说的,把配置文件里的
" J C& J9 F; z
5 e) X w; R+ \# \3 v* g& Olisten_tls = 0注释取消(更奇怪的问题,在我的客户端链接不对)
) m: O/ X/ L2 M( F# n. p; y0 m& N1 F
启动虚拟机:Connection reset by peer5 z' x) B; [4 c5 R' C: l! H
; I! z" P) }- w6 Hvirsh start vm1355991767186# Z$ j5 W, V, _2 r
error: Failed to start domain vm1355991767186
" a) l5 Y4 w( B8 \6 \# perror: Unable to read from monitor: Connection reset by peer
. g" Q5 x6 Y# B- o: E% {0 @3 }$ a g# {5 U( `
还有可能是这样提示:* X3 U! H3 K) t! |! X& Y% D2 o
8 H2 Q9 M6 T% l* ]" i; Berror: internal error process exited while connecting to monitor: Failed to allocate 16332619776 B: Cannot allocate memory
1 S) [0 U/ F% s2 T3 f7 n
9 L7 s* a. A0 B) K这个问题可能是因为为VM分配的内存过大(甚至超过的物理主机的内存大小)
6 h: i3 n( W- E
- |( i, F/ ?& k; P+ i* lUnable to load library 'virt': libvirt.so: cannot open shared object file: No such file or directory
+ {5 ]$ h& a# [4 @( s& V; l5 B3 }9 B! N7 e! [8 ~: C# `
linux 环境:
. W" P$ h* Z( H8 F4 A# L: q, q) M3 n4 H ln -s /usr/lib/libvirt.so.0 /usr/lib/libvirt.so
7 [) e1 o, i( ~windows 环境# C8 O: A4 Z$ O2 E2 f) [
将libvirt-0.dll改名为virt.dll
+ z' i& K# `' C " M( p$ A5 E1 P. }
# virsh undefine vm1354695894990- }* V; V$ Z4 u/ Q, P7 O0 p& J
error: Refusing to undefine while domain managed save image exists
9 w9 e9 P% a5 x4 v/ D
- a* F1 Y, n0 ]: ]! k Ihttp://www.redhat.com/archives/l ... -July/msg01219.html
6 I; y3 k# Z2 y
6 y9 ?6 w- J# O2 e' Q* L$ p managedsave1 b5 X( u* a, J# z& d& O2 k
, Z" g; p! ~$ J1 N解决办法:virsh undefine $domain --managed-save$ \" K! x. g* y. A
- T4 d R3 D0 F- O0 ~- L( \
在centos下面Define虚拟机时,确实没有/usr/bin/kvm,加软链接. _. w8 Q& z7 U: D) W" v8 g) B9 q
error: Failed to define domain from xxx.xml- q& B4 p1 P! l
error: Cannot find QEMU binary /usr/bin/kvm: No such file or directory3 D+ m; H* D' F+ Q: k+ ~9 I+ X" v
0 K5 d: A% O( Z6 m* t1 k解决办法:ln -s /usr/libexec/qemu-kvm /usr/bin/kvm
9 Y X3 F$ t8 ]0 O# ? |
|