CORD-2724 Enable binding VMs to nodes via node_label
Change-Id: I95af0c42485735816516612d1b598bc18a948889
diff --git a/xos/synchronizer/model_policies/model_policy_vspgwctenant.py b/xos/synchronizer/model_policies/model_policy_vspgwctenant.py
index 974a1f1..aadeaa3 100644
--- a/xos/synchronizer/model_policies/model_policy_vspgwctenant.py
+++ b/xos/synchronizer/model_policies/model_policy_vspgwctenant.py
@@ -20,6 +20,7 @@
class VSPGWCTenantPolicy(TenantWithContainerPolicy):
model_name = "VSPGWCTenant"
+ 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)