易陆发现互联网技术论坛

 找回密码
 开始注册
查看: 546|回复: 0
收起左侧

virsh define Uniontechos.xml 创建kvm虚机

[复制链接]
发表于 2022-9-26 15:00:01 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?开始注册

x
[root@compute03 ~]# qemu-img create /var/lib/libvirt/images/uniontechos2.raw +4G7 h2 j* \- O& c1 W
Formatting '/var/lib/libvirt/images/uniontechos2.raw', fmt=raw size=4294967296
) K& w5 h" v) b' I: H6 y/ f[root@compute03 ~]# vim Uniontechos.xml / k& N: M, t3 Z  y; K# l
[root@compute03 ~]# virsh define Uniontechos.xml
. H5 o& Y8 i0 B' U- S) h. @- M6 Perror: Failed to define domain from Uniontechos.xml
2 [7 W( h! \3 ?6 qerror: XML error: unable to parse mac address ''
9 T4 S2 Y7 B" \: n8 y
. J( V8 n9 q+ |; C, p* |4 K, N[root@compute03 ~]# vim Uniontechos.xml
) c5 q% ]9 l7 D# e# l% @% P[root@compute03 ~]# virsh define Uniontechos.xml
* u  z3 E9 l& X7 Z, ~error: Failed to define domain from Uniontechos.xml
: B. M8 |3 Y* M1 Y9 eerror: (domain_definition):72: AttValue: " or ' expected  s$ \; g" r7 }- T+ x5 C
      <mac address=/>
) x8 q+ ?0 P. v-------------------^
0 V! K" N" H* m( t
4 d5 ]0 [8 W! s% D7 d( |6 V1 d[root@compute03 ~]# vim Uniontechos.xml
$ C8 l+ y; J* h( b7 A[root@compute03 ~]# virsh define Uniontechos.xml / |/ @& D, a; H* u8 Y9 T& Z
error: Failed to define domain from Uniontechos.xml
: r7 ~/ ^" x! W: J  Perror: XML error: unable to parse mac address ' '- d* s3 k0 b: j* U9 {" ^

! Z7 ~' D$ Q. h0 B, d' o[root@compute03 ~]# vim Uniontechos.xml 3 C1 @& w: D' f
[root@compute03 ~]# virsh define Uniontechos.xml / w+ y! O' I7 r8 b- A  a# l
error: Failed to define domain from Uniontechos.xml) `. F) X% J! }' ^5 C9 }5 F8 f) ?
error: XML error: unable to parse mac address ''! `% Y& w# y* M, N$ T6 B6 y4 H
  g2 ~! t0 F) q: S
[root@compute03 ~]# vim Uniontechos.xml
0 E' a& H: V3 M$ c3 Q[root@compute03 ~]# virsh define Uniontechos.xml
, s, ~1 e" s% l( H2 ~error: Failed to define domain from Uniontechos.xml4 K& o+ E+ Q$ \9 C* J
error: XML error: unable to parse mac address ''
+ _6 y  C1 `) C9 q- @! w: H# `+ z. L  G& g6 c
[root@compute03 ~]# vim Uniontechos.xml
# R7 L" A' }( I  P$ j, T- X! B' T[root@compute03 ~]# virsh define Uniontechos.xml
9 v" x% V- h9 b- L$ B. h9 KDomain Uniontechos2 defined from Uniontechos.xml5 ]6 N3 f' T6 A' k# c; ^
" c7 }' W& q* @' N. N4 F" h
[root@compute03 ~]#
  d6 i1 i& Z$ R) U: n
$ j/ z% f; o: B
4 k" a0 o& |, M+ M2 a% W
" b: N. H2 Z$ ^  B3 a[root@compute03 ~]# cat Uniontechos.xml / H; A% ^) n. d/ \
<domain type='kvm'>
' m& m" q& j8 E, |  <name>Uniontechos2</name>
/ j! ]: \  h' s1 n$ A/ }+ Q  <uuid></uuid>
' u9 a8 M+ k. M( N  <memory unit='KiB'>8388608</memory>
4 h4 u4 w, P; q7 y, d8 j( A  <currentMemory unit='KiB'>8388608</currentMemory>
4 x, P% r' O/ W5 E1 d/ q  <vcpu placement='static'>4</vcpu>! O" ^8 [$ M1 u9 t
  <os>
1 p' ?3 J- d/ j( \% `/ u    <type arch='x86_64' machine='pc-i440fx-rhel7.0.0'>hvm</type>
, A" D3 V% v2 L+ T& S% u    <bootmenu enable='yes'/>
3 ]! Y( `9 z, b$ r  </os>, q8 ^5 C/ |* P
  <features>
# Y+ \! j2 h8 Y! r    <acpi/>7 H9 @) y# [3 i0 x4 J) t
    <apic/>
) U5 b* M% y9 g; _! A& K# M  </features>& ^- n& `2 `, b6 P- M0 i- W& q
  <cpu mode='custom' match='exact' check='partial'>0 i2 G+ ?, C8 ^# S, o8 G
    <model fallback='allow'>IvyBridge-IBRS</model>, T3 @& k6 q0 R0 ?& c" b, v
    <feature policy='require' name='md-clear'/>( I0 `5 ^) B" ~& y" v. L4 n; F0 F
    <feature policy='require' name='spec-ctrl'/>0 X( H+ _: R+ S# {# W- {" O* N
    <feature policy='require' name='ssbd'/>" R* |" C2 p! {; I' ~; K( o
  </cpu>
# u1 z( |, M/ P. O# s! o3 ^  <clock offset='utc'>/ C; X1 @! k  [, k8 t
    <timer name='rtc' tickpolicy='catchup'/>
: n7 q! M6 n: g    <timer name='pit' tickpolicy='delay'/>6 }; x" I; z  O! w  s
    <timer name='hpet' present='no'/>/ W: N5 S6 O7 S2 Y8 ~* v  F7 q; `
  </clock>
+ Z. K3 U' s4 X+ R5 T  <on_poweroff>destroy</on_poweroff>0 n- q& A* d( ]% _- J
  <on_reboot>restart</on_reboot>
- o% ?; q+ f* f  <on_crash>destroy</on_crash>  y- V7 E3 H3 F) o1 s" i2 W
  <pm>; F. K  S9 B% _. i  v- d
    <suspend-to-mem enabled='no'/>& e1 t2 I7 s9 h! }, A) P3 F, ]9 f
    <suspend-to-disk enabled='no'/>3 V( q4 X: C- W7 [
  </pm>% I5 P* {  W) W
  <devices>- K9 r8 O0 t  ]
    <emulator>/usr/libexec/qemu-kvm</emulator>$ Z5 ?$ `& ?) W7 O5 A1 r
    <disk type='file' device='disk'>
; Z2 x6 I  p7 S: [1 X4 W* q5 [      <driver name='qemu' type='raw'/>
2 q/ k4 Z- s6 V& Z      <source file='/var/lib/libvirt/images/uniontechos2.raw'/>
: m5 R4 ^, V- J( C      <target dev='vda' bus='virtio'/>+ h* ?' k# m/ O* l! v2 }# a
      <boot order='1'/>
+ u' F3 c; I* X3 J$ a      <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/>4 p- C$ d5 E3 z3 r' C( t
    </disk># g' ]0 ]+ i/ A, W
    <disk type='file' device='cdrom'># G2 I- q( h' ]" g9 ]2 U
      <driver name='qemu' type='raw'/>) Q1 \+ N' y0 |
      <source file='/var/lib/libvirt/images/uniontechos-server-20-1050a-amd64.iso'/>
+ C& {( r! }& z% _      <target dev='hda' bus='ide'/>
) F6 ]* m/ V, W  R8 I      <readonly/>
+ F  a6 W$ ?* @# z      <address type='drive' controller='0' bus='0' target='0' unit='0'/>( d6 w1 B, q4 Q* }! m. a
    </disk>
1 a5 U* c- v* N" |2 R) Q: Q    <controller type='usb' index='0' model='ich9-ehci1'>
( W) O* g* X- b! T% F: A      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x7'/>
* O5 A+ Z/ o- h! n9 ~2 C$ e    </controller>
( M! `( f, G' C, m    <controller type='usb' index='0' model='ich9-uhci1'>+ ~  E! I( f) M
      <master startport='0'/># A2 o2 K5 x2 q/ J2 a% e
      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0' multifunction='on'/>, B2 N/ G9 t' g7 \" t' W
    </controller>
8 d. @4 w6 q- V% o2 z, U: e    <controller type='usb' index='0' model='ich9-uhci2'>& C$ l0 G" D# Z
      <master startport='2'/>
9 F& a/ ~* R9 I3 _! Y& q8 v2 B      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x1'/>: u* K+ g. c! a& [' N( X- U+ H
    </controller>
3 n& l6 n* k& x" d6 \/ B    <controller type='usb' index='0' model='ich9-uhci3'>
" @8 R: |3 k: F5 h# M      <master startport='4'/>
" J9 z6 s# C3 b8 H+ Y. i8 F. \      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x2'/>5 p0 n7 M- N3 O4 O+ A) R
    </controller>
3 N6 A% i9 g1 R3 M    <controller type='pci' index='0' model='pci-root'/>
# u' ^7 Q4 y4 G' d: s    <controller type='ide' index='0'>5 n1 c  v  o% t& i# W+ G9 ^" \
      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>- U8 i1 V( n, c* z
    </controller>
9 h" }- K! l% y9 d; I    <controller type='virtio-serial' index='0'>
+ F& O) \! ~. E5 M4 i+ D      <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x0'/>
4 x( t/ [; l0 a  b% T    </controller># ^7 i: E- ~! j& @9 A
    <interface type='bridge'>
& |* r4 G; {8 a6 c7 m; d/ ^) v      <source bridge='br0'/>
8 w2 r9 S/ h) v2 H3 u      <model type='virtio'/>
, P/ r/ w, j, a& R3 K9 l      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
) G( Q7 V% U: M  o' F! e* l8 J% g6 L    </interface>
1 k8 E& X9 }2 O+ x2 }4 L    <serial type='pty'>! s8 w. d* T/ G
      <target type='isa-serial' port='0'>
2 X& w/ m0 l: x, V7 I; [        <model name='isa-serial'/>$ m5 k0 r" F: [  W3 L2 I
      </target>
1 K7 B# u2 m% s) k& `    </serial>
% M# b6 C- X2 a6 b; t    <console type='pty'>! d# t2 e3 P7 p" C" q( c0 [4 S  Y
      <target type='serial' port='0'/>
8 O4 @4 I% S2 K" M* L7 e0 C    </console>
# F; P" B1 X5 U: e    <channel type='unix'>
# \/ @0 G. Z) L& B      <target type='virtio' name='org.qemu.guest_agent.0'/>
. D( y6 k  ^3 T( s/ [      <address type='virtio-serial' controller='0' bus='0' port='1'/>
  C' g# ]  m: R; q" Z    </channel>* }* r# {5 T' W$ X
    <input type='mouse' bus='ps2'/>; X$ _* O0 y& F! V
    <input type='keyboard' bus='ps2'/>
& v- E" A% K0 d3 K6 R) W# c    <graphics type='vnc' port='5960' autoport='no' listen='0.0.0.0'>
* b' x5 v+ e! Q! B- x* u+ F* I      <listen type='address' address='0.0.0.0'/>
& N9 h( ]  y7 c) J$ q% v+ o    </graphics>
5 A, Z- e, T; I5 y5 w- U    <video>8 _" I+ m' d' R* S8 N' p: r; w& [
      <model type='cirrus' vram='16384' heads='1' primary='yes'/>
& W2 S: X- f% P% y  x' }# s3 V! Z      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
' U3 t+ X! r* j+ n    </video>
0 B+ M% F5 M- {6 l& h( O1 D3 U    <memballoon model='virtio'>
9 Q$ f2 E* J9 y2 l8 [      <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>( x( f9 i8 }/ e
    </memballoon>1 t5 Y+ P- N3 i" ]1 F# n
  </devices>' Z4 s' O% u$ c. d
</domain>
" F" |9 B5 @5 V7 e8 y. W9 ]" {. s
您需要登录后才可以回帖 登录 | 开始注册

本版积分规则

关闭

站长推荐上一条 /4 下一条

北京云银创陇科技有限公司以云计算运维,代码开发

QQ|返回首页|Archiver|小黑屋|易陆发现技术论坛 ( 蜀ICP备2026014127号-1 )点击这里给我发消息

GMT+8, 2026-4-9 07:16 , Processed in 0.048975 second(s), 21 queries .

Powered by Discuz! X3.4 Licensed

© 2012-2025 Discuz! Team.

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