宇文氏 发表于 2016-1-8 10:09:48

qemu-kvm使用gluster协议

  为了提高以glusterfs做为存储的 虚拟机的IO性能, Bharata B Rao在qemu-kvm中开发了gluster协议,主要就是让qemu-kvm通过glustefs-api绕过fuse直接访问文件,因为fuse被认为带来了性能损耗。
  
  目前支持gluster协议的qemu-kvm版本是1.3.1以上,还没有方便使用的rpm包,所以我们直接从源码编译安装。
  
  # git clone git://git.kernel.org/pub/scm/virt/kvm/qemu-kvm.git
  # cd qemu-kvm
  # ./configure
  这时,如果已经安装了glusterfs, GlusterFS support 应该是 yes.
  # make && make install
  
  这样,最新的qemu-kvm就装好了,下面建一个简单的gluster卷
  # gluster volume create qqq localhost:/qqq
  # gluster volume start qqq
  
  挂载卷,并拷贝一个虚拟机镜像xp.qcow2 到卷中,然后卸载卷。
  
  启动虚拟机, 注意drive 参数的格式
  # usr/local/bin/qemu-system-x86_64   -drive file=gluster://localhost/qqq/xp.qcow2,format=qcow2  -vnc ::1:5900
  
  此外,qemu-kvm还支持子母盘,即base image。
  # qemu-img create -b xp.qcow2 -f qcow2 xp-clone.qcow2
  # qemu-img info /mnt/xp-clone.qcow2 
  image: xp-clone.qcow2
  file format: qcow2
  virtual size: 10G (10737418240 bytes)
  disk size: 3.7M
  cluster_size: 65536
  
  可以看到xp-clone.qcow2的大小才3.7M, 它是以xp.qcow2为母盘的子盘。
  用同样的启动命令我们可以启动子盘。
  # usr/local/bin/qemu-system-x86_64   -drive file=gluster://localhost/qqq/xp-clone.qcow2,format=qcow2  -vnc ::1:5900
页: [1]
查看完整版本: qemu-kvm使用gluster协议