AssertionError: backend 'postgresql' unavailable 与 AssertionError: backend 'mysql' unavailable

Openstack 版本:Queens

我在运行neutron-fwaas 与tap-as-a-service的单元测试时都遇到了这个问题

AssertionError: backend 'mysql' unavailable
AssertionError: backend 'postgresql' unavailable

网上搜了两三天,没有任何解决方案,对,是任何!!!最后我着急了,直接看他的报错信息分析源代码搞定了

在neutron/tests/functional/db/test_migrations.py中,有个做测试用的_TestModelsMigrations类,类的注释是这么写的

class _TestModelsMigrations(test_migrations.ModelsMigrationsSync):
    '''Test for checking of equality models state and migrations.

    For the opportunistic testing you need to set up a db named
    'openstack_citest' with user 'openstack_citest' and password
    'openstack_citest' on localhost.
    The test will then use that db and user/password combo to run the tests.

    For PostgreSQL on Ubuntu this can be done with the following commands::

        sudo -u postgres psql
        postgres=# create user openstack_citest with createdb login password
                  'openstack_citest';
        postgres=# create database openstack_citest with owner
                   openstack_citest;

    For MySQL on Ubuntu this can be done with the following commands::

        mysql -u root
        >create database openstack_citest;
        >grant all privileges on openstack_citest.* to
         openstack_citest@localhost identified by 'openstack_citest';

原来还要在mysql与postgresql里面创建opestack_citest用户与数据库啊

于是执行

sudo -u postgres psql
postgres=# create user openstack_citest with createdb login password
                  'openstack_citest';
postgres=# create database openstack_citest with owner
                   openstack_citest;

mysql -u root
>create database openstack_citest;
>grant all privileges on openstack_citest.* to openstack_citest@localhost
 identified by 'openstack_citest';

然后在tox.ini所在的目录执行

tox -e py27

仍然报错

sqlalchemy.exc.OperationalError: (pymysql.err.OperationalError)
 (1044, u"Access denied for user 'openstack_citest'@'localhost' 
to database 'abojtodlis'") [SQL: 'CREATE DATABASE abojtodlis'] 
(Background on this error at: http://sqlalche.me/e/e3q8)

查了一下,是openstack_citest这个用户没有创建数据库的权限,

在mysql命令中输入下面的命令即可

mysql> grant all privileges on *.* to openstack_citest@localhost identified by 'openstack_citest';

最后搞定

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值