From 190ce47cbc5195bf0df8ca707463eaf3ab492836 Mon Sep 17 00:00:00 2001 From: Iustin Pop <iustin@google.com> Date: Sun, 22 Mar 2009 23:30:42 +0100 Subject: [PATCH] Include DRBD overhead in sda/sdb size MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit For Ganeti 1.2 which doesn't have the βdisk_usageβ instance query field, we need to manually include the DRBD overhead (per disk). This patch modifies the RAPI collection to do this, but loading from disk does not as it's unknown if the query came from hscan or RAPI 1.2 or RAPI 2.0... --- Ganeti/HTools/Rapi.hs | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/Ganeti/HTools/Rapi.hs b/Ganeti/HTools/Rapi.hs index c5e4df28f..da1a9b562 100644 --- a/Ganeti/HTools/Rapi.hs +++ b/Ganeti/HTools/Rapi.hs @@ -19,6 +19,11 @@ import Text.Printf (printf) import Ganeti.HTools.Utils () +-- Some constants + +-- | The fixed drbd overhead per disk (only used with 1.2's sdx_size) +drbdOverhead = 128 + {-- Our cheap monad-like stuff. Thi is needed since Either e a is already a monad instance somewhere @@ -141,9 +146,10 @@ parseInstance :: JSObject JSValue -> Either String String parseInstance a = let name = getStringElement "name" a disk = case getIntElement "disk_usage" a of - Left _ -> apply2 (+) - (getIntElement "sda_size" a) - (getIntElement "sdb_size" a) + Left _ -> let log_sz = apply2 (+) + (getIntElement "sda_size" a) + (getIntElement "sdb_size" a) + in apply2 (+) log_sz (Right $ drbdOverhead * 2) Right x -> Right x bep = fromObj "beparams" a pnode = getStringElement "pnode" a -- GitLab