找回密码
 注册
查看: 550|回复: 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
% {) b: i. _- u0 z1 ^Formatting '/var/lib/libvirt/images/uniontechos2.raw', fmt=raw size=4294967296) `) M( t+ G; a5 n8 Q* @
[root@compute03 ~]# vim Uniontechos.xml 3 I! J2 T: n6 b
[root@compute03 ~]# virsh define Uniontechos.xml
9 N; ^. A) L1 _' yerror: Failed to define domain from Uniontechos.xml
, s# L9 b8 L2 Zerror: XML error: unable to parse mac address ''
' o; I8 t. G+ v( k7 [. M
1 K0 E. E" J& j; R* e$ E[root@compute03 ~]# vim Uniontechos.xml
3 e: I3 ~% A# e# g[root@compute03 ~]# virsh define Uniontechos.xml # O" e$ E. M/ {$ s2 N0 Q
error: Failed to define domain from Uniontechos.xml& ?1 d% ~& ~$ Y7 K. m& @$ ]: d# q
error: (domain_definition):72: AttValue: " or ' expected
' t/ Y) W  U+ w  d      <mac address=/>- ~5 I5 d) O* `! G% r2 O
-------------------^# x3 m; l6 k8 t; c

% o; E% w; W! E[root@compute03 ~]# vim Uniontechos.xml - `* K* p0 X; Z) E+ |- c
[root@compute03 ~]# virsh define Uniontechos.xml
1 F5 C. s% {; I* F' V5 Cerror: Failed to define domain from Uniontechos.xml
( b. y4 m* k. f& ]/ ^) F8 Rerror: XML error: unable to parse mac address ' '
/ m, O# u* _5 ^1 v( n4 l$ x
' o$ e) w/ C/ ?7 l& ^+ f, s/ J$ y[root@compute03 ~]# vim Uniontechos.xml # U0 K: X$ T, f. R9 e# ]9 ~
[root@compute03 ~]# virsh define Uniontechos.xml
" e# _! G* J1 V, ?- a; p0 Kerror: Failed to define domain from Uniontechos.xml
7 a3 [5 x! z" j. @) g2 J# d* Serror: XML error: unable to parse mac address ''
. [' X) N+ {, x# b. `& ?' v. N9 y
5 F; R. _9 F0 A7 [6 |[root@compute03 ~]# vim Uniontechos.xml
) f) j/ i3 w' V8 v2 L* C[root@compute03 ~]# virsh define Uniontechos.xml
8 U3 L5 z1 J9 d( y+ cerror: Failed to define domain from Uniontechos.xml) W% G2 z: e4 V& T& Y
error: XML error: unable to parse mac address ''
. L# t5 p: y  v: u! f$ v" {: M% P, F5 q) |
[root@compute03 ~]# vim Uniontechos.xml
- t" E; n6 e# i% b2 y[root@compute03 ~]# virsh define Uniontechos.xml
" ]0 B$ h9 t, k" o3 F  C9 e8 EDomain Uniontechos2 defined from Uniontechos.xml1 i0 R! ?/ E( P8 X- m) u. g" A

# m/ d' V# ~& @. R3 {5 E[root@compute03 ~]#
, D% k' u2 z. I
4 \9 L: I5 J8 j) M* o' H% H7 J% j0 ^( u; I. i* B; n7 \

& l/ p! a0 F/ T( N; O* n4 Z[root@compute03 ~]# cat Uniontechos.xml % x/ i" a: [1 _' l
<domain type='kvm'>' O* Y2 b% V. D; S( r
  <name>Uniontechos2</name>
4 k$ j) L' z" R8 O3 ?  <uuid></uuid>, d6 X4 A& w5 L& I5 {/ {& |
  <memory unit='KiB'>8388608</memory>% Q) R. y2 I/ V/ ?4 ]+ [
  <currentMemory unit='KiB'>8388608</currentMemory>
0 T6 w4 ?+ b4 D7 _  <vcpu placement='static'>4</vcpu>
- o* d! s; D6 j  <os>
0 W5 f4 \; O+ J; w4 i    <type arch='x86_64' machine='pc-i440fx-rhel7.0.0'>hvm</type>, O- i; o4 S1 Y4 @$ X3 T+ l
    <bootmenu enable='yes'/>: U7 t" i" {3 f; v9 l+ `4 y9 S  h
  </os>7 A* k$ O, N: _$ z  y5 o
  <features>
+ z% l* d' A4 W    <acpi/>
) g  C1 H4 A+ p: K    <apic/>2 _* i* J' i2 A9 T! I
  </features>/ e# ?/ B, ?# w3 c
  <cpu mode='custom' match='exact' check='partial'>) K) R% A# e$ h+ Z: r" P9 k
    <model fallback='allow'>IvyBridge-IBRS</model>9 W) t# w6 o3 c1 x7 N8 A
    <feature policy='require' name='md-clear'/>4 l$ B9 p  H5 f2 J# m
    <feature policy='require' name='spec-ctrl'/>
) p$ t/ C/ G  W6 w8 X$ C1 q    <feature policy='require' name='ssbd'/>4 W! C8 \( F  c. i3 D
  </cpu>
/ C# T1 {$ `) X* m" K  <clock offset='utc'>
4 {. {6 T; Y0 _: z# g0 A* _7 k# I    <timer name='rtc' tickpolicy='catchup'/>
9 i; S+ x% |$ |5 y. k* N    <timer name='pit' tickpolicy='delay'/>' M8 c  ~3 m( e
    <timer name='hpet' present='no'/>) T& V/ a- Z( M% \& O$ _0 H9 h1 M' q
  </clock>
2 g4 I4 `; e8 u* q  <on_poweroff>destroy</on_poweroff>% h" k6 U1 o/ X
  <on_reboot>restart</on_reboot>9 w+ k  {/ t( m1 G: c
  <on_crash>destroy</on_crash>! J. F: j& w* D( v/ H+ |
  <pm>$ n% U9 [8 H5 z' ?
    <suspend-to-mem enabled='no'/>
; U+ x9 A  i8 y    <suspend-to-disk enabled='no'/>) V9 \7 `; J, M
  </pm>
  U; C0 S. Z7 r/ e. w  <devices>
1 S4 F1 u) P+ S" Z  k; n    <emulator>/usr/libexec/qemu-kvm</emulator>6 m0 r  H9 C, g
    <disk type='file' device='disk'>
' e! V+ M9 l7 N* v+ @3 T      <driver name='qemu' type='raw'/>
2 u# y. C) \5 o0 }# Q- v      <source file='/var/lib/libvirt/images/uniontechos2.raw'/>
! ?8 k& R+ Z1 D, ~/ Y1 H      <target dev='vda' bus='virtio'/>3 P- r% ^' \, G. j& Y
      <boot order='1'/>4 T% w2 `) F4 r0 L' r  ]
      <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/>
# N2 S- l6 P. x, K5 b3 e4 }    </disk>
0 r2 x) F3 T0 v    <disk type='file' device='cdrom'>
3 L0 m9 I* H+ v; k5 G% o: ~      <driver name='qemu' type='raw'/>
# d- @& G' P5 m( s' Q+ ?. k% T      <source file='/var/lib/libvirt/images/uniontechos-server-20-1050a-amd64.iso'/>7 u7 d* a2 d0 E, S6 a& T
      <target dev='hda' bus='ide'/>1 G; f, }8 E$ \" p& _9 P0 ~
      <readonly/>
3 [) {* d" c5 I2 g      <address type='drive' controller='0' bus='0' target='0' unit='0'/>8 ]/ B0 x, T+ n0 v; C
    </disk>/ T7 g8 E0 I6 c; i
    <controller type='usb' index='0' model='ich9-ehci1'>
/ a# ^8 c; }$ E      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x7'/>
; C2 R7 y$ F% |: t    </controller># b, {, I5 |) `/ G2 q5 Z% a
    <controller type='usb' index='0' model='ich9-uhci1'>
) @2 |  {( k, }3 G, X      <master startport='0'/>
! F2 l6 g% n. i; a# M! t7 N      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0' multifunction='on'/>& b7 s! `) J  e1 p
    </controller>
, A% i2 h, U+ v! b4 f$ }$ r; z    <controller type='usb' index='0' model='ich9-uhci2'>
  B$ n9 T* m8 {  [, _      <master startport='2'/>
) K' i% J; k2 K- W( _$ M3 \- F+ K      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x1'/>
3 k/ [* i, ]. H# z    </controller>' M$ Z2 p" ~9 f& Q' P
    <controller type='usb' index='0' model='ich9-uhci3'>2 v5 H% y) S! z1 R1 M! T3 a! w% w
      <master startport='4'/>
, |% }* w5 V* a0 H' ^" F      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x2'/># S4 d. L8 _% h3 a2 h, q' Q  z
    </controller>
. N- _3 U* K7 s1 _! g4 W    <controller type='pci' index='0' model='pci-root'/>
3 x. n4 V/ l+ E/ r6 Y    <controller type='ide' index='0'>
; G. }! X- Z  @" h" j4 ~8 q# C      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>; A! \- k# @8 p4 o+ n' w
    </controller>, e# B% a$ S) O( w
    <controller type='virtio-serial' index='0'>
7 T" [* U5 s+ @      <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x0'/>  }% J/ b! L& F% {. f) s  j
    </controller>1 \8 w! @% `2 O# [7 `5 [
    <interface type='bridge'>2 x' \! C# y9 u# |. b
      <source bridge='br0'/>- R, `) Q% W' a
      <model type='virtio'/>
6 ?3 q  }3 z) w+ k      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
: O0 I6 Z( ^4 k; T/ ~8 ~! W    </interface>+ G7 u: D/ f' s4 k) J) ~# m8 `
    <serial type='pty'>% X; \. I- }5 ]6 s0 i
      <target type='isa-serial' port='0'>
; y' K3 x4 z) e) L& ^9 w" a, {        <model name='isa-serial'/>
  ]/ o, g3 t. Z. m. U      </target>: I4 Z# @' q5 x# {4 x1 C
    </serial>
+ u$ Y; }; I( a    <console type='pty'>6 L( U# @5 i8 S- K
      <target type='serial' port='0'/>
2 w& n) c: \; N! s- g6 \    </console>
. B: n) i! k$ [% [6 B) p" |9 ~    <channel type='unix'>' u9 B1 E4 Z$ ~' R
      <target type='virtio' name='org.qemu.guest_agent.0'/>9 ]) V. B& ?5 n: ~# n! _7 A8 G2 @' m
      <address type='virtio-serial' controller='0' bus='0' port='1'/>7 p, W  p  R/ c8 f
    </channel># L1 N- g" o; D. n
    <input type='mouse' bus='ps2'/>
5 I; v, i" ^( Z' D    <input type='keyboard' bus='ps2'/>% m! {0 `" w6 w+ Y* h- n) @
    <graphics type='vnc' port='5960' autoport='no' listen='0.0.0.0'>
$ V, s" F, P8 Q2 u' l/ W      <listen type='address' address='0.0.0.0'/>
1 L+ T& v! U1 O0 D0 H    </graphics>
* [2 K/ d2 a/ n: R8 [3 C$ S' s    <video>
! E5 A8 j& u! R! Y. u! g      <model type='cirrus' vram='16384' heads='1' primary='yes'/>
4 B" J: r) F: V8 Q* N      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
( |* c+ S5 L: s* I0 b4 H! V    </video>
8 }( f$ J# W# o% c4 M    <memballoon model='virtio'>. n) A1 j% B& E  u. M
      <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>
7 V7 D- k* N2 _7 _" ~    </memballoon>
$ v' }8 K( h4 q5 q; F. l  </devices>
0 l  N3 {6 }% L. d" ^+ u, k- `</domain>% ?2 h" g4 g8 [2 U. B
( U1 I) z) }# b
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2026-6-12 04:06 , Processed in 0.017391 second(s), 21 queries .

Powered by Discuz! X5.0

© 2001-2026 Discuz! Team.

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