axsh/wakame-vdc — pull request #66 by Metallion (2012-10-29 10:27:18+00:00)
Title: Domain capacity check bug

# Bug

Some times while you start an instance when some host nodes are offline, you will get an *OutOfHostCapacity* error even when the online host nodes have enough capacity to host the new instance.

# Cause

When starting a new instance, a domain capacity check is made. This check does the following:
* Take the sum of all **online** host nodes' capacity
* Take the sum of all instances on **online** host nodes AND those on **offline** host nodes
* If the above instance usage is greater than the capacity, the error is raised.

The problem is that it is possible that there are still instances running on offline nodes. These get counted in the capacity check and therefore it can happen that the error is raised even when the online nodes have enough capacity to host new instances.

# Solution

* Only take the sum of all instances on **online** host nodes. Do not include the **offline** ones.