diff --git a/cyborg/__init__.py b/cyborg/__init__.py index a104023e..d0f34f07 100644 --- a/cyborg/__init__.py +++ b/cyborg/__init__.py @@ -16,4 +16,4 @@ import pbr.version __version__ = pbr.version.VersionInfo( - 'nomad').version_string() + 'cyborg').version_string() diff --git a/cyborg/accelerator/accelerator.py b/cyborg/accelerator/accelerator.py index b2862588..1c818684 100644 --- a/cyborg/accelerator/accelerator.py +++ b/cyborg/accelerator/accelerator.py @@ -14,9 +14,19 @@ # License for the specific language governing permissions and limitations # under the License. +from sqlalchemy import Column, Integer, String +from sqlalchemy.ext.declarative import declarative_base +Base = declarative_base() + # A common internal acclerator object for internal use. -class accelerator(object): +class accelerator(Base): + __tablename__ = 'accelerators' + accelerator_id = Column(String, primary_key=True) + device_type = Column(String) + remoteable = Column(Integer) + vender_id = Column(String) + product_id = Column(String) def __init__(self, **kwargs): self.accelerator_id = kwargs['accelerator_id'] diff --git a/cyborg/agent/agent.conf b/cyborg/agent/agent.conf index 62aa3082..2cbfdf3c 100644 --- a/cyborg/agent/agent.conf +++ b/cyborg/agent/agent.conf @@ -1,3 +1,3 @@ -[DEFAULT] +[cyborg] transport_url= server_id= diff --git a/cyborg/agent/agent.py b/cyborg/agent/agent.py index d557895d..d61a1bec 100644 --- a/cyborg/agent/agent.py +++ b/cyborg/agent/agent.py @@ -31,7 +31,9 @@ LOG = logging.getLogger(__name__) logging.register_options(CONF) logging.setup(CONF, 'Cyborg.Agent') -url = messaging.TransportURL.parse(CONF, url=CONF.transport_url) +CONF(['--config-file', 'agent.conf']) + +url = messaging.TransportURL.parse(CONF, url=CONF.cyborg.transport_url) transport = messaging.get_notification_transport(CONF, url) notifier = messaging.Notifier(transport, @@ -39,7 +41,8 @@ notifier = messaging.Notifier(transport, publisher_id='Cyborg.Agent', topic='info') -rpc_targets = messaging.Target(topic='cyborg_control', server=CONF.server_id) +rpc_targets = messaging.Target(topic='cyborg_control', + server=CONF.cyborg.server_id) rpc_endpoints = [ rpcapi.RPCEndpoint() ] diff --git a/cyborg/agent/conf.py b/cyborg/agent/conf.py index df2e9bf3..96f5f32e 100644 --- a/cyborg/agent/conf.py +++ b/cyborg/agent/conf.py @@ -25,4 +25,4 @@ default_opts = [ def register_opts(conf): - conf.register_opts(default_opts) + conf.register_opts(default_opts, group='cyborg') diff --git a/cyborg/conductor/conductor.conf b/cyborg/conductor/conductor.conf index 62aa3082..50144e12 100644 --- a/cyborg/conductor/conductor.conf +++ b/cyborg/conductor/conductor.conf @@ -1,3 +1,4 @@ -[DEFAULT] +[cyborg] transport_url= server_id= +database_url= diff --git a/cyborg/conductor/conductor.py b/cyborg/conductor/conductor.py index 1e36af1d..7c995e56 100644 --- a/cyborg/conductor/conductor.py +++ b/cyborg/conductor/conductor.py @@ -19,6 +19,7 @@ from oslo_config import cfg from oslo_log import log as logging import oslo_messaging as messaging import rpcapi +from sqlalchemy import create_engine import time eventlet.monkey_patch() @@ -30,7 +31,8 @@ LOG = logging.getLogger(__name__) logging.register_options(CONF) logging.setup(CONF, 'Cyborg.Conductor') -url = messaging.TransportURL.parse(CONF, url=CONF.transport_url) +CONF(['--config-file', 'conductor.conf']) +url = messaging.TransportURL.parse(CONF, url=CONF.cyborg.transport_url) transport = messaging.get_notification_transport(CONF, url) message_endpoints = [ @@ -42,7 +44,8 @@ message_targets = [ messaging.Target(topic='warn'), messaging.Target(topic='error') ] -rpc_targets = messaging.Target(topic='cyborg_control', server=CONF.server_id) +rpc_targets = messaging.Target(topic='cyborg_control', + server=CONF.cyborg.server_id) rpc_endpoints = [ rpcapi.RPCEndpoint() ] @@ -59,6 +62,9 @@ message_server = messaging.get_notification_listener(transport, executor='eventlet', allow_requeue=True) +engine = create_engine(CONF.cyborg.connection, echo=True) +engine.connect() + try: message_server.start() rpc_server.start() diff --git a/cyborg/conductor/conf.py b/cyborg/conductor/conf.py index 4ab4ab06..3d2ce2ce 100644 --- a/cyborg/conductor/conf.py +++ b/cyborg/conductor/conf.py @@ -17,7 +17,12 @@ import uuid default_opts = [ cfg.StrOpt('transport_url', default='', - help='Transport url for messating'), + help='Transport url for messating, copy from transport_url= in \ + your Nova config default section'), + cfg.StrOpt('database_url', + default='', + help='Database url for storage, copy from connection= in your \ + Nova db config section'), cfg.StrOpt('server_id', default=uuid.uuid4(), help='Unique ID for this conductor instance'), @@ -25,4 +30,4 @@ default_opts = [ def register_opts(conf): - conf.register_opts(default_opts) + conf.register_opts(default_opts, group='cyborg')