找回密码
 注册
查看: 548|回复: 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* r& p7 H3 |- C* v# {' `4 M* y1 l
Formatting '/var/lib/libvirt/images/uniontechos2.raw', fmt=raw size=4294967296/ m& H1 m: _# ^8 N/ y
[root@compute03 ~]# vim Uniontechos.xml
  K" G9 E+ r0 K( z" l[root@compute03 ~]# virsh define Uniontechos.xml
9 r* f* M% q$ Y" O3 Y; \, i3 y6 Zerror: Failed to define domain from Uniontechos.xml
* l" Z. x1 Z( d7 n9 H8 jerror: XML error: unable to parse mac address '': M. Q5 |) l' z/ B/ j: k

) b' `/ v  i& Y  n" l! o[root@compute03 ~]# vim Uniontechos.xml 6 V& [4 d! e% ]$ r( F
[root@compute03 ~]# virsh define Uniontechos.xml 9 p; y* @' Q6 {/ U& U- V: L
error: Failed to define domain from Uniontechos.xml! `5 @% K: C, A
error: (domain_definition):72: AttValue: " or ' expected
' ^: y; [" Q+ `# R7 ]      <mac address=/>1 j/ ]3 `! h- a7 f4 p& O
-------------------^
- f, X. A: w3 z2 Z3 M+ S
2 n+ k$ r, J1 i1 `, a2 o) o[root@compute03 ~]# vim Uniontechos.xml
8 @& C2 ^+ C. @6 I# j/ S) E[root@compute03 ~]# virsh define Uniontechos.xml ) l& `" ~/ `) B/ H" S! ]
error: Failed to define domain from Uniontechos.xml
( I+ V9 Q- L+ uerror: XML error: unable to parse mac address ' '
" ?# j0 l6 \. c2 w, k8 f! E  y: {% l/ W' J( O% u
[root@compute03 ~]# vim Uniontechos.xml % a. q2 H9 H, V5 N" m
[root@compute03 ~]# virsh define Uniontechos.xml
$ `( f- b4 z( W# Xerror: Failed to define domain from Uniontechos.xml
9 f$ j: i! J- |/ E' p  G: aerror: XML error: unable to parse mac address ''/ M7 w8 X  `& q& p: \; d) n/ r1 u

/ R5 t0 q/ r# w9 P& A# N2 J& C[root@compute03 ~]# vim Uniontechos.xml : U8 j6 y  ]3 ?# X* u+ A
[root@compute03 ~]# virsh define Uniontechos.xml # f. d1 x3 N! f: J4 o+ f
error: Failed to define domain from Uniontechos.xml
. J! l7 m( }. ?% q+ H/ herror: XML error: unable to parse mac address ''! ~- n7 N! {! l! ?

2 m# S/ o- c- F7 Y2 m% j2 b[root@compute03 ~]# vim Uniontechos.xml 8 [" ^- P! a7 F4 _6 q( J. I; c  Y
[root@compute03 ~]# virsh define Uniontechos.xml 5 I8 Z5 e' k1 t8 Y) {3 k1 r- A3 t
Domain Uniontechos2 defined from Uniontechos.xml, i. c9 B( }7 `! J" u0 a
* `7 \7 X* Q  p! Q6 H
[root@compute03 ~]# 2 `6 t1 O7 N% I: {
& O0 n# Q$ ?" D. G; f4 q

8 [# v5 G# F; ^0 m$ y" j0 V, N+ U; Z' B8 d4 q: a8 `0 V3 a
[root@compute03 ~]# cat Uniontechos.xml
# [- Q& _2 U8 d! n, e<domain type='kvm'>
& t- C7 a! ?  V) I  <name>Uniontechos2</name>
5 `+ @, H( P: a/ I7 j" z, O  \( z) R  <uuid></uuid># N- H/ t, ^$ N' q# T5 U, Q
  <memory unit='KiB'>8388608</memory>
+ B% z% A# Y: s, e) i$ a  ^: B$ `  <currentMemory unit='KiB'>8388608</currentMemory>$ i- U+ l- I1 c
  <vcpu placement='static'>4</vcpu>
/ q' s0 A/ @. I- q- \  <os>
: V2 j  y) B" ?/ X$ O0 B" G    <type arch='x86_64' machine='pc-i440fx-rhel7.0.0'>hvm</type>
) K+ o. W, i! E0 B. ?( Q+ L    <bootmenu enable='yes'/>  m, L1 t4 p0 F
  </os>
6 d& q- L4 r) q8 B5 L  <features>
# Y) n% f# d) d- N4 N6 ?    <acpi/>- T- @( ]" |' ]1 U2 J. k! {
    <apic/>8 i' V( g1 c7 ^- V  {! s
  </features>/ k! Y  A! i! a  p( H7 r
  <cpu mode='custom' match='exact' check='partial'>9 s* C7 ]7 K/ y( q: K& g0 \
    <model fallback='allow'>IvyBridge-IBRS</model>
& C. h) U4 X5 S8 u, Y2 S    <feature policy='require' name='md-clear'/>
! f4 N: }0 N0 G0 T) h- a/ }    <feature policy='require' name='spec-ctrl'/>; U5 F3 B5 H! _- w, I
    <feature policy='require' name='ssbd'/>
# f" \  ]4 ~' g  </cpu>
  A6 Y1 P# T- X& h  <clock offset='utc'>
. W. ]) \# h6 {9 U    <timer name='rtc' tickpolicy='catchup'/>
( |: N5 O4 b# D, ~    <timer name='pit' tickpolicy='delay'/>
% E  |3 [0 s5 ~0 F( @    <timer name='hpet' present='no'/>) o. c* _- `9 h3 N  N7 Y* |
  </clock>7 w% Q. m7 m+ t) p* r0 P
  <on_poweroff>destroy</on_poweroff>% f' |7 ]. Z) O/ j
  <on_reboot>restart</on_reboot>
: M: d! s. o2 D0 ?0 ~6 \  <on_crash>destroy</on_crash>  u  G8 M8 K0 p0 J# }& N  H, p+ E
  <pm>
% g+ @' |4 g3 p+ b    <suspend-to-mem enabled='no'/>
1 I1 m, X0 h) q9 a3 d# d% y    <suspend-to-disk enabled='no'/>9 M, \, }+ d9 i9 z) V  z$ p
  </pm>; P! S6 a3 {* t6 E4 `2 f
  <devices>$ z) N' Y( o5 f+ L  V- Z+ ?
    <emulator>/usr/libexec/qemu-kvm</emulator>. v1 }& }$ K8 t4 E1 e! \' n- }
    <disk type='file' device='disk'>1 h: x! O8 D* Z: Z& C; F0 n
      <driver name='qemu' type='raw'/>
' |& D6 \' I7 i      <source file='/var/lib/libvirt/images/uniontechos2.raw'/>
6 I1 Q* j% @- W; z; x" C+ t! B- D      <target dev='vda' bus='virtio'/>
3 Y; z/ B! _$ z( s$ [9 p7 B. h1 F6 D9 f      <boot order='1'/>" Z8 M7 g# p4 U9 N/ }+ v1 H
      <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/>
. C4 m' G  f0 ^% r. ?    </disk>
2 q+ K6 r. W! Q    <disk type='file' device='cdrom'>: F  X3 ?" t) ^1 t
      <driver name='qemu' type='raw'/>! _: \/ p3 T! E$ ~: x8 ?+ K6 |1 j
      <source file='/var/lib/libvirt/images/uniontechos-server-20-1050a-amd64.iso'/>
, J9 ]- J5 z" }0 n: T1 j% D( o- ~      <target dev='hda' bus='ide'/>
  F* Z, V3 B7 j( R1 U6 U( o& b      <readonly/>! X$ m2 a( e% o! v' E7 z' e  K  j" w
      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
+ ?+ l5 K( L. {    </disk>
/ C: \! |7 g/ z6 m* D2 N    <controller type='usb' index='0' model='ich9-ehci1'>
! `- @2 x, w/ |" u      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x7'/>
: P' G; d8 D: s1 l: O* j    </controller>. {' j8 j) P& Y! Q
    <controller type='usb' index='0' model='ich9-uhci1'>
! S  \9 J# D' f      <master startport='0'/>
# I) ?* p5 y+ U  T8 y8 u      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0' multifunction='on'/>
' b$ y; ?  Y. G- ^* s    </controller>* a. @; \/ q# I$ L# R
    <controller type='usb' index='0' model='ich9-uhci2'>
. J7 p5 o% A) t      <master startport='2'/>9 _) X: _6 u  T# e( e2 [2 c/ w
      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x1'/>
2 k, E2 ]5 p7 r( V4 b6 y+ p9 ~    </controller>' |# J6 G( ^9 ^7 r
    <controller type='usb' index='0' model='ich9-uhci3'>
7 C  F; B, C3 P2 ~/ _- o      <master startport='4'/>
+ U( G: E4 k. O      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x2'/>& S/ a0 ?. ^2 k7 T7 w
    </controller>4 W" [6 d+ u4 ^& V
    <controller type='pci' index='0' model='pci-root'/>7 \; [9 z5 b  u8 _* q
    <controller type='ide' index='0'>
3 Y1 X- X0 g2 V/ Y      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>  u$ q# R' l6 c5 C: h
    </controller>
8 C" z5 ~, e# X1 H4 O/ n    <controller type='virtio-serial' index='0'>' _# |, ^5 A: E3 v
      <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x0'/>, ]5 @+ ^: O1 V$ ?3 Q/ u
    </controller>. ?7 D7 B6 x* I) G6 I, ~
    <interface type='bridge'>
& D+ Y& w5 Z0 B/ G; z- g      <source bridge='br0'/>5 \4 j7 B2 Z* ]4 v$ C+ s# T
      <model type='virtio'/>
/ V3 ~  v3 y1 M8 O- [& u      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>+ l: d4 Z9 _. f$ Y" u
    </interface>
. S7 k' J4 l4 y* m& N" A    <serial type='pty'>2 P' p: P2 V7 A0 X7 ^; H
      <target type='isa-serial' port='0'>
" p. |& E( U& z" Z        <model name='isa-serial'/>+ C2 A! X; Q7 I! }
      </target>' f0 S5 R; s- W  R
    </serial>
, t2 e* E0 X/ [) N8 V    <console type='pty'>
( [7 A4 W, T! H. E; N( f      <target type='serial' port='0'/>0 O. u) O" \4 h2 ^
    </console>
! Y  ?, v$ l" Y0 ?4 ?; s    <channel type='unix'>  A1 _8 I! P4 g' Z6 l' n
      <target type='virtio' name='org.qemu.guest_agent.0'/>0 Y" b, x/ E" ]' r
      <address type='virtio-serial' controller='0' bus='0' port='1'/>. |  n8 k' z6 c" y
    </channel># d' Z7 A" b8 ^6 Q: }
    <input type='mouse' bus='ps2'/>
* C" ^% a: g# v7 k+ e    <input type='keyboard' bus='ps2'/>
$ p; t0 i! c$ L' W+ T    <graphics type='vnc' port='5960' autoport='no' listen='0.0.0.0'>
3 R1 M1 W6 |3 T5 W. s# V3 O+ [$ [      <listen type='address' address='0.0.0.0'/>
+ f9 C0 L3 i* `' }" H; C% ~1 l    </graphics>/ i! o  N; X- `$ c  t1 s/ C
    <video>( b$ J/ m6 F4 G5 [" Z' F0 e8 P9 b
      <model type='cirrus' vram='16384' heads='1' primary='yes'/>
2 B( s: G$ n5 {$ _, @3 H! p      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
8 b: e+ {3 e. u# d' L( H' h    </video>
9 Q1 G: b- ]3 u1 l# t' E1 a    <memballoon model='virtio'>; d, c) A+ }! J9 ]+ _% n3 }, `/ A- s
      <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>
# [5 K2 D+ O. B; S; A3 C" G" w    </memballoon>% D* @8 K0 a6 h9 U. _
  </devices>
2 Q/ o% N7 ^- f  T3 C</domain>: M5 `/ b; ^1 T* L

0 k, Y' w4 ?9 s0 J% G2 ]9 _! G. d
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

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

Powered by Discuz! X5.0

© 2001-2026 Discuz! Team.

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