Fix computation of disk sizes in _ComputeDiskSize
authorConstantinos Venetsanopoulos <cven@grnet.gr>
Wed, 22 Aug 2012 11:16:48 +0000 (14:16 +0300)
committerIustin Pop <iustin@google.com>
Wed, 22 Aug 2012 12:18:36 +0000 (14:18 +0200)
commit6a3166cb3a5699ec6299f4997f4fbd27669da500
treecce9252f634df373ba6aaf0e7a29689fe3a9d6de
parentf08e513223f49f9f73f792c691ef461e68300181
Fix computation of disk sizes in _ComputeDiskSize

Currently, hail fails with FailDisk when trying to add an instance
of type: 'file', 'sharedfile' and 'rbd'.

This is due to a "0" or None value in the corresponding dict inside
_ComputeDiskSize, which results in a "O" or non Int value of the
exported 'disk_space_total' parameter. This in turn makes hail fail,
when trying to process the value:

 - with "Unable to read Int" if value is None (file)
 - with FailDisk if value is 0 (sharedfile, rbd)

The latter happens because the 0 value doesn't match the instance's
IPolicy, since it is lower than the minimum disk size.

The second problem still exists when using adoption with 'plain'
and 'blockdev' template and will be addressed in another commit.

Signed-off-by: Constantinos Venetsanopoulos <cven@grnet.gr>
Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>
lib/cmdlib.py