Expose the number of CPUs assigned to a VM

The number of CPUs assigned to a VM will be shown to the user
while updating the VM information.

Signed-off-by: Aline Manera <alinefm@br.ibm.com>
Use socket.getservbyname() to get the default port of a protocol

There is no need maintain an internal mapping 'protocol -> default_port' as
socket.getservbyname() already does it.

Signed-off-by: Aline Manera <alinefm@br.ibm.com>
host cpu usage: update API.md

update API.md
Add a host Resource and a host stats sub-Resource.
get host cpu_utilization from host stats sub-Resource.

Signed-off-by: ShaoHe Feng <shaohef@linux.vnet.ibm.com>
host cpu usage: update controller

add a host Resource and host stats sub-Resource

Signed-off-by: ShaoHe Feng <shaohef@linux.vnet.ibm.com>
host cpu usage: update model

use psutil to get cpu utilization instead of libvirt API.
psutil.cpu_percent is easier to get cpu utilization.
also set psutil.cpu_percent as non-blocking.

Add new BackgroundTask to sample the psutil.cpu_percent.
We need BackgroundTask for all host stats.

Set the sample interval is 1 second.

Signed-off-by: ShaoHe Feng <shaohef@linux.vnet.ibm.com>
host cpu usage: update mockmodel

Just get a dummy cpu utilization by random.uniform.
Not sure we should get really host cpu utilization.

Signed-off-by: ShaoHe Feng <shaohef@linux.vnet.ibm.com>
host cpu usage: update test case

update test_model and test_rest

Signed-off-by: ShaoHe Feng <shaohef@linux.vnet.ibm.com>
Extend the action decorator into an action handler generator

This patch adds action arguments passing and internal redirection to
the decorator. It can generate a complete action handler according to
the action name and arguments dynamically. It's more convenient to add
new action handler with this change.

Signed-off-by: Mark Wu <wudxw@linux.vnet.ibm.com>
Add json schema for API's request parameters

This patch adds a json schema defintion for vm's create operation
and validates the request parameters agaist the schema when creating
a new VM by calling jsonschema's validator. So it's safe to remove
the parameter validation in model level.

It also adds two test cases for it. And more schema definitions will
be added in the following patches.

For json schema specification, please see:
	http://json-schema.org/documentation.html

Signed-off-by: Mark Wu <wudxw@linux.vnet.ibm.com>
interface: some new utils to get the interface info

with this utils:
we can probe the type of interface.
we can get the information of an interface.
we can list vlan, bond, bridge and internet interface.

Signed-off-by: ShaoHe Feng <shaohef@linux.vnet.ibm.com>
interface: update API

Define get API for interfaces collection.
Define get API for interface resource.

Signed-off-by: ShaoHe Feng <shaohef@linux.vnet.ibm.com>
interface: update controller

define Interfaces collection and Interface resource according to API.md

Signed-off-by: ShaoHe Feng <shaohef@linux.vnet.ibm.com>
interface: update model

model implements these fuctions:
list all favored interfaces
lookup a interface

Signed-off-by: ShaoHe Feng <shaohef@linux.vnet.ibm.com>
interface: update mockmodel

mockmodel implements these fuctions:
list all interfaces
lookup a interface

Signed-off-by: ShaoHe Feng <shaohef@linux.vnet.ibm.com>
interface: update test case

update test_rest and test_model

Signed-off-by: ShaoHe Feng <shaohef@linux.vnet.ibm.com>
interface: update makefile, spec file and README

Add the extra python lib in spec file and README
add the new pythons files in source dist list of makefile

split this as individual patch.
come into notice that every new file we should put in the dist list
and every new python lib we should update spec file and README

Signed-off-by: ShaoHe Feng <shaohef@linux.vnet.ibm.com>