`
haoningabc
  • 浏览: 1477018 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

libvrit

阅读更多
参考
http://www.baidu.com/s?wd=virsh+migrate

dd if=/dev/zero of=./win2003img count=0 bs=1M seek=10000
-------------------------------
virsh list --all
看到id name state
比如name是win2003
virsh dumpxml win2003 > win2003.xml
得到类似
<domain type='kvm' id='8'>
  <name>win2003</name>
  <uuid>0249b1b1-aad1-42e2-a3e8-8adce1567228</uuid>
  <memory>524288</memory>
  <currentMemory>524288</currentMemory>
  <vcpu>1</vcpu>
  <os>
    <type arch='x86_64' machine='pc'>hvm</type>
    <boot dev='hd'/>
    <boot dev='cdrom'/>
  </os>
  <clock offset='utc'/>
  <on_poweroff>destroy</on_poweroff>
  <on_reboot>restart</on_reboot>
  <on_crash>restart</on_crash>
  <devices>
    <emulator>/usr/bin/kvm</emulator>
    <disk type='file' device='cdrom'>
      <source file='/opt/test/iso/windows2003.iso'/>
      <target dev='hdc' bus='ide'/>
      <readonly/>
      <alias name='ide1-cd0'/>
      <address type='drive' controller='0' bus='1' unit='0'/>
    </disk>
    <disk type='file' device='cdrom'>
      <source file='/opt/test/iso/RHEV-toolsSetup_2.2_47513.iso'/>
      <target dev='hdd' bus='ide'/>
      <readonly/>
      <alias name='ide1-cd1'/>
      <address type='drive' controller='0' bus='1' unit='1'/>
    </disk>
    <disk type='file' device='disk'>
      <source file='/opt/test/var/lib/test/bukkits/windows/win2003'/>
      <target dev='hda' bus='ide'/>
      <alias name='ide0-hd0'/>
      <address type='drive' controller='0' bus='0' unit='0'/>
    </disk>
    <disk type='file' device='disk'>
      <source file='/opt/test/var/lib/test/bukkits/windows/win2003_tmp'/>
      <target dev='vda' bus='virtio'/>
      <alias name='virtio0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
    </disk>
    <controller type='ide' index='0'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
    </controller>
    <interface type='network'>
      <mac address='c7:4f:d3:6b:d1:3f'/>
      <source network='default'/>
      <target dev='vnet0'/>
      <model type='virtio'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
    </interface>
    <input type='mouse' bus='ps2'/>
    <graphics type='vnc' port='23151' autoport='no' listen=''/>
    <video>
      <model type='cirrus' vram='9216' heads='1'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
    </video>
  </devices>
</domain>



virsh create win2003.xml


------------------------
virsh list --all
virsh dumpxml win2003 > win2003.xml
virsh edit win2003


virsh save {domain-name, domain-id or domain-uuid} filename
virsh suspend {domain-id, domain-name or domain-uuid}
virsh resume {domain-id, domain-name or domain-uuid}
virsh restore filename
virsh shutdown {domain-id, domain-name or domain-uuid}
virsh reboot {domain-id, domain-name or domain-uuid}
virsh domid {domain-name or domain-uuid}
virsh domname {domain-id or domain-uuid}

虚机信息
virsh dominfo i-4ACF0892
virsh domuuid i-4ACF0892
virsh domid i-4ACF0892
virsh vcpuinfo i-4ACF0892
virsh domname {domain-id or domain-uuid}
virsh vcpuinfo {domain-id, domain-name or domain-uuid}

virsh setvcpus {domain-name, domain-id or domain-uuid} count
virsh setmem {domain-id or domain-name} count

★★★★★★★★★★★★★★★★★★★★★★★★
virsh migrate --live GuestName DestinationURL
virsh net-list
比如name是default
virsh net-dumpxml default

[root@s120128 ~]# virsh net-dumpxml default
<network>
  <name>default</name>
  <uuid>00d404f6-f2d2-4100-af7d-ef45e2bb066b</uuid>
  <forward mode='nat'/>
  <bridge name='virbr0' stp='on' delay='0' />
  <ip address='192.168.122.1' netmask='255.255.255.0'>
    <dhcp>
      <range start='192.168.122.2' end='192.168.122.254' />
    </dhcp>
  </ip>
</network>

[root@s120128 ~]#



virsh nodeinfo
主机信息

virsh net-autostart network-name
virsh net-create XMLfile
virsh net-define XMLfile
virsh net-destroy network-name
virsh net-name networkUUID
virsh net-uuid network-name
virsh net-start nameOfInactiveNetwork
virsh net-undefine nameOfInactiveNetwork




[root@test test]# rpm -qa|grep kvm
etherboot-roms-kvm-5.4.4-10.el5
kvm-83-105.el5
kvm-tools-83-105.el5
kvm-qemu-img-83-105.el5
etherboot-zroms-kvm-5.4.4-10.el5
kmod-kvm-83-105.el5
[root@test test]#
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics