Support params for GET method

GET filter parameter will be splited in two types:
  1. flag_filter: pass to libvirt api and filter when resource query.
         flag_filters start with "_"
  2. field_filter: take effect in filter out final result.
         field_filters are keys of dict returned by 'GET'
Then we can call it like:
    GET /collection?filter_field=value

Signed-off-by: Royce Lv <lvroyce@linux.vnet.ibm.com>
Add testcase for GET param

Add a testcase to test GET param passing and demo how GET param work
with current model implementation,which means:
1. change the API.json
2. wrap its model implementation to accept parameters

Signed-off-by: Royce Lv <lvroyce@linux.vnet.ibm.com>
Storage server: Update API.md

Update API.md to specify storage server api.

Signed-off-by: Royce Lv <lvroyce@linux.vnet.ibm.com>
storage server: update controller.py

Add storage server collection and resource to report
used storage server.

Signed-off-by: Royce Lv <lvroyce@linux.vnet.ibm.com>
storage server: Update model and mockmodel

Query all storage pool to retrieve storage server we used.
If no query param is given, all supported type will be listed.
With param given, only specified type of server is listed.

Signed-off-by: Royce Lv <lvroyce@linux.vnet.ibm.com>
storage target: Update API.md

Add colleciton of storage targets to API.md.

Signed-off-by: Royce Lv <lvroyce@linux.vnet.ibm.com>
storage target: Update controller and json schema

Add json schema to validate mandatory param of target_type,
also update controller.py.
Reload the get_list function because we don't need to query each target.

Signed-off-by: Royce Lv <lvroyce@linux.vnet.ibm.com>
storage target: Add model support

Construct xml to query storage targets information from
storage server.
Use lxml to parse result instead of etree.
Use lxml to parse target query result.

Signed-off-by: Royce Lv <lvroyce@linux.vnet.ibm.com>
Add showmount function and feature test for libvirt target probe

Add nfs showmount cmd and parse its output, set timeout to be 10s.
With bug https://bugs.launchpad.net/ubuntu/+source/libvirt/+bug/1264955,
Ubuntu libvirt run find-storage-pool-sources return error with error code 38,
generic system call error. While when server does not export any path,
it returns error code 1, internal error.
Leverage this to determine whether libvirt works right with target probe.

Signed-off-by: Royce Lv <lvroyce@linux.vnet.ibm.com>
Fix libvirt nfs target probe problem

If libvirt does not support nfs target probe,
run command directly, otherwise parse libvirt result.

Signed-off-by: Royce Lv <lvroyce@linux.vnet.ibm.com>
Add nfs server and target UI in create storage pool

This patch is working adding a select box in create nfs pool,
when user don't want to input the server ip or name, he can
simply select "used the server I have used before" and choose
a server in a select box, this is more convinent.

In order to show server target I did a select box in UI, but sometimes
maybe the export path number is large. So I made a filter-select
widget to make user easier to choose the export path he want.
This is the first jquery widget. And let us make all common widget to
jquery widget from now on.

Signed-off-by: zhoumeina <zhoumein@linux.vnet.ibm.com>
Modify bug in spice UI

Last spice patch push hard code in spice UI, this patch is working
for fix this issue.
Signed-off-by: zhoumeina <zhoumein@linux.vnet.ibm.com>
add gettext to package require list

gettext translates a natural language message into the user's language.
kimchi needs it.

Signed-off-by: ShaoHe Feng <shaohef@linux.vnet.ibm.com>
Signed-off-by: Zhou Zheng Sheng <zhshzhou@linux.vnet.ibm.com>
improve controller: add a method to load root sub collections/resouces automatically

load_url_sub_node can load collections/resouces automatically when they
are tagged with @UrlSubNode

Signed-off-by: ShaoHe Feng <shaohef@linux.vnet.ibm.com>
improve controller: tag the collections/resouces of root with @UrlSubNode

we can difine a /host as follow:

@UrlSubNode("host", True)
 class Host(Resource):
     def __init__(self, model, id=None):
         super(Host, self).__init__(model, id)

@UrlSubNode("host", True) means:
the URL "/host" is root.Host, and it need authentication

Signed-off-by: ShaoHe Feng <shaohef@linux.vnet.ibm.com>
improve controller: Root loads collections/resouces automatically

Remove hard code from root.py.
We do not need to touch root.py any more when we add a new sub
collection/resouce.

Signed-off-by: ShaoHe Feng <shaohef@linux.vnet.ibm.com>
improve controller: set authentication automatically

Remove hard code from server.py.
We do not need to touch server.py any more when we add a new sub
collection/resouce.

Signed-off-by: ShaoHe Feng <shaohef@linux.vnet.ibm.com>
bug fix: test case can not find plugin, fix it

$ sudo ./run_tests.sh test_rest
Failed to import plugin plugins.sample.Drawings

That's because plugin is not in src/

Add the plugin path in run_tests.sh
Remove the plugin path from test_plugin.py

Signed-off-by: ShaoHe Feng <shaohef@linux.vnet.ibm.com>
Add a control.vm module

All vm devices should be in this module

Signed-off-by: ShaoHe Feng <shaohef@linux.vnet.ibm.com>
Signed-off-by: Royce Lv <lvroyce@linux.vnet.ibm.com>
VM supports interfaces: update API

Now kimchi supports network get/create/delete/activate/deactivate
REST API.

We need to support the attach/detach/ a Network to a VM.
https://github.com/kimchi-project/kimchi/wiki/customize-VM#organization-of-sub-resources-and-rest-api-exposition
And get the info of Network attached to a VM.

more libvirt network interfaces info:
http://libvirt.org/formatdomain.html#elementsNICS

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