qemu - kvm 생 성 매개 변수 분석

12640 단어 qemu
qemu 명령 매개 변수 참조 문서:
http://qemu.weilnetz.de/qemu-doc.html
 
다음은 하나의 예 이다.
/usr/libexec/qemu-kvm -S -M rhel6.3.0 
-cpu Westmere,+rdtscp,+pdpe1gb,+dca,+pdcm,+xtpr,+tm2,+est,+smx,+vmx,+ds_cpl,+monitor,+dtes64,+pclmuldq,+pbe,+tm,+ht,+ss,+acpi,+ds,+vme 
-enable-kvm -m 2048
-smp 2,sockets=2,cores=1,threads=1 
-name inst-1219 -uuid 1cf7a47c-18ec-11e2-92db-14feb5dc2c72 -nodefconfig -nodefaults 
-chardev socket,id=charmonitor,path=/var/lib/libvirt/qemu/inst-1219.monitor,server,nowait 
-mon chardev=charmonitor,id=monitor,mode=control 
-rtc base=localtime -no-shutdown 
-device piix3-usb-uhci,id=usb,bus=pci.0,addr=0x1.0x2
-drive file=/dev/drVG/lv1567,if=none,id=drive-virtio-disk0,format=raw,cache=none,aio=native 
-device virtio-blk-pci,scsi=off,bus=pci.0,addr=0x5,drive=drive-virtio-disk0,id=virtio-disk0,bootindex=1 
-netdev tap,fd=22,id=hostnet0 
-device e1000,netdev=hostnet0,id=net0,mac=00:16:3e:66:90:9a,bus=pci.0,addr=0x3 
-netdev tap,fd=32,id=hostnet1 
-device e1000,netdev=hostnet1,id=net1,mac=00:16:3e:90:70:bd,bus=pci.0,addr=0x4 
-chardev pty,id=charserial0 
-device isa-serial,chardev=charserial0,id=serial0 
-device usb-tablet,id=input0 -vnc 0.0.0.0:9,password -vga cirrus 
-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x6
 
다음은 상세 한 설명 을 드 리 겠 습 니 다.
 
/usr/libexec/qemu-kvm -S -M rhel6.3.0 
-cpu Westmere,+rdtscp,+pdpe1gb,+dca,+pdcm,+xtpr,+tm2,+est,+smx,+vmx,+ds_cpl,+monitor,+dtes64,+pclmuldq,+pbe,+tm,+ht,+ss,+acpi,+ds,+vme 
- enable - kvm (KVM 의 모든 가상 화 지원 을 허용 합 니 다. 이 옵션 은 LINUX 컴 파일 시 KVM 지원 이 추가 되 었 을 때 만 유효 합 니 다)
- m 2048 (RAM 메모리 2048 MB)
- mp 2, sockets = 2, cores = 1, threads = 1 (쌍 핵 을 모 의 하 는 SMP, 최대 두 개의 sockets, 각 socket 1 개의 core, 각 core 1 개의 thread)
-name inst-1219
-uuid 1cf7a47c-18ec-11e2-92db-14feb5dc2c72 (  system UUID )
- nodefconfig (기본적으로 qemu 는 sysconfdir 와 datadir 에서 설정 을 읽 습 니 다. - nodefconfig 는 qemu 에서 읽 지 못 합 니 다.  )
-nodefaults  (기본 qemu 는 serial port, parallel port, virtual console, monitor device, VGA adapter, floppy and CD - ROM drive and others 를 만 들 고, - nodefaults 는 기본 값 을 만 들 지 못 합 니 다)
 
- hardev socket, id = charmonitor, path = / var / lib / libvirt / qemu / ins - 1219. monitor, server, nowait (지정 한 path 의 유 닉 스 socket 을 만 듭 니 다. server 는 linstening socket 이 라 고 표시 합 니 다. nowait 는 클 라 이언 트 연결 을 기다 릴 때 차단 하지 말 아야 함 을 표시 합 니 다)
- mon chardev = charmonitor, id = monitor, mode = control (Monitor 를 홈 호스트 장치 / var / lib / libvirt / qemu / ins - 1219 로 재 설정)
 
-rtc base=localtime -no-shutdown 
 
- device piix3 - usb - uhci, id = usb, bus = pci. 0, addr = 0x1.0x2 (piix3 - usb - uhci 추가 US B 드라이브 지원)
 
- drive file = / dev / drVG / lv 1567, if = none, id = drive - virtio - disk 0, format = raw, cache = none, ao = native (디스크 추가, ID 는 driver - virtio - disk 0, raw 형식, cache 없 음, linux native aio 사용)
- device virtio - blk - pci, scsi = off, bus = pci. 0, addr = 0x5, drive = drive - virtio - disk 0, id = virtio - disk 0, bootindex = 1 (driver - virtio - disk 0 의 디스크 에 구동 virtio - blk - pci 추가)
 
- netdev tap, fd = 22, id = hostnet 0 (connet host tap interface to vlan n, fd 는 열 린 host tap interface 의 핸들 을 표시 합 니 다. 이 가상 네트워크 카드 의 ID 는 hostnet 0 입 니 다)
- device e1000, netdev = hostnet 0, id = net 0, mac = 00: 16: 3e: 66: 90: 9a, bus = Pci. 0, addr = 0x3 (hostnet 0 네트워크 카드 에 e1000 장치 구동 추가)
 
-netdev tap,fd=32,id=hostnet1 
-device e1000,netdev=hostnet1,id=net1,mac=00:16:3e:90:70:bd,bus=pci.0,addr=0x4 
 
-chardev pty,id=charserial0  (charserial 0 이라는 ID 를 가 진 pty 장치 추가)
- device isa - serial, chardev = charserial 0, id = serial 0 (charserial 0 장치 에 isa - serial 장치 구동 추가)
 
-device usb-tablet,id=input0
-vnc 0.0.0.0:9,password
-vga cirrus 
-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x6
 
 
마지막 으로 virsh dumpxml int - 1219 로
 
<domain type='kvm' id='99'>
  <name>inst-1219</name>
  <uuid>1cf7a47c-18ec-11e2-92db-14feb5dc2c72</uuid>
  <memory unit='KiB'>2097152</memory>
  <currentMemory unit='KiB'>2097152</currentMemory>
  <vcpu placement='static'>2</vcpu>
  <os>
    <type arch='x86_64' machine='rhel6.3.0'>hvm</type>
    <boot dev='hd'/>
  </os>
  <features>
    <acpi/>
    <apic/>
    <pae/>
  </features>
  <cpu mode='custom' match='exact'>
    <model fallback='allow'>Westmere</model>
    <vendor>Intel</vendor>
    <feature policy='require' name='tm2'/>
    <feature policy='require' name='est'/>
    <feature policy='require' name='vmx'/>
    <feature policy='require' name='ds'/>
    <feature policy='require' name='smx'/>
    <feature policy='require' name='ss'/>
    <feature policy='require' name='vme'/>
    <feature policy='require' name='dtes64'/>
    <feature policy='require' name='rdtscp'/>
    <feature policy='require' name='ht'/>
    <feature policy='require' name='dca'/>
    <feature policy='require' name='pbe'/>
    <feature policy='require' name='tm'/>
    <feature policy='require' name='pdcm'/>
    <feature policy='require' name='pdpe1gb'/>
    <feature policy='require' name='ds_cpl'/>
    <feature policy='require' name='pclmuldq'/>
    <feature policy='require' name='xtpr'/>
    <feature policy='require' name='acpi'/>
    <feature policy='require' name='monitor'/>
  </cpu>
  <clock offset='localtime'/>
  <on_poweroff>destroy</on_poweroff>
  <on_reboot>restart</on_reboot>
  <on_crash>restart</on_crash>
  <devices>
    <emulator>/usr/libexec/qemu-kvm</emulator>
    <disk type='block' device='disk'>
      <driver name='qemu' type='raw' cache='none' io='native'/>
      <source dev='/dev/drVG/SNDACLOUD_lv1567'/>
      <target dev='vda' bus='virtio'/>
      <alias name='virtio-disk0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/>
    </disk>
    <controller type='usb' index='0'>
      <alias name='usb0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
    </controller>
    <interface type='bridge'>
      <mac address='00:16:3e:66:90:9a'/>
      <source bridge='br1'/>
      <target dev='vnet17'/>
      <model type='e1000'/>
      <alias name='net0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
    </interface>
    <interface type='bridge'>
      <mac address='00:16:3e:90:70:bd'/>
      <source bridge='br2.201'/>
      <target dev='vnet18'/>
      <model type='e1000'/>
      <alias name='net1'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
    </interface>
    <serial type='pty'>
      <source path='/dev/pts/25'/>
      <target port='0'/>
      <alias name='serial0'/>
    </serial>
    <console type='pty' tty='/dev/pts/25'>
      <source path='/dev/pts/25'/>
      <target type='serial' port='0'/>
      <alias name='serial0'/>
    </console>
    <input type='tablet' bus='usb'>
      <alias name='input0'/>
    </input>
    <input type='mouse' bus='ps2'/>
    <graphics type='vnc' port='5909' autoport='yes'/>
    <video>
      <model type='cirrus' vram='9216' heads='1'/>
      <alias name='video0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
    </video>
    <memballoon model='virtio'>
      <alias name='balloon0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>
    </memballoon>
  </devices>
  <seclabel type='none'/>
</domain>

 
참고:
XML 형식 문서:
http://libvirt.org/format.html
qemu - kvm XML 형식 문서:
http://libvirt.org/drvqemu.html#xmlconfig
 
 
또한 qemu 매개 변수 와 XML 은 서로 바 꿀 수 있 습 니 다. 참고:
http://libvirt.org/drvqemu.html
사용 명령:
 
virsh domxml-from-native qemu-argv demo.args (      XML)
 virsh domxml-to-native qemu-argv demo.xml (  XML    )

 
Example domain XML config
QEMU emulated guest on x86_64
  <name>QEmu-fedora-i686</name>
  <uuid>c7a5fdbd-cdaf-9455-926a-d65c16db1809</uuid>
  <memory>219200</memory>
  <currentMemory>219200</currentMemory>
  <vcpu>2</vcpu>
  <os>
    <type arch='i686' machine='pc'>hvm</type>
    <boot dev='cdrom'/>
  </os>
  <devices>
    <emulator>/usr/bin/qemu-system-x86_64</emulator>
    <disk type='file' device='cdrom'>
      <source file='/home/user/boot.iso'/>
      <target dev='hdc'/>
      <readonly/>
    </disk>
    <disk type='file' device='disk'>
      <source file='/home/user/fedora.img'/>
      <target dev='hda'/>
    </disk>
    <interface type='network'>
      <source network='default'/>
    </interface>
    <graphics type='vnc' port='-1'/>
  </devices>
</domain>
 
KVM hardware accelerated guest on i686
 
<domain type='kvm'>
  <name>demo2</name>
  <uuid>4dea24b3-1d52-d8f3-2516-782e98a23fa0</uuid>
  <memory>131072</memory>
  <vcpu>1</vcpu>
  <os>
    <type arch="i686">hvm</type>
  </os>
  <clock sync="localtime"/>
  <devices>
    <emulator>/usr/bin/qemu-kvm</emulator>
    <disk type='file' device='disk'>
      <source file='/var/lib/libvirt/images/demo2.img'/>
      <target dev='hda'/>
    </disk>
    <interface type='network'>
      <source network='default'/>
      <mac address='24:42:53:21:52:45'/>
    </interface>
    <graphics type='vnc' port='-1' keymap='de'/>
  </devices>
</domain>

좋은 웹페이지 즐겨찾기