CORD-2724 Enable binding VMs to nodes via node_label
Change-Id: I1cc0891ffca46753ab9aa112112b1b96da2ba80e
diff --git a/xos/synchronizer/model_policies/model_policy_vmmetenant.py b/xos/synchronizer/model_policies/model_policy_vmmetenant.py
index 0fffea0..fe7318c 100644
--- a/xos/synchronizer/model_policies/model_policy_vmmetenant.py
+++ b/xos/synchronizer/model_policies/model_policy_vmmetenant.py
@@ -20,6 +20,7 @@
class VMMETenantPolicy(TenantWithContainerPolicy):
model_name = "VMMETenant"
+ constrain_by_service_instance = True
def handle_create(self, service_instance):
return self.handle_update(service_instance)
@@ -68,10 +69,13 @@
desired_image = self.get_image(service_instance)
desired_flavor = self.get_flavor(service_instance)
+ node_label = service_instance.node_label
+ constrain_by_service_instance = self.constrain_by_service_instance
slice = service_instance.owner.slices.first()
- (node, parent) = LeastLoadedNodeScheduler(slice, label=None).pick()
+ scheduler = LeastLoadedNodeScheduler(slice, label=node_label, constrain_by_service_instance=constrain_by_service_instance)
+ (node, parent) = scheduler.pick()
assert (slice is not None)
assert (node is not None)