Change type of Cluster.AllocSolution
authorIustin Pop <iustin@google.com>
Fri, 23 Sep 2011 04:23:29 +0000 (13:23 +0900)
committerIustin Pop <iustin@google.com>
Thu, 29 Sep 2011 07:14:03 +0000 (09:14 +0200)
commit129734d3dde61ea2b967f5178e2de4f3789409b4
treedc4363dd3431833a63b6c7405fc7547f1e44d297
parent90b2eeb0e79f513be90dc91d0ba543bdaa454f5e
Change type of Cluster.AllocSolution

Originally, this data type was used both by instance allocation (1
result), and by instance relocation (many results, one per
instance). As such, the field 'asSolutions' was a list, and the
various code paths checked whether the length of the list matches the
current mode. This is very ugly, as we can't guarantee this matching
via the type system; hence the FIXME in the code.

However, commit 6804faa removed the instance evacuation code, and thus
we now always use just one allocation solution. Hence we can change
the data type to a simply Maybe type, and get rid of many 'otherwise
barf out' conditions.

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Agata Murawska <agatamurawska@google.com>
htools/Ganeti/HTools/Cluster.hs
htools/Ganeti/HTools/IAlloc.hs
htools/Ganeti/HTools/QC.hs