new oslo conf for rpc wamp server - removed useless code

This commit is contained in:
root 2015-12-01 17:50:12 +01:00
parent d869152323
commit 5126efec5c
7 changed files with 29 additions and 32 deletions

View File

@ -23,4 +23,7 @@ auth_strategy=noauth
[database]
connection = mysql://<user>:<password>@<host>/iotronic
[wamp]
#wamp_ip = <ip>
#wamp_port = <port>
#wamp_realm = s4t

View File

@ -10,7 +10,6 @@ from iotronic.api.controllers import base
from iotronic.common import exception
import wsme
import pecan
from pecan import rest
import code

View File

@ -718,7 +718,7 @@ class ConductorManager(periodic_task.PeriodicTasks):
self.del_host()
from iotronic.wamp.rpcwampserver import RPC_Wamp_Server
c=RPC_Wamp_Server('127.0.0.1','8181','s4t')
RPC_Wamp_Server()

View File

@ -280,29 +280,6 @@ class Connection(api.Connection):
raise exception.DuplicateCode(code=values['code'])
raise exception.BoardAlreadyExists(uuid=values['uuid'])
return node
"""
if 'uuid' not in values:
values['uuid'] = uuidutils.generate_uuid()
if 'power_state' not in values:
values['power_state'] = states.NOSTATE
if 'provision_state' not in values:
# TODO(deva): change this to ENROLL
values['provision_state'] = states.AVAILABLE
node = models.Node()
node.update(values)
try:
node.save()
except db_exc.DBDuplicateEntry as exc:
if 'name' in exc.columns:
raise exception.DuplicateName(name=values['name'])
elif 'instance_uuid' in exc.columns:
raise exception.InstanceAssociated(
instance_uuid=values['instance_uuid'],
node=values['uuid'])
raise exception.NodeAlreadyExists(uuid=values['uuid'])
return node
"""
def get_node_by_id(self, node_id):
query = model_query(models.Node).filter_by(id=node_id)

View File

@ -117,6 +117,7 @@ class SessionWP(base.IotronicObject):
sort_dir=sort_dir)
return SessionWP._from_db_object_list(db_sessions, cls, context)
'''
@base.remotable_classmethod
def list_by_node_id(cls, context, node_id, limit=None, marker=None,
sort_key=None, sort_dir=None):
@ -136,7 +137,8 @@ class SessionWP(base.IotronicObject):
sort_key=sort_key,
sort_dir=sort_dir)
return SessionWP._from_db_object_list(db_sessions, cls, context)
'''
@base.remotable
def create(self,context=None):
"""Create a SessionWP record in the DB.

View File

@ -41,6 +41,4 @@ def registration(code_node,session_num):
session.create()
session.save()
return unicode(response)
'''
return unicode(response)

View File

@ -3,9 +3,24 @@ from autobahn.twisted.wamp import ApplicationSession, ApplicationRunner
import multiprocessing
from twisted.internet import reactor
from oslo_log import log
from oslo_config import cfg
LOG = log.getLogger(__name__)
wamp_opts = [
cfg.StrOpt('wamp_ip',
default='127.0.0.1',
help=('URL of wamp broker')),
cfg.IntOpt('wamp_port',
default=8181,
help='port wamp broker'),
cfg.StrOpt('wamp_realm',
default='s4t',
help=('realm broker')),
]
CONF = cfg.CONF
CONF.register_opts(wamp_opts, 'wamp')
class RPCWampManager(ApplicationSession):
def __init__(self, config=None):
@ -61,8 +76,11 @@ class RPCWampServer:
class RPC_Wamp_Server:
def __init__(self,ip,port,realm):
server = RPCWampServer(ip,port,realm)
def __init__(self):
self.ip=unicode(CONF.wamp.wamp_ip)
self.port=unicode(CONF.wamp.wamp_port)
self.realm=unicode(CONF.wamp.wamp_realm)
server = RPCWampServer(self.ip,self.port,self.realm)
server.start()
multi = multiprocessing.Process(target=reactor.run,args=())
multi.start()