Power下,Ubuntu代替PowerKVM作为KVM hypervisor

Using Ubuntu 14.04 as a KVM hypervisor for POWER

Although not officially supported, it is possible to run Ubuntu 14.04.2 LTS as a KVM hypervisor in POWER architecture. You can officially support Ubuntu as hypervisor starting at Ubuntu 14.10 and optimally at 15.04.

In order to do that, you need to be on 14.04.2 or later. Ubuntu KVM doesn't run on 3.13 kernel, which is part of original Ubuntu 14.04 and 14.04.1 release. You will also need to download some newer packages from the Cloud Archive repository.

What is the difference between the PowerKVM and using Ubuntu as hypervisor

There is a set of differences, mainly some features that were not made upstream yet, as:

  • Huge DDW for the guests (Enabled in PowerKVM and not on Ubuntu yet)
    • Status: Some folks working to enable Huge DDW exploitation in Linux kernel and Qemu, which will make it available in Ubuntu (possible version 15.10)
  • Ubuntu runs the hypervisor in Little endian mode. On the other side, PowerKVM, as in 2.1.1, is still a BE hypervisor.
  • PowerKVM has some additional software not yet available in Ubuntu, as Kimchi and Ginger. (To be available in version Ubuntu 15.10)
  • In terms of packages available in the hypervisor, Ubuntu is a full-fledged hypervisor, while PowerKVM is a more restricted hypervisor.
  • PowerKVM is based on RPM and YUM packaging, while Ubuntu is based in DEB and APT.

How to use Ubuntu as a hypervisor?

  • Note Recommended 14.10 or later

Ubuntu is able to be used as a hypervisor, as an alternative to PowerKVM. 

Just install buntun in bare metal (NV) following the steps in Running Ubuntu non-virtualized on POWER8. 

After the installation you need:

  1. Install the missing virtualization packages:

    sudo apt-get install qemu-user qemu-utils cloud-image-utils qemu-system-ppc qemu-slof libvirt-bin numactl

    <span style="font-size:12px;">root@zhai:~# lscpu
    Architecture:          ppc64le
    Byte Order:            Little Endian
    CPU(s):                80
    On-line CPU(s) list:   0,8,16,24,32,40,48,56,64,72
    Off-line CPU(s) list:  1-7,9-15,17-23,25-31,33-39,41-47,49-55,57-63,65-71,73-79
    Thread(s) per core:    1
    Core(s) per socket:    10
    Socket(s):             1
    NUMA node(s):          1
    Model:                 TN71-BP012
    L1d cache:             64K
    L1i cache:             32K
    L2 cache:              512K
    L3 cache:              8192K
    NUMA node0 CPU(s):     0,8,16,24,32,40,48,56,64,72
    root@zhai:~# apt-get install qemu-user qemu-utils qemu-system-ppc qemu-slof libvirt-bin numactl  qemu-kvm
    Reading package lists... Done
    Building dependency tree
    Reading state information... Done
    qemu-slof is already the newest version.
    numactl is already the newest version.
    The following extra packages will be installed:
      binfmt-support ipxe-qemu libjpeg-turbo8 libjpeg8 libvirt0 qemu-block-extra
      qemu-system-common qemu-user-binfmt seabios
    Suggested packages:
      policykit-1 radvd lvm2 samba vde2 openbios-ppc openhackware debootstrap
    Recommended packages:
      dmidecode
    The following packages will be REMOVED:
      qemu-keymaps
    The following NEW packages will be installed:
      binfmt-support ipxe-qemu libjpeg-turbo8 libjpeg8 qemu-block-extra
      qemu-user-binfmt seabios
    The following packages will be upgraded:
      libvirt-bin libvirt0 qemu-kvm qemu-system-common qemu-system-ppc qemu-user
      qemu-utils
    7 upgraded, 7 newly installed, 1 to remove and 91 not upgraded.
    Need to get 11.4 MB of archives.
    After this operation, 16.5 MB of additional disk space will be used.
    Do you want to continue? [Y/n] y</span>

    Software Required versions

    Once you do that, you should have the following package versions:

    Package

    Version

    qemu

    1:2.2+dfsg-5expubuntu9~cloud0

    qemu-slof

    20140630+dfsg-1ubuntu1

    libvirt

    1.2.12-0ubuntu12~cloud0

    root@zhai:~# qemu-system-ppc --version
    QEMU emulator version 2.3.0 (Debian 1:2.3+dfsg-5ubuntu9.2~cloud0), Copyright (c) 2003-2008 Fabrice Bellard
    root@zhai:~# libvirtd --version
    libvirtd (libvirt) 1.2.16
    root@zhai:~# dpkg -l | grep qemu-slof
    ii  qemu-slof                           20140630+dfsg-1ubuntu1~14.04          all          Slimline Open Firmware -- QEversion
    Once you have that, you have all the software need to run a KVM guest on your machine.
  2. Add the users that would be able to run virtual machines into the kvm group:

    # sudo usermod -a -G kvm <user>

  3. Disable the SMT:

    sudo ppc64_cpu --smt=off

  4. Enable KVM module in the kernel (Add a line "kvm_hv" in /etc/modules in order to automatically load it after a reboot):

    sudo modprobe kvm_hv
    KVM是Linux的一个模块。可以用modprobe去加载KVM模块。加载了模块后,才能进一步通过其他工具创建虚拟机。但仅有KVM模块是 远远不够的,因为用户无法直接控制内核模块去作事情:还必须有一个用户空间的工具才行。这个用户空间的工具,开发者选择了已经成型的开源虚拟化软件 QEMU。说起来QEMU也是一个虚拟化软件。它的特点是可虚拟不同的CPU。

  5. [Ubuntu 14.10 only] Assure that you have the /usr/bin/qemu-system-ppc64le file, otherwise, create a link as follow. This is only required in Ubuntu 14.10 and this is already 'fixed' on later releases, check [1]:

    sudo ln -s qemu-system-ppc64 /usr/bin/qemu-system-ppc64le

  6. [Ubuntu 14.10 only] Allow apparmor to access the SLOF (firmware). This is only required in Ubuntu 14.10 and this is already 'fixed' on later releases, check[2]:

    # echo "/usr/share/slof/** r," >> /etc/apparmor.d/abstractions/libvirt-qemu

  7. If you hit "failed to parse default acl file `/etc/qemu/bridge.conf", you need to edit (or create) file /etc/qemu/bridge.conf and add:

    allow br0

  8. If you hit "failed to create tun device: Operation not permitted", you need to set the setuid attribute:

    # chmod u+s /usr/lib/qemu/qemu-bridge-helper

# ps -ef | grep virt
/usr/sbin/libvirtd -d
# virsh list --all

参考:

1 ubuntu ppc64el: https://wiki.ubuntu.com/ppc64el/

2 https://wiki.ubuntu.com/ppc64el/CommonQuestions

3 https://wiki.ubuntu.com/ppc64el/KVM1404

4 PowerKVM: http://blog.csdn.net/zhaihaifei/article/details/51025780

你可能感兴趣的:(qemu,kvm,openstack,power,libvirt)