wiki:libvirt

libvirt


【libvirt 介紹】

  • libvirt 支援各種 VMM 程序(Xen, KVM, VirtualBox, Qemu, OpenVZ, UML, LXC...),以提供統一的虛擬化上層管理介面
  • libvirt 有兩種運作模式:
    1. local: 直接使用 libvirt API
      http://www.ibm.com/developerworks/cn/linux/l-libvirt/figure1.gif
    2. Remote: 必須額外啟動 libvirtd 來 remote communication
      http://www.ibm.com/developerworks/linux/library/l-libvirt/figure2.gif
  • 使用 libvirt 開發的應用
    • virt-install
    • virt-clone
    • virt-manager
    • virt-viewer
    • oVirt

【libvirt 測試】

[安裝]

  • 從 source 安裝
    $ wget http://libvirt.org/sources/libvirt-0.8.4.tar.gz ; tar zxvf libvirt-0.8.4.tar.gz ; cd libvirt-0.8.4
    $ ./configure --with-xen --prefix=/usr
    $ make
    $ make install
    
    • configure 遇到缺少某套件時
      $ sudo aptitude install libxml2-dev libgnutls-dev libdevmapper-dev libxen-dev
      
  • 從套件檔安裝
    $ aptitude search libvirt
    p   libvirt-bin                                        - the programs for the libvirt library                        
    p   libvirt-dev                                        - development files for the libvirt library                   
    p   libvirt-doc                                        - documentation for the libvirt library                       
    p   libvirt-ocaml                                      - OCaml bindings for libvirt                                  
    p   libvirt-ocaml-dev                                  - OCaml bindings for libvirt                                  
    p   libvirt0                                           - library for interfacing with different virtualization system
    p   libvirt0-dbg                                       - library for interfacing with different virtualization system
    p   python-libvirt                                     - libvirt Python bindings                                     
    v   python2.5-libvirt                                  -                      
    

[操作]

  • 使用 virsh (虛擬 shell,基於 shell 的互動方式操作)
    # virsh create xen-vm01.xml
    (設定檔為 xml 格式)
    
    # virsh list
    # virsh suspend 1
    # virsh resume 1
    

[使用 API]


【References】

Last modified 14 years ago Last modified on Sep 29, 2010, 4:37:28 PM