Issue: #177: iso storage volume get wrong allocation value

commit 0ef21303 bring about this bug.
Issue: https://github.com/kimchi-project/kimchi/issues/177

Signed-off-by: ShaoHe Feng <shaohef@linux.vnet.ibm.com>
bug fix: Update API for storage volume resize

The REST API URL should be:
POST /storagepools/*:poolname*/storagevolumes/*:name*/resize

And the contend to send:
{
"size": 1024
}

Signed-off-by: ShaoHe Feng <shaohef@linux.vnet.ibm.com>
bug fix: mockmodel set the storage volume size to MB according to the API.md

API.md say that "The unit is MBytes"
**URI:** /storagepools/*:poolname*/storagevolumes

**Methods:**

* **GET**: Retrieve a summarized list of all defined Storage Volumes
           in the defined Storage Pool
* **POST**: Create a new Storage Volume in the Storage Pool
    * name: The name of the Storage Volume
    * type: The type of the defined Storage Volume
    * capacity: The total space which can be used to store volumes
                The unit is MBytes
    * format: The format of the defined Storage Volume

And the model really set unit as MBytes to libvirt.
def _get_volume_xml(**kwargs):
...
      <capacity unit="MiB">%(capacity)s</capacity>
...

Signed-off-by: ShaoHe Feng <shaohef@linux.vnet.ibm.com>
bug fix: set the capacity unit to MB when pass it the storagevolumes_create.

The capacity unit from template is GB. it should change to MB when pass it
to storagevolumes_create.

**URI:** /templates/*:name*

**Methods:**
...
* **PUT**: update the parameters of existed template
...
        * size: The device size in GB
...

Signed-off-by: ShaoHe Feng <shaohef@linux.vnet.ibm.com>
bug fix: keep the default value of storage info from libvirt

now the value is set Mega unit.

The UI displays not friendly when the values are too smaller or
too larger than Mega.

UI needs a common function in utili files.
The function will change the value to a suitable unit

Signed-off-by: ShaoHe Feng <shaohef@linux.vnet.ibm.com>
Signed-off-by: zhoumeina <zhoumein@linux.vnet.ibm.com>
update test case after a series unit bug fixed

for test_vm_lifecycle and test_vm_on_alt_storage test case:
The size unit of volume is GB when it is created by template create API.
And we get the 'capacity' unit from volume get API is Bytes.
So we should verify it like:
        self.assertEquals(1 << 30, vol['capacity'])

for test_iso_scan_shallow test case:
And the size unit of volume is MB when the volume is created by volume
create API.

It is not a good test case to the 'allocation' and 'capacity' are equals
from from volume get API. It is makes no sense.
self.assertEquals(storagevolume['allocation'], storagevolume['capacity'])
bug: https://github.com/kimchi-project/kimchi/issues/177

we should verify 'allocation' and 'capacity' separately that they are expected.

for test_storagevolume test case:
we should be care the 'capacity' units are different.

Signed-off-by: ShaoHe Feng <shaohef@linux.vnet.ibm.com>
Fix bug:145 Make a util to change the storage unit

Fix bug 145
the capacity of dir is zero when
get the /storagepools/*:poolname*/storagevolumes URL
https://github.com/kimchi-project/kimchi/issues/145

1 change the number to the original number generated
by libvirt.

2 call the common util in the front to format
the unit with two digits after the decimal point.

3 Show the proper unit in the page "G" "M"  "K" with two digits
after the decimal point.

Signed-off-by: zhoumeina <zhoumein@linux.vnet.ibm.com>