¡@

Home 

OpenStack Study: scrubber.py

OpenStack Index

**** CubicPower OpenStack Study ****

def main():

    CONF.register_cli_opt(

        cfg.BoolOpt('daemon',

                    short='D',

                    default=False,

                    help='Run as a long-running process. When not '

                         'specified (the default) run the scrub operation '

                         'once and then exits. When specified do not exit '

                         'and run scrub on wakeup_time interval as '

                         'specified in the config.'))

    CONF.register_opt(cfg.IntOpt('wakeup_time', default=300))

    try:

        config.parse_args()

        log.setup('glance')

        glance.store.create_stores()

        glance.store.verify_default_store()

        app = scrubber.Scrubber(glance.store)

        if CONF.daemon:

            server = scrubber.Daemon(CONF.wakeup_time)

            server.start(app)

            server.wait()

        else:

            import eventlet

            pool = eventlet.greenpool.GreenPool(1000)

            app.run(pool)

    except RuntimeError as e:

        sys.exit("ERROR: %s" % e)

if __name__ == '__main__':

    main()