예제 #1
0
    def _check_healthpolicy(self):
        """Check if version 1.0 health policies exists

        Stein introduces health policy version 1.1 which is incompatible with
        health policy version 1.0.  Users are required to delete version 1.0
        health policies before upgrade and recreate them in version 1.1 format
        after upgrading.
        """

        engine = api.get_engine()
        metadata = MetaData(bind=engine)
        policy = Table('policy', metadata, autoload=True)

        healthpolicy_select = (select(
            [column('name')]).select_from(policy).where(
                column('type') == 'senlin.policy.health-1.0'))
        healthpolicy_rows = engine.execute(healthpolicy_select).fetchall()

        if not healthpolicy_rows:
            return upgradecheck.Result(upgradecheck.Code.SUCCESS)

        healthpolicy_names = [row[0] for row in healthpolicy_rows]
        error_msg = _('The following version 1.0 health policies must be '
                      'deleted before upgrade: \'{}\'. After upgrading, the '
                      'health policies can be recreated in version 1.1 '
                      'format.').format(', '.join(healthpolicy_names))
        return upgradecheck.Result(upgradecheck.Code.FAILURE, error_msg)
예제 #2
0
파일: manage.py 프로젝트: epim/senlin
def do_event_purge():
    """Purge the specified event records in senlin's database."""
    if CONF.command.age < 0:
        print(_("age must be a positive integer."))
        return
    api.event_purge(api.get_engine(), CONF.command.project_id,
                    CONF.command.granularity, CONF.command.age)
예제 #3
0
def do_event_purge():
    '''Purge the specified event records in senlin's database.'''
    if CONF.command.age < 0:
        print("age should be a positive integer!")
        return
    api.event_purge(api.get_engine(), CONF.command.project_id,
                    CONF.command.granularity, CONF.command.age)
예제 #4
0
def setup_dummy_db():
    options.cfg.set_defaults(options.database_opts, sqlite_synchronous=False)
    options.set_defaults(cfg.CONF,
                         connection="sqlite://",
                         sqlite_db='senlin.db')
    engine = db_api.get_engine()
    db_api.db_sync(engine)
    engine.connect()
예제 #5
0
파일: utils.py 프로젝트: jonnary/senlin
def setup_dummy_db():
    options.cfg.set_defaults(options.database_opts, sqlite_synchronous=False)
    options.set_defaults(cfg.CONF,
                         connection="sqlite://",
                         sqlite_db='senlin.db')
    engine = db_api.get_engine()
    db_api.db_sync(engine)
    engine.connect()
예제 #6
0
def reset_dummy_db():
    engine = db_api.get_engine()
    meta = sqlalchemy.MetaData()
    meta.reflect(bind=engine)

    for table in reversed(meta.sorted_tables):
        if table.name == 'migrate_version':
            continue
        engine.execute(table.delete())
예제 #7
0
파일: utils.py 프로젝트: jonnary/senlin
def reset_dummy_db():
    engine = db_api.get_engine()
    meta = sqlalchemy.MetaData()
    meta.reflect(bind=engine)

    for table in reversed(meta.sorted_tables):
        if table.name == 'migrate_version':
            continue
        engine.execute(table.delete())
예제 #8
0
def do_action_purge():
    """Purge the specified action records in senlin's database."""
    age = CONF.command.age

    if age < 0:
        print(_("Age must be a positive integer."))
        return

    if CONF.command.granularity == 'days':
        age = age * 86400
    elif CONF.command.granularity == 'hours':
        age = age * 3600
    elif CONF.command.granularity == 'minutes':
        age = age * 60

    if age < CONF.default_action_timeout:
        print(_("Age must be greater than the default action timeout."))
        return
    api.action_purge(api.get_engine(), CONF.command.project_id,
                     CONF.command.granularity, CONF.command.age)
예제 #9
0
파일: manage.py 프로젝트: epim/senlin
def do_db_sync():
    """Place a database under migration control and upgrade.

    DB is created first if necessary.
    """
    api.db_sync(api.get_engine(), CONF.command.version)
예제 #10
0
파일: manage.py 프로젝트: epim/senlin
def do_db_version():
    """Print database's current migration level."""
    print(api.db_version(api.get_engine()))
예제 #11
0
파일: manage.py 프로젝트: tengqm/senlin
def do_db_sync():
    """Place a database under migration control and upgrade,
    creating first if necessary.
    """
    api.db_sync(api.get_engine(), CONF.command.version)
예제 #12
0
파일: manage.py 프로젝트: tengqm/senlin
def do_db_version():
    """Print database's current migration level."""
    print(api.db_version(api.get_engine()))
예제 #13
0
def do_db_sync():
    '''Place a database under migration control and upgrade.

    DB is created first if necessary.
    '''
    api.db_sync(api.get_engine(), CONF.command.version)