remove code that had been migrated to TenantWithContainer
diff --git a/xos/cord/models.py b/xos/cord/models.py
index 68bd2ba..d55ff2d 100644
--- a/xos/cord/models.py
+++ b/xos/cord/models.py
@@ -477,66 +477,6 @@
def __init__(self, *args, **kwargs):
super(VCPETenant, self).__init__(*args, **kwargs)
self.cached_vbng=None
- self.cached_instance=None
- self.orig_instance_id = self.get_initial_attribute("instance_id")
-
- @property
- def image(self):
- LOOK_FOR_IMAGES=["ubuntu-vcpe4", # ONOS demo machine -- preferred vcpe image
- "Ubuntu 14.04 LTS", # portal
- "Ubuntu-14.04-LTS", # ONOS demo machine
- ]
- for image_name in LOOK_FOR_IMAGES:
- images = Image.objects.filter(name = image_name)
- if images:
- return images[0]
-
- raise XOSProgrammingError("No VPCE image (looked for %s)" % str(LOOK_FOR_IMAGES))
-
- @property
- def instance(self):
- if getattr(self, "cached_instance", None):
- return self.cached_instance
- instance_id=self.get_attribute("instance_id")
- if not instance_id:
- return None
- instances=Instance.objects.filter(id=instance_id)
- if not instances:
- return None
- instance=instances[0]
- instance.caller = self.creator
- self.cached_instance = instance
- return instance
-
- @instance.setter
- def instance(self, value):
- if value:
- value = value.id
- if (value != self.get_attribute("instance_id", None)):
- self.cached_instance=None
- self.set_attribute("instance_id", value)
-
- @property
- def creator(self):
- if getattr(self, "cached_creator", None):
- return self.cached_creator
- creator_id=self.get_attribute("creator_id")
- if not creator_id:
- return None
- users=User.objects.filter(id=creator_id)
- if not users:
- return None
- user=users[0]
- self.cached_creator = users[0]
- return user
-
- @creator.setter
- def creator(self, value):
- if value:
- value = value.id
- if (value != self.get_attribute("creator_id", None)):
- self.cached_creator=None
- self.set_attribute("creator_id", value)
@property
def vbng(self):
@@ -659,53 +599,6 @@
def is_synced(self, value):
pass
- def pick_node(self):
- nodes = list(Node.objects.all())
- # TODO: logic to filter nodes by which nodes are up, and which
- # nodes the slice can instantiate on.
- nodes = sorted(nodes, key=lambda node: node.instances.all().count())
- return nodes[0]
-
- def manage_instance(self):
- # Each VCPE object owns exactly one instance.
-
- if self.deleted:
- return
-
- if (self.instance is not None) and (self.instance.image != self.image):
- self.instance.delete()
- self.instance = None
-
- if self.instance is None:
- if not self.provider_service.slices.count():
- raise XOSConfigurationError("The VCPE service has no slices")
-
- flavors = Flavor.objects.filter(name="m1.small")
- if not flavors:
- raise XOSConfigurationError("No m1.small flavor")
-
- node =self.pick_node()
- instance = Instance(slice = self.provider_service.slices.all()[0],
- node = node,
- image = self.image,
- creator = self.creator,
- deployment = node.site_deployment.deployment,
- flavor = flavors[0])
- instance.save()
-
- try:
- self.instance = instance
- super(VCPETenant, self).save()
- except:
- instance.delete()
- raise
-
- def cleanup_instance(self):
- if self.instance:
- # print "XXX cleanup instance", self.instance
- self.instance.delete()
- self.instance = None
-
def manage_vbng(self):
# Each vCPE object owns exactly one vBNG object