Use cherrypy's default dispatcher for subcollection

Currently, we override the dispatchers of resource StoragePool
and IsoPool when the request targets to storagevolumes it holds.
But it's not necessary to use a customized dispatcher. It can be
done by add an attribute to associate with the subcollcetion. In
this case,  it's 'storagevolumes'.

Signed-off-by: Mark Wu <wudxw@linux.vnet.ibm.com>
Ubuntu: Add the LVM dependency package to README

The README file contains instructions to build Kimchi from the source
tree, including the exact command to install the dependencies on Ubuntu.
But that command does not contain the LVM package which is needed to probe LVM
devices when creating a logical storage pool.

Add the LVM package ("lvm2") to the apt-get install command in the README file.

Signed-off-by: Crístian Viana <vianac@linux.vnet.ibm.com>
storagepool: Add missing msg when no logical device is selected

When creating a new logical storage pool, the user must select at least
one logical device. If they do not, the error message
"msg.validate.pool.edit.logical.device" is displayed. That ID has no
corresponding translation, though.

Add English and Brazilian Portuguese translations for the message ID
"msg.validate.pool.edit.logical.device". This fixes the message
"Undefined" mentioned in the issue #310.

Signed-off-by: Crístian Viana <vianac@linux.vnet.ibm.com>
Issue #310: Query correct name to validate logical devices

The dialog to create a new logical storage pool must validate the user
input by checking if they selected at least one of the available
devices. However, the code is looking for checkboxes with a non-existing
element name and it is always reporting that the user did not select any of
them - even when they do. Therefore, it is impossible to create a
logical storage pool.

Change the HTML element name of the devices' checkboxes on the storage pool
page to match the validation algorithm. Instead of "source.devices", use
the name "devices" on those elements.

Signed-off-by: Crístian Viana <vianac@linux.vnet.ibm.com>
storagepool: Do not assume different 'else' values in pool type

Currently, there are four different storage pool types. The JavaScript
code that handles that logic assumes different values in the 'else'
blocks of different functions. It is a good practice to be explicit on
what we are checking for and not to depend on the possible last value
out of a set. This can easily lead to bugs in the future if additional
storage pool types are added. Also, the code is harder to follow because
the 'else' assumptions on similar comparisons are sometimes one value
and sometimes another value.

Use explicit and consistent values when checking the different
pool types in 'if/else' clauses.

Signed-off-by: Crístian Viana <vianac@linux.vnet.ibm.com>
storagepool: Use callback functions when deleting a pool

After deleting a storage pool, the page may update the pool list even if
the operation has not been finished. That results in inconsistent
information in the UI, like duplicate or missing entries. Also, if there
is an error during this operation, nothing is displayed to the user.

Make sure the storage pool list is updated only after the delete
operation finishes successfully, and display an error message if
something goes wrong.

Signed-off-by: Crístian Viana <vianac@linux.vnet.ibm.com>
utils: Add nfs prevalication

Abstract a helper function to parse cmd result.
Usage:
    (1)get cmd result with subprocess.call or subprocess.Popen
    (2) call pass_cmd_output to get formated outputs
Example:
    blkid = subprocess.Popen(["cat", "/proc/mounts"],
                stdout=subprocess.PIPE, stderr=subprocess.PIPE)
    outs = blkid.communicate()[0]
    output_items= ['path', 'mnt_point', 'type', 'option']
        utils.parse_cmd_output(outs, output_items)
Sample output:
    [{'path': '/dev/sda8', 'type': 'ext4',
      'option': 'rw,relatime,data=ordered', 'mnt_point': '/home'},
     {'path': 'localhost:/home/royce/isorepo', 'type': 'nfs4',
      'option': 'rw...addr=127.0.0.1', 'mnt_point': '/mnt'}]

    To prevent future mount of nfs path will hang,
    we will try nfs path with a quick mount,
    if this check fails, report warning to user.

Signed-off-by: Royce Lv <lvroyce@linux.vnet.ibm.com>
Integrate nfs path check before create nfs pool

Before creating nfs pool, reload the prevalidation for the path
and see if it is able to complish a quick mount.
If not, deny this storage pool from being created.

Signed-off-by: Royce Lv <lvroyce@linux.vnet.ibm.com>
Remove 'encoding=iso-8859-1' from json.dumps()

The encoding option for json.dumps() is used to indicate the charsets
of the passed in str. Currently,  we use the encoding of iso-8859-1,
but actually we don't have any data encoded in iso-8859-1. It doesn't
cause any problem because the strings in the data passed are ascii chars
or unicode. If we pass a utf-8 str, it will cause an expected result.
So we could remove the option, and after that it can accept utf-8 str too
because json.dumps use utf-8 as default encoding.

Signed-off-by: Mark Wu <wudxw@linux.vnet.ibm.com>