- 积分
- 16844
在线时间 小时
最后登录1970-1-1
|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?开始注册
x
[root@compute01 ~]# vim /etc/sysconfig/libvirtd 修改文件:, n' q" p) l# u
! g9 ?% ?* O( R" t+ v
[root@compute01 ~]# vim /etc/sysconfig/libvirtd
- w+ p; [9 w/ |) eLIBVIRTD_ARGS="--timeout 86400 " #时间设置% y( i/ \0 ^. o! X# ^
LIBVIRTD_CONFIG=/etc/libvirt/libvirtd.conf #配置文件2 q' o. O( ~4 n1 m( k
: k2 }: K$ a1 [' W b z
2 {9 c6 o: M9 x, c0 a[root@compute01 ~]# libvirtd -d- S3 M& K; l) u4 K' y
libvirtd: error: Unable to obtain pidfile. Check /var/log/messages or run without --daemon for more info. 说明已经启动了。5 H/ I2 z& _8 K/ x$ ~ n% H
K" H' i) o/ d5 O" l, ~
[root@compute01 ~]# ps -ef |grep libvirtd 查看进程: t, S5 ]; c( ?4 \
root 9051 1 0 08:47 ? 00:00:00 libvirtd -d: W) r; o8 k% o/ o* h$ Z+ K) i; m
root 9171 2791 0 08:48 pts/1 00:00:00 grep --color=auto libvirtd
$ d9 S8 K. q2 d6 Q6 D/ j( r1 d
$ [8 u' Z* y1 X
停止程序:% m3 S J8 H. K/ ~8 @
[root@compute01 ~]# kill -9 9051% y& A# K9 K# Z7 M$ f% S$ Q1 f" m% w
& s6 R) x* \4 N/ y) m# a( M% e[root@compute01 ~]# ps -ef |grep libvirt+ J @+ V+ j8 C* v
dnsmasq 9124 1 0 08:47 ? 00:00:00 /usr/sbin/dnsmasq --conf-file=/var/lib/libvirt/dnsmasq/default.conf --leasefile-ro --dhcp-script=/usr/libexec/libvirt_leaseshelper X4 z3 X8 F: Z) R+ G
root 9125 9124 0 08:47 ? 00:00:00 /usr/sbin/dnsmasq --conf-file=/var/lib/libvirt/dnsmasq/default.conf --leasefile-ro --dhcp-script=/usr/libexec/libvirt_leaseshelper
4 z: e L2 G6 u( Lroot 9173 2791 0 08:49 pts/1 00:00:00 grep --color=auto libvirt
% X$ L2 P+ O8 ]4 }3 `[root@compute01 ~]# kill -9 9124 9125: G5 U' Y; C3 }" X) J% ?/ c7 w
7 `. R' v/ w6 E( r5 T6 x# N% R' N! `4 y: H
[root@compute01 ~]# ps -ef |grep libvirt
/ l" X* W! A) u8 f, groot 9183 2791 0 08:49 pts/1 00:00:00 grep --color=auto libvirt; W5 Y9 u% x" r! z' N' G
[root@compute01 ~]# ps -ef |grep libvirt9 y6 m. v( d) R" X; T
root 9185 2791 0 08:49 pts/1 00:00:00 grep --color=auto libvirt
( b( [, p* C! c
! r2 N# L9 [: F9 u: U* O$ a: b% @# C# N0 a2 y' M; w* N: y% L
[root@compute01 ~]# virsh list
9 ]# r J. V1 n1 Q% C. [; Xerror: failed to connect to the hypervisor
7 {& h( K( P, Y- p( ~- W7 X6 s/ k: }; J8 k* o; ~5 R
error: Failed to connect socket to '/var/run/libvirt/libvirt-sock': Connection refused
% f. A. d' R8 ?' U) |& r& l4 z+ U" y9 d* I& ^
! y3 Z; [6 P+ Z6 @
检查状态:
4 {1 i) u3 G: X v) x8 J% L8 Q* Q3 @ ?
[root@compute01 ~]# systemctl status libvirtd.service 6 u- \$ A1 h& A5 d8 G/ [5 u
● libvirtd.service - Virtualization daemon
3 x% m5 ]8 X+ F3 w) [ Loaded: loaded (/usr/lib/systemd/system/libvirtd.service; disabled; vendor preset: enabled)
8 d2 \4 Y( s; H! k( d( F5 ^9 ` Active: failed (Result: exit-code) since Sun 2022-05-08 08:47:37 CST; 2min 3s ago4 U; X0 w! G! F. X: N# E
Docs: man:libvirtd(8)
, O7 V8 d6 f! J x5 G2 _ https://libvirt.org
7 Y8 W: F7 Q }3 k: c1 d% I Process: 9028 ExecStart=/usr/sbin/libvirtd $LIBVIRTD_ARGS (code=exited, status=6)
0 j8 e8 ~3 _6 Z9 m" ?2 Y Main PID: 9028 (code=exited, status=6)9 l" t6 {( _, @, `- N+ D
May 08 08:47:37 compute01 systemd[1]: libvirtd.service: Service RestartSec=100ms expired, scheduling restart.- H a. ]' L- d7 U6 i9 L* h
May 08 08:47:37 compute01 systemd[1]: libvirtd.service: Scheduled restart job, restart counter is at 5.# S7 t+ L# ~ `! G X3 w/ |) S
May 08 08:47:37 compute01 systemd[1]: Stopped Virtualization daemon.
* A- k7 E, a, C1 ?% K* V1 qMay 08 08:47:37 compute01 systemd[1]: libvirtd.service: Start request repeated too quickly.
9 Y$ A" H5 y# G7 K$ X- f YMay 08 08:47:37 compute01 systemd[1]: libvirtd.service: Failed with result 'exit-code'.5 B% r* Q/ @ C, d4 z% \
May 08 08:47:37 compute01 systemd[1]: Failed to start Virtualization daemon.& o3 h5 Y3 W& L5 g% [" Y
; _+ N, B. K8 k) P2 ~7 P
启动:
( k3 e6 K- P& A[root@compute01 ~]# systemctl start libvirtd.service 0 q4 D) r) T$ ~! M5 s
& @8 z1 D2 }. @! H" N0 }
0 {/ y0 z" f( l( k) U[root@compute01 ~]# systemctl status libvirtd.service ! {8 `2 w8 w" M
● libvirtd.service - Virtualization daemon
x, h9 ]+ n5 r& a+ w Loaded: loaded (/usr/lib/systemd/system/libvirtd.service; disabled; vendor preset: enabled)
0 z* A% }9 i( g: w9 F9 p Active: active (running) since Sun 2022-05-08 08:49:45 CST; 1s ago
# b2 ^. w2 y q! a( ], A. w6 W Docs: man:libvirtd(8)
: J5 a2 j3 F6 \ https://libvirt.org
) F. V) O4 ?2 k5 Q Main PID: 9196 (libvirtd)4 R7 k' Z. y& P7 ?
Tasks: 21 (limit: 32768)
! ?# T3 Y' A% N' l, o4 e Memory: 14.8M) T6 I0 d9 @. O R, S
CGroup: /system.slice/libvirtd.service/ n% ]: A) z* o2 F; Q4 D9 S: A
├─9196 /usr/sbin/libvirtd --timeout 86400% S4 Y" E. ?" d+ u3 o% e3 l
├─9269 /usr/sbin/dnsmasq --conf-file=/var/lib/libvirt/dnsmasq/default.conf --leasefile-ro --dhcp-scr>7 L, b0 g S; n' q$ V
└─9270 /usr/sbin/dnsmasq --conf-file=/var/lib/libvirt/dnsmasq/default.conf --leasefile-ro --dhcp-scr>6 Q, U7 c5 o. R9 \0 _
May 08 08:49:46 compute01 dnsmasq[9266]: listening on virbr0(#7): 192.168.124.1
/ l. f6 a* W/ d( L* L+ sMay 08 08:49:46 compute01 dnsmasq[9269]: started, version 2.79 cachesize 150
U% Q; S3 \% W* k" jMay 08 08:49:46 compute01 dnsmasq[9269]: compile time options: IPv6 GNU-getopt DBus no-i18n IDN2 DHCP DHCPv6 no>
% D5 [9 U0 a z; ` Q* F* l0 DMay 08 08:49:46 compute01 dnsmasq-dhcp[9269]: DHCP, IP range 192.168.124.2 -- 192.168.124.254, lease time 1h
% g# @1 @* ]" R/ ^May 08 08:49:46 compute01 dnsmasq-dhcp[9269]: DHCP, sockets bound exclusively to interface virbr0
) P: n3 F# _6 x u5 h2 n7 c8 uMay 08 08:49:46 compute01 dnsmasq[9269]: reading /etc/resolv.conf9 `/ @0 l# f; w/ x% P) N$ {; d5 `8 f
May 08 08:49:46 compute01 dnsmasq[9269]: using nameserver 202.106.0.20#53
* b+ D* ]8 D+ O9 H! vMay 08 08:49:46 compute01 dnsmasq[9269]: read /etc/hosts - 4 addresses
/ u9 m/ V' f" A; y- {' ^May 08 08:49:46 compute01 dnsmasq[9269]: read /var/lib/libvirt/dnsmasq/default.addnhosts - 0 addresses I( `4 g; B7 m$ _% p! n! d
May 08 08:49:46 compute01 dnsmasq-dhcp[9269]: read /var/lib/libvirt/dnsmasq/default.hostsfile
' d4 I7 H- j* y4 J( w$ ]7 T
# l! X+ W2 F- M6 S
! h5 s/ F" C* ?* M: M[root@compute01 ~]# virsh list q! v* u; W7 ~9 u- k7 a
Id Name State
8 |5 K1 v6 h. Y, M& r2 {/ C--------------------
4 M' }" B9 x8 w% \) i
8 s4 `: D' x6 A. e
. Y7 N% t$ G; U6 q$ K; M1 v[root@compute01 ~]# ps -ef |grep libirt
* l' l. a! @' F# |root 9296 2791 0 08:50 pts/1 00:00:00 grep --color=auto libirt' x$ D9 Y3 n* z- o4 {4 e/ M
[root@compute01 ~]# ps -ef |grep libvirt
1 [! s( U& ~3 Y( J) \) Troot 9196 1 1 08:49 ? 00:00:00 /usr/sbin/libvirtd --timeout 86400$ n% w. C. j7 ^ @
dnsmasq 9269 1 0 08:49 ? 00:00:00 /usr/sbin/dnsmasq --conf-file=/var/lib/libvirt/dnsmasq/default.conf --leasefile-ro --dhcp-script=/usr/libexec/libvirt_leaseshelper. y, U+ l* B: O/ q' U
root 9270 9269 0 08:49 ? 00:00:00 /usr/sbin/dnsmasq --conf-file=/var/lib/libvirt/dnsmasq/default.conf --leasefile-ro --dhcp-script=/usr/libexec/libvirt_leaseshelper' _/ _# g" h( w1 l& ~9 m+ c. X
root 9300 2791 0 08:50 pts/1 00:00:00 grep --color=auto libvirt
6 `+ {; Y6 K# L) g& O9 \+ j# G( T k, c( r
* u* ?8 T6 s1 f0 J; x% R9 I- z, j+ k
[root@compute01 ~]# virsh list
9 ? O3 x! ]$ G/ i Id Name State
+ U# l4 C2 K6 O+ O# C--------------------
4 Z# K$ ?0 o" F, R[root@compute01 ~]# virsh net-list
: q3 i, i4 r3 d$ w Name State Autostart Persistent
! g: H7 r3 m8 x& g--------------------------------------------/ \2 g& |8 B# p# }% k* }$ t# O! P
default active yes yes6 t% L/ o$ S, A6 I; x" T
5 P# E' X9 Z* x: R& D" [6 Xkvm系统停止default网络:
' C |2 ~ j8 o. ~6 g9 y[root@compute01 ~]# virsh net-destroy default " G% `' a( b! e( B
Network default destroyed
' k: J: Q/ @ Z' g$ T" m7 O9 [8 W; W0 J5 _
启动default网络:
( o" ]& Q* a F7 `2 d[root@compute01 ~]# virsh net-start --network default
3 y1 Z: z" t+ U7 H" D" VNetwork default started. }# m7 j2 B1 k9 ?
/ J2 q% j, Q0 m7 @' W' n/ {8 l[root@compute01 ~]# virsh list
. A: z' l- w- N. B9 Z3 o Id Name State4 k }" P6 y8 i i8 d! o3 P
--------------------+ C5 D0 u8 m4 z& X
! _! z+ E+ K- b0 m2 h" U* M[root@compute01 ~]# virsh net-list ! {2 n2 Z0 U) Z7 w, a2 G
Name State Autostart Persistent% [$ ]1 J4 _8 u( T/ q7 O8 U
--------------------------------------------% p0 F0 v% z6 z) H H q R7 }
default active yes yes2 ], j$ O1 z( _- c* Z
7 p( z; T6 b. |5 T3 g8 y视乎解决了。
4 |5 z- p% G* |/ j$ S! Y+ y T观察下吧。 y0 Y9 H: K- Y# w! q0 @) Z R# ?
|
|