distros: add new distros files

Add some new distros files.

Update the rpm spec file.
put distros files in kimchid pakage.

update the Makefile
put distros files in dist_conf_DATA list

Signed-off-by: ShaoHe Feng <shaohef@linux.vnet.ibm.com>
Reviewed-by: Aline Manera <alinefm@linux.vnet.ibm.com>
Reviewed-by: Royce Lv <lvroyce@linux.vnet.ibm.com>
distros: add a DistroLoader to load distros

The distro iso links will be stored in /etc/kimchi/distros.d/

A basic DistroLoader class that reads all of the files and produces
a python array identical to the osinfo array.

Adam Litke suggested:
The distros files cannot be updated at runtime.
The only thing kimchi needs to do with the files in /etc/kimchi/distros.d
is read them to create a large json list of template objects.
It will never write to those files.

user can create a file in /etc/kimchi/distros.d by installing / upgrading
a package

Signed-off-by: ShaoHe Feng <shaohef@linux.vnet.ibm.com>
Reviewed-by: Aline Manera <alinefm@linux.vnet.ibm.com>
distros: update API document

add a distros API

Signed-off-by: ShaoHe Feng <shaohef@linux.vnet.ibm.com>
Reviewed-by: Royce Lv<lvroyce@linux.vnet.ibm.com>
Reviewed-by: Aline Manera <alinefm@linux.vnet.ibm.com>
distros: update Controller to add Distros collection and Distro resource

add Distros collection and Distro resource

The flow of Distros GET method is same with the VMs GET method

Signed-off-by: ShaoHe Feng <shaohef@linux.vnet.ibm.com>
distros: add mockmodel and model implementation

The distros information can be accessed by GET /config/distros

The JSON will be like:
[
  {
    "name": "opensuse-12.3",
    "os_distro": "opensuse",
    "os_version": "12.3"
    "path":"http://distro.org/distro.iso",
  },
  {
    "name": "fedora-19",
    "os_distro": "fedora",
    "os_version": "19"
    "path":"http://distro.org/distro.iso",
  },
]

The distro informations can be accessed by GET /config/distros/ident

GET  /config/distros/opensuse-12.3
The JSON will be like:
{
  "name": "opensuse-12.3",
  "os_distro": "opensuse",
  "os_version": "12.3"
  "path":"http://distro.org/distro.iso",
}

Signed-off-by: ShaoHe Feng <shaohef@linux.vnet.ibm.com>
distros: update testcase in test_rest and rest_model

test the GET of Distros collection and GET of Distro resource.

Signed-off-by: ShaoHe Feng <shaohef@linux.vnet.ibm.com>
feature tests: Rename libvirt test to express what it does

The iso streaming sanity test identifies which protocols are accepted
by libvirt. So rename it to avoid misunderstanding when adding new
tests.

Signed-off-by: Aline Manera <alinefm@br.ibm.com>
feature tests: Verify QEMU supports ISO streaming

From qemu source code, iso streaming is supported since version v0.11.0-rc1
But Kimchi needs to know if the qemu installled has this support in order
to enable/disable creation of ISO streamed templates.

Signed-off-by: Aline Manera <alinefm@br.ibm.com>
feature tests: Verify QEMU can properly work with hostname while streaming ISOs

The ISO streaming functionality is not working well on Fedora 19.
With qemu-kvm-1.4.2-12 and curl-7.29.0-6 packages installed, it is
not able to create virtual machines with streamed ISOs when the
cdrom URL uses host name instead of IP address.
So create a sanity test in order to identify that case to properly
handle it on Kimchi.

Signed-off-by: Aline Manera <alinefm@br.ibm.com>
Expose QEMU ISO streaming functionality to host capabilities

Expose if QEMU supports ISO streaming and if it can works properly with
hostname while streaming ISOs.

Signed-off-by: Aline Manera <alinefm@br.ibm.com>
iso streaming: Libvirt workaround

The ISO streaming support was recently added to libvirt so the most current
libvirt version in Linux distributions do not have support for it.

To allow the Kimchi user creates templates with streamed Internet ISO verify
if the libvirt has ISO streaming support and if not uses qemu/KVM directly
through <qemu:commandline> libvirt tag.

Signed-off-by: Aline Manera <alinefm@br.ibm.com>
iso streaming: QEMU workaround

On Fedora 19, with qemu-kvm-1.4.2-12 and curl-7.29.0-6 packages
installed, the ISO streaming functionality only works properly
while using IP addresses instead of host names.
To avoid problems related to it, get the related IP address while
creating the virtual machine.

Signed-off-by: Aline Manera <alinefm@br.ibm.com>
ISO streaming: Enable UI

Enable creating templates with streamed Internet ISO file in UI.

Signed-off-by: Aline Manera <alinefm@br.ibm.com>
iso streaming: Add default port for all protocols

Kimchi supports iso streaming through the protocols: http, https,
ftp, ftps and tftp. So we need to be able to get the default
port for all those.

Signed-off-by: Aline Manera <alinefm@br.ibm.com>
bug fix: correct to use float when calculate guest net and disk IO

In [0]: float(1023) / 1024
Out[0]: 0.9990234375

In [1]: float(1023 / 1024)
Out[1]: 0.0

This patch corrects float usage for more precision result.
And also removes redundant float.

Signed-off-by: ShaoHe Feng <shaohef@linux.vnet.ibm.com>
bug fix: Use vm uuid to properly get vm statistics

Commit d44883e6 changed how to index vm statistics, replacing name to uuid.
So we need to use the vm uuid to get its statistics and display to the user.

Signed-off-by: Aline Manera <alinefm@br.ibm.com>