Export connected networks to IAllocator
authorThomas Thrainer <thomasth@google.com>
Thu, 16 May 2013 11:44:10 +0000 (13:44 +0200)
committerThomas Thrainer <thomasth@google.com>
Wed, 29 May 2013 07:52:38 +0000 (09:52 +0200)
IAllocators should not put instances on nodes in nodegroups which are
not connected to the network the instance should be connected to.
Therefore, export the networks a node group is connected to to the
IAllocator, so it can account for this restriction.

Signed-off-by: Thomas Thrainer <thomasth@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>

lib/masterd/iallocator.py

index b1fd9f1..4790d46 100644 (file)
@@ -465,6 +465,7 @@ class IAllocator(object):
     ng = dict((guuid, {
       "name": gdata.name,
       "alloc_policy": gdata.alloc_policy,
+      "networks": [net_uuid for net_uuid, _ in gdata.networks.items()],
       "ipolicy": gmi.CalculateGroupIPolicy(cluster, gdata),
       "tags": list(gdata.GetTags()),
       })