Host's repositories management: Update API.md

Define get and create API for repositories collection.
Define get, update, enable and disable API for repository resource.

Signed-off-by: Paulo Vital <pvital@linux.vnet.ibm.com>
Host's repositories management: Update REST API

Define Repositories collection and Repository resource according to API.md
Update API.json
Activate auth support to new collection

Signed-off-by: Paulo Vital <pvital@linux.vnet.ibm.com>
Host's repositories management: Update backend.

Update model and mockmodel to support backend opertions.
Add new file implementing backend operations. There are two new classes:

1) Repositories (object): Class to represent and operate with repositories
information in Kimchi's perspective. It's agnostic to host;s package management
system, and can execute all operations necessary: add repository, get all
repositories list, get information about one repository, update a repository,
enable and disable a repository and remove a repository. This class will load
in runtime the necessary classes to work with the host's package management:
YumRepo for YUM systems based and AptRepo for APT systems based (support for
this last one will be submited in a close future);

2) YumRepo (object): Class to represent and operate with YUM repositories.
Loaded only on those systems that supports YUM, it's responsible to connect,
collect and provide information of YUM repositories in the system. Also it's
responsible to create/delete the files in disk to maintain the repositories in
system after disconnection.

Signed-off-by: Paulo Vital <pvital@linux.vnet.ibm.com>
Host's repositories management: Update Makefile

Update Makefile files to provide repositories support.

Signed-off-by: Paulo Vital <pvital@linux.vnet.ibm.com>
Host's repositories management: Update test-cases.

Added unit tests into test_model.py and test_rest.py

Signed-off-by: Paulo Vital <pvital@linux.vnet.ibm.com>
Host's repositories management: Update error exception messages.

Added new error exception messages for host's repositories support.

Signed-off-by: Paulo Vital <pvital@linux.vnet.ibm.com>
add libxml2 to BuildRequires list

91bab78 import libxml2 when generate index.html during build time.
Need add libxml2 to BuildRequires list.

Signed-off-by: ShaoHe Feng <shaohef@linux.vnet.ibm.com>
Removing extra word from kimchi description

Signed-off-by: Christy Perez <christy@linux.vnet.ibm.com>
Return 403 Forbidden when user does not have permission to access kimchi

We need to differ when user is not logged into kimchi and when he does not have
enough permissions to perform an operation.
When user is not logged in, the UI needs to know to ask him to login
again into kimchi. In this case, return 401 Unauthorized
When user does not have enough permission returns 403 Forbidden

401 Unauthorized - The request requires user authentication.
403 Forbidden - The server understood the request, but is refusing to
fulfill it.

For reference: http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html

Also, updated the tests cases to reflect those changes and po files as
new messages were added.

Signed-off-by: Aline Manera <alinefm@br.ibm.com>
Fix duplicate dev names in host with multipath storage

If the host has a storage connection with multipath, lsblk is going to
return the block devices twice, then when creating LOGICAL storage pool
the user sees devices paths replicated in the UI.
This patch fixes this problem.

Signed-off-by: Rodrigo Trujillo <rodrigo.trujillo@linux.vnet.ibm.com>
Use $(wildcard) to list files in Makefile

Instead of listing file by file in Makefile it is better to use a
pattern for it. That way when adding a new file we don't need to change
the Makefile anymore, unless the pattern changes for some reason (new
file extension or so).

Signed-off-by: Aline Manera <alinefm@br.ibm.com>
issue #324 Improve error messages of creating a storage pool named "kimchi_isos"

"kimchi_isos" is reserved for internal use. So we should throw a clear
error to avoid confusing user.

Signed-off-by: Mark Wu <wudxw@linux.vnet.ibm.com>
Implement integrity verification: verify template integrity, update API.md

Sometimes, user create a template, but networks, cdrom, disks or
storagepool will change later.
So users can not create a vm from this template successfully.
It is necessary to check some paramenters of template.

This patch will check the follow paramenters of template.
networks: check networks exists.
cdrom: check cdrom is available.
disks: check the volume is available.

This patch does not check the storagepool exists. waiting for royce's
disks patch.

Signed-off-by: ShaoHe Feng <shaohef@linux.vnet.ibm.com>
add a new method to get iso info for VMTemplate class

move the related code about get iso info to a new function.
Then template integrity can make use of it.

Signed-off-by: ShaoHe Feng <shaohef@linux.vnet.ibm.com>
Implement integrity verification: verify template integrity in backend

update controller, mockmodel and model

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

update test_model.py and test_rest.py

Signed-off-by: ShaoHe Feng <shaohef@linux.vnet.ibm.com>
Fix ui/js/Makefile.am

kimchi-min.js is generated during build process so we need to explicit
list it on Makefile.

Signed-off-by: Aline Manera <alinefm@br.ibm.com>
Fix PEP8 in test files

test_model.py and test_rest.py are not compliant to PEP8.
And "make check-local" is failing because that.

text.py tests/test_storagepool.py tests/utils.py
tests/test_model.py:464:42: E231 missing whitespace after ':'
tests/test_rest.py:1093:9: E303 too many blank lines (2)
tests/test_rest.py:1095:33: E231 missing whitespace after ':'
make[2]: *** [check-local] Error 1

Fix it.

Signed-off-by: Aline Manera <alinefm@br.ibm.com>
PEP8 for mockmodel.py

Update mockmodel.py to be pep8 compliant, and update makekefile whitelist

Signed-off-by: Adam King <rak@linux.vnet.ibm.com>
Update (mock)model to generate proper JSON

Update the model and the mock model to generate proper JSON.
Update the automated tests to validate against the new data format.

Signed-off-by: Adam King <rak@linux.vnet.ibm.com>