update Instance model_policy to handle container stuff
diff --git a/xos/model_policies/model_policy_Instance.py b/xos/model_policies/model_policy_Instance.py
index a13428d..23761f3 100644
--- a/xos/model_policies/model_policy_Instance.py
+++ b/xos/model_policies/model_policy_Instance.py
@@ -1,3 +1,35 @@
+def handle_container_on_metal(instance):
+        from core.models import Instance, Flavor, Port, Image
+
+        if instance.deleted:
+            return
+
+        # Our current docker network strategy requires that there be some
+        # VM on the server that connects to the networks, so that
+        # the containers can piggyback off of that configuration.
+        if not Instance.objects.filter(slice=instance.slice, node=instance.node, isolation="vm").exists():
+            flavors = Flavor.objects.filter(name="m1.small")
+            if not flavors:
+                raise XOSConfigurationError("No m1.small flavor")
+
+            images = Image.objects.filter(kind="vm")
+
+            companion_instance = Instance(slice = instance.slice,
+                            node = instance.node,
+                            image = images[0],
+                            creator = instance.creator,
+                            deployment = instance.node.site_deployment.deployment,
+                            flavor = flavors[0])
+            companion_instance.save()
+
+        # Add the ports for the container
+        for network in instance.slice.networks.all():
+            if (network.name.endswith("-nat")):
+                continue
+
+            if not Port.objects.filter(network=network, instance=instance).exists():
+                port = Port(network = network, instance=instance)
+                port.save()
 
 def handle(instance):
     from core.models import Controller, ControllerSlice, ControllerNetwork, NetworkSlice
@@ -7,7 +39,10 @@
                                                                 controller=instance.node.site_deployment.controller)
 
     for cn in controller_networks:
-        if (cn.lazy_blocked):	
+        if (cn.lazy_blocked):
 		cn.lazy_blocked=False
 		cn.backend_register = '{}'
 		cn.save()
+
+    if (instance.isolation=="container"):
+        handle_container_on_metal(instance)
diff --git a/xos/openstack_observer/steps/sync_container.py b/xos/openstack_observer/steps/sync_container.py
index ae598b8..fef08d2 100644
--- a/xos/openstack_observer/steps/sync_container.py
+++ b/xos/openstack_observer/steps/sync_container.py
@@ -40,7 +40,7 @@
 
     def get_instance_port(self, container_port):
         for p in container_port.network.links.all():
-            if (p.instance) and (p.instance.kind=="vm") and (p.instance.node == container_port.container.node) and (p.mac):
+            if (p.instance) and (p.instance.isolation=="vm") and (p.instance.node == container_port.instance.node) and (p.mac):
                 return p
         return None