CORD-1244 remove ControllerManager and InstanceManager
Change-Id: I9ecac53dbbb32c3bb4d1b3627eeb4013b32081cf
diff --git a/xos/core/models/attic/controller_model.py b/xos/core/models/attic/controller_model.py
index e20370c..78a6896 100644
--- a/xos/core/models/attic/controller_model.py
+++ b/xos/core/models/attic/controller_model.py
@@ -1,6 +1,3 @@
-objects = ControllerManager()
-deleted_objects = ControllerDeletionManager()
-
def __init__(self, *args, **kwargs):
super(Controller, self).__init__(*args, **kwargs)
self.no_sync=True
diff --git a/xos/core/models/attic/controllercredential_model.py b/xos/core/models/attic/controllercredential_model.py
deleted file mode 100644
index e8a03a8..0000000
--- a/xos/core/models/attic/controllercredential_model.py
+++ /dev/null
@@ -1,3 +0,0 @@
-objects = ControllerLinkManager()
-deleted_objects = ControllerLinkDeletionManager()
-
diff --git a/xos/core/models/attic/controllerdashboardview_model.py b/xos/core/models/attic/controllerdashboardview_model.py
deleted file mode 100644
index bb2ede2..0000000
--- a/xos/core/models/attic/controllerdashboardview_model.py
+++ /dev/null
@@ -1,2 +0,0 @@
-objects = ControllerLinkManager()
-deleted_objects = ControllerLinkDeletionManager()
diff --git a/xos/core/models/attic/controllerimages_model.py b/xos/core/models/attic/controllerimages_model.py
index 1a6652c..f97e0c7 100644
--- a/xos/core/models/attic/controllerimages_model.py
+++ b/xos/core/models/attic/controllerimages_model.py
@@ -1,5 +1,2 @@
class Meta:
unique_together = ('image', 'controller')
-
-objects = ControllerLinkManager()
-deleted_objects = ControllerLinkDeletionManager()
diff --git a/xos/core/models/attic/controllernetwork_model.py b/xos/core/models/attic/controllernetwork_model.py
index b1c9247..dfd7e05 100644
--- a/xos/core/models/attic/controllernetwork_model.py
+++ b/xos/core/models/attic/controllernetwork_model.py
@@ -1,6 +1,3 @@
-objects = ControllerLinkManager()
-deleted_objects = ControllerLinkDeletionManager()
-
class Meta:
unique_together = ('network', 'controller')
diff --git a/xos/core/models/attic/controllersiteprivilege_model.py b/xos/core/models/attic/controllersiteprivilege_model.py
index c082663..0c3e4a2 100644
--- a/xos/core/models/attic/controllersiteprivilege_model.py
+++ b/xos/core/models/attic/controllersiteprivilege_model.py
@@ -1,6 +1,3 @@
-objects = ControllerLinkManager()
-deleted_objects = ControllerLinkDeletionManager()
-
class Meta:
unique_together = ('controller', 'site_privilege', 'role_id')
diff --git a/xos/core/models/attic/controllerslice_model.py b/xos/core/models/attic/controllerslice_model.py
index b55ed16..fb41fd3 100644
--- a/xos/core/models/attic/controllerslice_model.py
+++ b/xos/core/models/attic/controllerslice_model.py
@@ -1,6 +1,3 @@
-objects = ControllerLinkManager()
-deleted_objects = ControllerLinkDeletionManager()
-
class Meta:
unique_together = ('controller', 'slice')
@@ -22,13 +19,3 @@
qs = ControllerSlice.objects.filter(slice__in=slices)
return qs
-def get_cpu_stats(self):
- filter = 'project_id=%s'%self.tenant_id
- return monitor.get_meter('cpu',filter,None)
-
-def get_bw_stats(self):
- filter = 'project_id=%s'%self.tenant_id
- return monitor.get_meter('network.outgoing.bytes',filter,None)
-
-def get_node_stats(self):
- return len(self.slice.instances)
diff --git a/xos/core/models/attic/controlleruser_model.py b/xos/core/models/attic/controlleruser_model.py
index 0b485c5..354ae4a 100644
--- a/xos/core/models/attic/controlleruser_model.py
+++ b/xos/core/models/attic/controlleruser_model.py
@@ -1,6 +1,3 @@
-objects = ControllerLinkManager()
-deleted_objects = ControllerLinkDeletionManager()
-
class Meta:
unique_together = ('user', 'controller')
diff --git a/xos/core/models/attic/header.py b/xos/core/models/attic/header.py
index c7cac96..6a19856 100644
--- a/xos/core/models/attic/header.py
+++ b/xos/core/models/attic/header.py
@@ -98,122 +98,4 @@
return flavors[0]
-class InstanceDeletionManager(PlCoreBaseDeletionManager):
- def get_queryset(self):
- parent=super(InstanceDeletionManager, self)
- try:
- backend_type = config.observer_backend_type
- except AttributeError:
- backend_type = None
-
- parent_queryset = parent.get_queryset() if hasattr(parent, "get_queryset") else parent.get_query_set()
- if (backend_type):
- return parent_queryset.filter(Q(node__controller__backend_type=backend_type))
- else:
- return parent_queryset
-
- # deprecated in django 1.7 in favor of get_queryset().
- def get_query_set(self):
- return self.get_queryset()
-
-
-class InstanceManager(PlCoreBaseManager):
- def get_queryset(self):
- parent=super(InstanceManager, self)
-
- try:
- backend_type = config.observer_backend_type
- except AttributeError:
- backend_type = None
-
- parent_queryset = parent.get_queryset() if hasattr(parent, "get_queryset") else parent.get_query_set()
-
- if backend_type:
- return parent_queryset.filter(Q(node__controller__backend_type=backend_type))
- else:
- return parent_queryset
-
- # deprecated in django 1.7 in favor of get_queryset().
- def get_query_set(self):
- return self.get_queryset()
-
-class ControllerLinkDeletionManager(PlCoreBaseDeletionManager):
- def get_queryset(self):
- parent=super(ControllerLinkDeletionManager, self)
- try:
- backend_type = config.observer_backend_type
- except AttributeError:
- backend_type = None
-
- parent_queryset = parent.get_queryset() if hasattr(parent, "get_queryset") else parent.get_query_set()
- if (backend_type):
- return parent_queryset.filter(Q(controller__backend_type=backend_type))
- else:
- return parent_queryset
-
- # deprecated in django 1.7 in favor of get_queryset().
- def get_query_set(self):
- return self.get_queryset()
-
-
-class ControllerDeletionManager(PlCoreBaseDeletionManager):
- def get_queryset(self):
- parent=super(ControllerDeletionManager, self)
-
- try:
- backend_type = config.observer_backend_type
- except AttributeError:
- backend_type = None
-
- parent_queryset = parent.get_queryset() if hasattr(parent, "get_queryset") else parent.get_query_set()
-
- if backend_type:
- return parent_queryset.filter(Q(backend_type=backend_type))
- else:
- return parent_queryset
-
- # deprecated in django 1.7 in favor of get_queryset().
- def get_query_set(self):
- return self.get_queryset()
-
-class ControllerLinkManager(PlCoreBaseManager):
- def get_queryset(self):
- parent=super(ControllerLinkManager, self)
-
- try:
- backend_type = config.observer_backend_type
- except AttributeError:
- backend_type = None
-
- parent_queryset = parent.get_queryset() if hasattr(parent, "get_queryset") else parent.get_query_set()
-
- if backend_type:
- return parent_queryset.filter(Q(controller__backend_type=backend_type))
- else:
- return parent_queryset
-
- # deprecated in django 1.7 in favor of get_queryset().
- def get_query_set(self):
- return self.get_queryset()
-
-
-class ControllerManager(PlCoreBaseManager):
- def get_queryset(self):
- parent=super(ControllerManager, self)
-
- try:
- backend_type = config.observer_backend_type
- except AttributeError:
- backend_type = None
-
- parent_queryset = parent.get_queryset() if hasattr(parent, "get_queryset") else parent.get_query_set()
-
- if backend_type:
- return parent_queryset.filter(Q(backend_type=backend_type))
- else:
- return parent_queryset
-
- # deprecated in django 1.7 in favor of get_queryset().
- def get_query_set(self):
- return self.get_queryset()
diff --git a/xos/core/models/attic/image_model.py b/xos/core/models/attic/image_model.py
deleted file mode 100644
index e8a03a8..0000000
--- a/xos/core/models/attic/image_model.py
+++ /dev/null
@@ -1,3 +0,0 @@
-objects = ControllerLinkManager()
-deleted_objects = ControllerLinkDeletionManager()
-
diff --git a/xos/core/models/attic/instance_model.py b/xos/core/models/attic/instance_model.py
index 95cd54e..d2e7b89 100644
--- a/xos/core/models/attic/instance_model.py
+++ b/xos/core/models/attic/instance_model.py
@@ -1,6 +1,3 @@
-objects = InstanceManager()
-deleted_objects = InstanceDeletionManager()
-
def get_controller (self):
return self.node.site_deployment.controller
@@ -104,18 +101,6 @@
qs = Instance.objects.filter(slice__in=slices)
return qs
-def get_cpu_stats(self):
- filter = 'instance_id=%s'%self.instance_id
- return monitor.get_meter('cpu',filter,None)
-
-def get_bw_stats(self):
- filter = 'instance_id=%s'%self.instance_id
- return monitor.get_meter('network.outgoing.bytes',filter,None)
-
-def get_node_stats(self):
- # Note sure what should go back here
- return 1
-
def get_ssh_command(self):
if (not self.instance_id) or (not self.node) or (not self.instance_name):
return None
diff --git a/xos/core/models/attic/site_model.py b/xos/core/models/attic/site_model.py
index df5ea4e..f16b1a8 100644
--- a/xos/core/models/attic/site_model.py
+++ b/xos/core/models/attic/site_model.py
@@ -1,6 +1,3 @@
-objects = ControllerManager()
-deleted_objects = ControllerDeletionManager()
-
def can_update(self, user):
return user.can_update_site(self, allow=['pi'])
diff --git a/xos/core/models/attic/sitedeployment_model.py b/xos/core/models/attic/sitedeployment_model.py
index f9c33d1..8d79f23 100644
--- a/xos/core/models/attic/sitedeployment_model.py
+++ b/xos/core/models/attic/sitedeployment_model.py
@@ -1,6 +1,3 @@
-objects = ControllerLinkManager()
-deleted_objects = ControllerLinkDeletionManager()
-
class Meta:
unique_together = ('site', 'deployment', 'controller')
diff --git a/xos/genx/targets/init.xtarget b/xos/genx/targets/init.xtarget
index 417e145..770502d 100644
--- a/xos/genx/targets/init.xtarget
+++ b/xos/genx/targets/init.xtarget
@@ -7,7 +7,6 @@
from .dashboardview import DashboardView
from .user import User
from .user import UserDashboardView
-from .header import ControllerManager, ControllerDeletionManager, ControllerLinkManager,ControllerLinkDeletionManager
from .journal import JournalEntry, journal_object
{% for m in proto.messages -%}