¡@

Home 

OpenStack Study: compute.py

OpenStack Index

**** CubicPower OpenStack Study ****

def block_db_access():

    class NoDB(object):

        def __getattr__(self, attr):

            return self

        def __call__(self, *args, **kwargs):

            stacktrace = "".join(traceback.format_stack())

            LOG = logging.getLogger('nova.compute')

            LOG.error(_('No db access allowed in nova-compute: %s'),

                      stacktrace)

            raise exception.DBNotAllowed('nova-compute')

    nova.db.api.IMPL = NoDB()

**** CubicPower OpenStack Study ****

def main():

    objects.register_all()

    config.parse_args(sys.argv)

    logging.setup('nova')

    utils.monkey_patch()

    gmr.TextGuruMeditation.setup_autorun(version)

    if not CONF.conductor.use_local:

        block_db_access()

        objects_base.NovaObject.indirection_api = \

            conductor_rpcapi.ConductorAPI()

    server = service.Service.create(binary='nova-compute',

                                    topic=CONF.compute_topic,

                                    db_allowed=CONF.conductor.use_local)

    service.serve(server)

    service.wait()