找回密码
 注册
查看: 549|回复: 0

virsh define Uniontechos.xml 创建kvm虚机

[复制链接]

1

主题

0

回帖

12

积分

管理员

积分
12
QQ
发表于 2022-9-26 15:00:01 | 显示全部楼层 |阅读模式
[root@compute03 ~]# qemu-img create /var/lib/libvirt/images/uniontechos2.raw +4G
% ?* ~0 w- p7 k" e2 |. oFormatting '/var/lib/libvirt/images/uniontechos2.raw', fmt=raw size=4294967296
( Z' }: O& j9 y; F% L' c[root@compute03 ~]# vim Uniontechos.xml * F2 @4 U5 `( }* H1 X5 u: e/ M
[root@compute03 ~]# virsh define Uniontechos.xml # O. J8 A4 B, P" D9 z' _
error: Failed to define domain from Uniontechos.xml
' j$ \* d& r2 t, x2 _/ Aerror: XML error: unable to parse mac address ''( U3 q) C5 n1 p2 Y! n
; X2 g, ^  `& p9 N5 V6 ]$ y2 _
[root@compute03 ~]# vim Uniontechos.xml
$ l! H' X9 N5 _) W7 l5 A+ c[root@compute03 ~]# virsh define Uniontechos.xml ' Y/ M# K7 c& L4 }( p
error: Failed to define domain from Uniontechos.xml$ L+ E. x* ~8 b6 l1 H" w2 w- w
error: (domain_definition):72: AttValue: " or ' expected" x8 z5 k. A% S$ L$ z& P+ C2 i  h
      <mac address=/>9 i' K% f5 o6 p  G, d
-------------------^) p- _0 b7 @( \( S1 K

7 L. k3 I, b- ^8 z0 {[root@compute03 ~]# vim Uniontechos.xml 2 E+ W% L5 y% ^7 n
[root@compute03 ~]# virsh define Uniontechos.xml
) u0 q( m: E0 t  A' C4 h+ `error: Failed to define domain from Uniontechos.xml
( q) p! A4 ^+ ?: Terror: XML error: unable to parse mac address ' '- Z/ m6 N/ |+ e9 z

' J' U7 S. ~( J" ?0 o4 `' T[root@compute03 ~]# vim Uniontechos.xml 6 M, C" l6 y( ?) B7 v  ^
[root@compute03 ~]# virsh define Uniontechos.xml " R9 t/ l3 ~. N" V- H% e# N9 {
error: Failed to define domain from Uniontechos.xml
; d" W4 P% o4 D- L+ \4 Gerror: XML error: unable to parse mac address ''3 ~% E0 {% S# R" p7 S; @. j( P

5 H; H; k7 a5 g( L5 ]/ [2 h* P[root@compute03 ~]# vim Uniontechos.xml
" e! o' S# e/ i8 N. c[root@compute03 ~]# virsh define Uniontechos.xml   P0 X8 n7 m+ k9 I% c$ G9 ]- w0 }
error: Failed to define domain from Uniontechos.xml% n* G' _& F- O1 Y- k, z  ]3 H
error: XML error: unable to parse mac address ''
" O6 `8 i! J; R+ P. i* _" A- B* w" E" U4 p% M
[root@compute03 ~]# vim Uniontechos.xml
: T% y. Z' n/ g/ j[root@compute03 ~]# virsh define Uniontechos.xml
  I$ v, x. @$ c) P7 _3 jDomain Uniontechos2 defined from Uniontechos.xml  P, |' M7 w& V; K/ y
% V/ B) H1 T4 X2 s7 k
[root@compute03 ~]#
2 f( s- I1 |# b3 T7 }$ `# S# I1 \+ b: Q/ Q3 y! P) E' o' o! [3 h

7 j# ~% V$ b( ~2 S9 J- N7 E( h# `0 E" F! }
[root@compute03 ~]# cat Uniontechos.xml - h0 B  K- E, `4 {1 X8 q. Y/ h. O; [
<domain type='kvm'>9 j4 z+ {& Q( F/ ?% D% X
  <name>Uniontechos2</name>2 [" A6 R$ M& m3 [
  <uuid></uuid>
: Q6 w; ?  G5 X  <memory unit='KiB'>8388608</memory>* Z) o' e% H. p3 T  k0 ^
  <currentMemory unit='KiB'>8388608</currentMemory>
' q8 H6 W. N# ]6 R% m  <vcpu placement='static'>4</vcpu>
( ^, H6 M& G8 Q$ t% t  <os>4 s' \+ S# q6 f8 }! s
    <type arch='x86_64' machine='pc-i440fx-rhel7.0.0'>hvm</type>
3 O; _+ d  e6 r7 f    <bootmenu enable='yes'/>; e6 z4 r& r7 r* y
  </os>, A3 M: j2 Q- l" K7 Y9 f7 X' ]
  <features>9 n+ v' V( ~& d3 D
    <acpi/>7 e) I: H% y+ v6 v
    <apic/>
3 |6 F  O8 q1 c3 s  </features>
, U7 s5 I7 }0 T1 A. P: z  <cpu mode='custom' match='exact' check='partial'>
* a/ b/ c; ]0 [! C: F    <model fallback='allow'>IvyBridge-IBRS</model>
3 \5 S6 I5 P& @1 d! J    <feature policy='require' name='md-clear'/>8 ]9 A7 j+ \- s. Q
    <feature policy='require' name='spec-ctrl'/>" N5 g1 f" X4 O$ @4 @
    <feature policy='require' name='ssbd'/>3 a: u- \7 J5 \: i) ]1 A/ N
  </cpu>
8 t  H/ E) }. N& e  <clock offset='utc'>
( Y. e. l1 F! N9 s    <timer name='rtc' tickpolicy='catchup'/># r5 T0 H+ N7 Q3 X1 U
    <timer name='pit' tickpolicy='delay'/>
8 G& D+ i( t) v. _* O    <timer name='hpet' present='no'/>8 |* _* P# U+ F6 v, x1 P
  </clock>
, h" j* ]+ o, u8 x6 {3 M  <on_poweroff>destroy</on_poweroff># i- D( @9 |, k8 u+ N( K$ ~' q
  <on_reboot>restart</on_reboot>
4 \" \  F9 h3 R, [* B! x4 A  <on_crash>destroy</on_crash>
5 y# z' v0 W# n0 e# Y  {  <pm>
0 Y3 O" ~; \* a2 P0 ^    <suspend-to-mem enabled='no'/>2 S4 c8 I6 Y' l$ A
    <suspend-to-disk enabled='no'/>6 A  H7 j1 G2 r. |
  </pm>* m5 [" l3 B, U2 C* }% j6 D; b
  <devices>$ d3 I+ V3 N7 M, r$ n! |! S5 _
    <emulator>/usr/libexec/qemu-kvm</emulator>9 n/ Y& O9 F+ F' a6 g
    <disk type='file' device='disk'>' l4 @2 i4 Z( z. ]1 p
      <driver name='qemu' type='raw'/>2 @, G9 L4 L4 e$ n
      <source file='/var/lib/libvirt/images/uniontechos2.raw'/>
, @# @6 U7 ?$ n      <target dev='vda' bus='virtio'/>$ }9 F! q, Q8 ]  p, r' ?' l' E$ m
      <boot order='1'/>! V& v4 u# g4 i
      <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/>
7 L* M+ ~( c. k+ W    </disk>, W9 d. P3 b9 V) R, v1 g( o
    <disk type='file' device='cdrom'>
% s4 \* B9 x* K7 a/ v( H      <driver name='qemu' type='raw'/>1 u- E  h! J( X2 f( u
      <source file='/var/lib/libvirt/images/uniontechos-server-20-1050a-amd64.iso'/>
" [; `" I0 P7 a# h      <target dev='hda' bus='ide'/>: F4 V+ }3 A. s2 u
      <readonly/>: `0 H! q2 {' u# b+ j8 z
      <address type='drive' controller='0' bus='0' target='0' unit='0'/>6 J$ C! k  D1 }: D! k+ H
    </disk>/ C/ [& [, D5 q. W' m
    <controller type='usb' index='0' model='ich9-ehci1'>
* Y5 B' ~! m& D" F. u7 ^$ Y      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x7'/>
' z4 g/ {/ A7 _0 o; g" w9 e    </controller>
- o" }" g0 q/ _    <controller type='usb' index='0' model='ich9-uhci1'>7 m0 W; U0 g2 R
      <master startport='0'/>
' L) B3 e) K0 u& c      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0' multifunction='on'/>3 B# e' `7 @" ^" j0 e
    </controller>
  z" a2 G% X  w: r+ }, L+ @    <controller type='usb' index='0' model='ich9-uhci2'>
# D4 e7 N2 p* l9 |      <master startport='2'/>
( \  \' E, K& w* D* z      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x1'/>, |) g6 K- R9 x3 \9 G/ w! B9 f  P8 T9 `
    </controller>
4 @6 O7 y+ Q0 _/ e9 Q- r$ v, x    <controller type='usb' index='0' model='ich9-uhci3'>
6 e5 F. O% I6 @* b4 r- H      <master startport='4'/>
# r1 F* {$ b# `; y) t' D/ m, X      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x2'/>
9 A9 P( Q5 D8 P- K9 l, Y    </controller>
' l1 S0 Z* r' {! [3 \$ l4 {    <controller type='pci' index='0' model='pci-root'/>
/ @2 Z  d( s  `0 P    <controller type='ide' index='0'># ?$ r. D3 b+ C2 j' A' x- ^9 H! V
      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>3 }3 S: C+ ?% j% `1 S2 q4 J; P
    </controller>+ g' r6 l4 n0 b( Z& t, V
    <controller type='virtio-serial' index='0'>
0 Q# y, [  M) i$ G1 F8 C; g      <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x0'/>+ f4 T& L/ |3 W1 W
    </controller>
# m2 ^1 M5 Y! K0 _6 @8 L    <interface type='bridge'>6 A) j6 p. D1 X+ k7 g0 c/ L
      <source bridge='br0'/>4 \: U. f/ ?8 o  N9 w0 k
      <model type='virtio'/>; r. G5 [9 J" F/ R! T- a4 v
      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>: |* ^+ U6 o$ j2 p; f
    </interface>
4 N  S. i5 b+ G. _" G3 f  D8 K7 I    <serial type='pty'>
4 Q* y9 g3 z7 E. B      <target type='isa-serial' port='0'>( S+ y/ g5 @& l# l
        <model name='isa-serial'/>5 @/ v% Q- G/ [! V( V2 ~  q
      </target>+ {: n3 B5 F1 y4 L( t) R
    </serial>
0 l; q; h4 G$ J& a1 L0 [% }% |    <console type='pty'>; M, n" E4 |: m$ h0 h
      <target type='serial' port='0'/>
. c) J+ Z$ A5 o" ?9 s    </console>
2 m# {' {2 `' r. ~2 @$ w( W    <channel type='unix'>' q3 F  W: c) }. Y1 J
      <target type='virtio' name='org.qemu.guest_agent.0'/>! t& J7 m! m+ H3 I. @
      <address type='virtio-serial' controller='0' bus='0' port='1'/>7 o- o: H0 W* }7 I& {6 N3 V
    </channel>
: |. W' n- T5 B% I& A. G1 V! \    <input type='mouse' bus='ps2'/>9 G: g- P, V' n* G
    <input type='keyboard' bus='ps2'/>
% y0 P% j$ q% M) a2 y/ J6 ~    <graphics type='vnc' port='5960' autoport='no' listen='0.0.0.0'>
. b& r# z2 D' o      <listen type='address' address='0.0.0.0'/>
! o* r: j" y* X' `: ]' Y4 l    </graphics>
' E" t% w; v5 _% }    <video>
2 J0 Q% I) _" z      <model type='cirrus' vram='16384' heads='1' primary='yes'/>  [4 [5 X( M& L1 m2 X% U
      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
) R# k" J( Y7 K# k) V+ U    </video>
" p, A% P+ h- g. M  [    <memballoon model='virtio'>% K: ?! g$ d8 x! i% S& {8 l& [4 r( ?
      <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>
' _  B9 G  W: t' _    </memballoon>
! C& x) L; e0 B0 s6 P. u  </devices>; k* I4 I7 p; h6 l6 }/ M  }1 U
</domain>
, w) H8 [8 t) y1 p! E* _6 m& ~
" C4 m: u/ t4 ~+ n4 ~5 d% c; l( l
您需要登录后才可以回帖 登录 | 注册

本版积分规则

返回首页|Archiver|手机版|小黑屋|易陆发现技术论坛 ( 蜀ICP备2026014127号-1 )

GMT+8, 2026-6-12 03:05 , Processed in 0.020162 second(s), 22 queries .

Powered by Discuz! X5.0

© 2001-2026 Discuz! Team.

快速回复 返回顶部 返回列表