Commit 1b2cb110 authored by Iustin Pop's avatar Iustin Pop
Browse files

IAllocator: replace fake policy with real one



This small patch actually reads the allocation policy from the
IAllocator message.
Signed-off-by: default avatarIustin Pop <iustin@google.com>
Reviewed-by: default avatarBalazs Lecz <leczb@google.com>
parent 2befdc14
...@@ -104,8 +104,10 @@ parseGroup :: String -- ^ The group UUID ...@@ -104,8 +104,10 @@ parseGroup :: String -- ^ The group UUID
-> [(String, JSValue)] -- ^ The JSON object -> [(String, JSValue)] -- ^ The JSON object
-> Result (String, Group.Group) -> Result (String, Group.Group)
parseGroup u a = do parseGroup u a = do
name <- fromObj a "name" let extract x = tryFromObj ("invalid data for group '" ++ u ++ "'") a x
return (u, Group.create name u AllocPreferred) name <- extract "name"
apol <- extract "alloc_policy"
return (u, Group.create name u apol)
-- | Top-level parser. -- | Top-level parser.
parseData :: String -- ^ The JSON message as received from Ganeti parseData :: String -- ^ The JSON message as received from Ganeti
......
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