require instance isolation to match container kind
diff --git a/xos/core/models/instance.py b/xos/core/models/instance.py
index 927c8e3..c146371 100644
--- a/xos/core/models/instance.py
+++ b/xos/core/models/instance.py
@@ -124,6 +124,13 @@
if not self.creator:
raise ValidationError('instance has no creator')
+ if (self.isolation == "container"):
+ if (self.image.kind != "container"):
+ raise ValidationError("Container instance must use container image")
+ elif (self.isolation == "vm"):
+ if (self.image.kind != "vm"):
+ raise ValidationError("VM instance must use VM image")
+
if (self.slice.creator != self.creator):
# Check to make sure there's a slice_privilege for the user. If there
# isn't, then keystone will throw an exception inside the observer.