On 08/22/2012 02:46 PM, Iustin Pop wrote:
On Wed, Aug 22, 2012 at 02:30:00PM +0300, Constantinos Venetsanopoulos wrote:
On 08/22/2012 02:24 PM, Iustin Pop wrote:
On Wed, Aug 22, 2012 at 02:16:48PM +0300, Constantinos Venetsanopoulos wrote:
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 <c...@grnet.gr>
---
  lib/cmdlib.py |    8 ++++----
  1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/lib/cmdlib.py b/lib/cmdlib.py
index 1f80c6c..15a6100 100644
--- a/lib/cmdlib.py
+++ b/lib/cmdlib.py
@@ -9083,7 +9083,7 @@ def _ComputeDiskSizePerVG(disk_template, disks):
  def _ComputeDiskSize(disk_template, disks):
-  """Compute disk size requirements in the volume group
+  """Compute disk size requirements according to disk template
    """
    # Required free disk space as a function of disk and swap space
@@ -9093,10 +9093,10 @@ def _ComputeDiskSize(disk_template, disks):
      # 128 MB are added for drbd metadata for each disk
      constants.DT_DRBD8:
        sum(d[constants.IDISK_SIZE] + DRBD_META_SIZE for d in disks),
-    constants.DT_FILE: None,
-    constants.DT_SHARED_FILE: 0,
+    constants.DT_FILE: sum(d[constants.IDISK_SIZE] for d in disks),
+    constants.DT_SHARED_FILE: sum(d[constants.IDISK_SIZE] for d in disks),
      constants.DT_BLOCK: 0,
-    constants.DT_RBD: 0,
+    constants.DT_RBD: sum(d[constants.IDISK_SIZE] for d in disks),
Hmm, for the shared templates LGTM, but DT_FILE is broken and will
remain so until we fix disk space reporting.

I can apply it without changing DT_FILE, is that OK?

thanks,
iustin

Hi,

just replied in the other thread :)
Sure it's OK by me, but then you won't be able to create a 'file' based
instance with hail.
Yes, that's a known issue anyway, for now. We'll hopefully fix it in
2.7, as long as the space reporting is fixed (Guido will work on that).

iustin


OK, sounds good.

thanks,
Constantinos

Reply via email to