DB controller
This commit is contained in:
parent
f2a7b0829a
commit
48812773be
|
@ -15,10 +15,13 @@
|
|||
|
||||
from oslo_utils import uuidutils
|
||||
|
||||
from wan_qos.db.models import wan_tc as model
|
||||
from wan_qos.db.models import wan_tc as models
|
||||
from wan_qos.common import constants
|
||||
|
||||
|
||||
class WanTcDb():
|
||||
class WanTcDb(object):
|
||||
def create_wan_tc_class(self, context, wan_qos_class):
|
||||
pass
|
||||
|
||||
def get_all_classes(self, context):
|
||||
return context.session.query(models.WanTcClass).all()
|
||||
|
|
|
@ -27,6 +27,7 @@ from wan_qos.common import api
|
|||
from wan_qos.common import constants
|
||||
from wan_qos.common import topics
|
||||
from wan_qos.extensions import wanqos
|
||||
from wan_qos.db import wan_qos_db
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
|
@ -45,7 +46,6 @@ class PluginRpcCallback(object):
|
|||
|
||||
|
||||
class WanQosPlugin(wanqos.WanQosPluginBase):
|
||||
|
||||
supported_extension_aliases = ["wan-tc"]
|
||||
|
||||
def __init__(self):
|
||||
|
@ -60,6 +60,8 @@ class WanQosPlugin(wanqos.WanQosPluginBase):
|
|||
fanout=False)
|
||||
self.conn.consume_in_threads()
|
||||
|
||||
self.db = wan_qos_db.WanTcDb()
|
||||
|
||||
def get_plugin_type(self):
|
||||
"""Get type of the plugin."""
|
||||
return constants.WANTC
|
||||
|
@ -74,7 +76,7 @@ class WanQosPlugin(wanqos.WanQosPluginBase):
|
|||
def get_wan_tcs(self, context, filters=None, fields=None,
|
||||
sorts=None, limit=None, marker=None,
|
||||
page_reverse=False):
|
||||
pass
|
||||
return self.db.get_all_classes(context)
|
||||
|
||||
def delete_wan_tc(self, context, id):
|
||||
pass
|
||||
|
@ -86,9 +88,7 @@ class WanQosPlugin(wanqos.WanQosPluginBase):
|
|||
pass
|
||||
# self.agent_rpc.create_wan_qos(context, wan_qos)
|
||||
|
||||
tenant_id = self._get_tenant_id_for_create(context, wan_qos_class)
|
||||
|
||||
|
||||
# tenant_id = self._get_tenant_id_for_create(context, wan_qos_class)
|
||||
|
||||
@staticmethod
|
||||
def _get_tenant_id_for_create(self, context, resource):
|
||||
|
@ -104,8 +104,6 @@ class WanQosPlugin(wanqos.WanQosPluginBase):
|
|||
return tenant_id
|
||||
|
||||
|
||||
|
||||
|
||||
def agent_up_notification(self, host):
|
||||
LOG.debug('agent %s is up' % host)
|
||||
return 'OK'
|
||||
LOG.debug('agent %s is up' % host)
|
||||
return 'OK'
|
||||
|
|
Loading…
Reference in New Issue