Commit 734b1ff1 authored by Iustin Pop's avatar Iustin Pop
Browse files

Fix reading of total disk space in iallocator

IAllocator currently uses a wrong key name for reading the total disk
space (‘disk_usage’ which was copied from RAPI, but the actual
iallocator key is ‘disk_space_total’).

This patch fixes that and also makes iallocator always use this key,
instead of computing the size by itself—with Ganeti 2.0 this is
key is always available.
parent 61d67afe
......@@ -49,14 +49,7 @@ parseBaseInstance :: String
-> JSObject JSValue
-> Result (String, Instance.Instance)
parseBaseInstance n a = do
disk <- case fromObj "disk_usage" a of
Bad _ -> do
all_d <- fromObj "disks" a >>= asObjectList
szd <- mapM (fromObj "size") all_d
let sze = map (+128) szd
szf = (sum sze)::Int
return szf
x@(Ok _) -> x
disk <- fromObj "disk_space_total" a
mem <- fromObj "memory" a
let running = "running"
return $ (n, Instance.create n mem disk running 0 0)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment