Bug 1285462 - Rally DB writing should work without root privileges
Rally DB writing should work without root privileges
Status: NEW
Product: Red Hat OpenStack
Classification: Red Hat
Component: openstack-rally (Show other bugs)
8.0 (Liberty)
Unspecified Unspecified
unspecified Severity unspecified
: ---
: 8.0 (Liberty)
Assigned To: Chandan Kumar
Martin Kopec
: Automation, ZStream
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2015-11-25 11:19 EST by yfried
Modified: 2018-01-29 21:56 EST (History)
7 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed:
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description yfried 2015-11-25 11:19:03 EST
Description of problem:
Can't write to Rally DB as a regular user

Version-Release number of selected component (if applicable):
[cloud-user@testing-rally-rpm ~(keystone_admin)]$ cat /etc/redhat-release 
Red Hat Enterprise Linux Server release 7.2 (Maipo)
[cloud-user@testing-rally-rpm ~(keystone_admin)]$ rpm -qa | grep rally
openstack-rally-0.1.1-4.1.el7ost.noarch


How reproducible:


Steps to Reproduce:
1. sudo yum install openstack-rally -y
2. rally deployment create --name test_dep --fromenv


Actual results:
[cloud-user@testing-rally-rpm ~(keystone_admin)]$ rally -vd deployment create --name test_dep2 --fromenv
No handlers could be found for logger "oslo_config.cfg"
2015-11-25 11:14:13.116 9513 RALLYDEBUG rally.cli.cliutils [-] INFO logs from urllib3 and requests module are hide.
2015-11-25 11:14:13.117 9513 RALLYDEBUG rally.cli.cliutils [-] ERROR log from boto module is hide.
2015-11-25 11:14:13.960 9513 DEBUG oslo_db.api [-] Loading backend 'sqlalchemy' from 'rally.common.db.sqlalchemy.api' _load_backend /usr/lib/python2.7/site-packages/oslo_db/api.py:230
2015-11-25 11:14:14.184 9513 ERROR rally.cli.cliutils [-] (sqlite3.OperationalError) attempt to write a readonly database [SQL: u'INSERT INTO deployments (created_at, updated_at, uuid, parent_uuid, name, started_at, completed_at, config, admin, users, enum_deployments_status) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)'] [parameters: ('2015-11-25 16:14:14.181146', '2015-11-25 16:14:14.181172', '906fd674-434b-4956-bd12-1b0c4780631c', None, u'test_dep2', None, None, '{"admin": {"username": "admin", "tenant_name": "admin", "password": "qum5net"}, "type": "ExistingCloud", "endpoint": null, "auth_url": "http://10.35.160.183:5000/v2.0", "region_name": "RegionOne"}', None, <read-only buffer for 0x2e92d20, size -1, offset 0 at 0x2f5d6f0>, 'deploy->init')]
2015-11-25 11:14:14.184 9513 ERROR rally.cli.cliutils Traceback (most recent call last):
2015-11-25 11:14:14.184 9513 ERROR rally.cli.cliutils   File "/usr/lib/python2.7/site-packages/rally/cli/cliutils.py", line 547, in run
2015-11-25 11:14:14.184 9513 ERROR rally.cli.cliutils     ret = fn(*fn_args, **fn_kwargs)
2015-11-25 11:14:14.184 9513 ERROR rally.cli.cliutils   File "<string>", line 2, in create
2015-11-25 11:14:14.184 9513 ERROR rally.cli.cliutils   File "/usr/lib/python2.7/site-packages/rally/plugins/__init__.py", line 43, in ensure_plugins_are_loaded
2015-11-25 11:14:14.184 9513 ERROR rally.cli.cliutils     return f(*args, **kwargs)
2015-11-25 11:14:14.184 9513 ERROR rally.cli.cliutils   File "/usr/lib/python2.7/site-packages/rally/cli/commands/deployment.py", line 123, in create
2015-11-25 11:14:14.184 9513 ERROR rally.cli.cliutils     deployment = api.Deployment.create(config, name)
2015-11-25 11:14:14.184 9513 ERROR rally.cli.cliutils   File "/usr/lib/python2.7/site-packages/rally/api.py", line 51, in create
2015-11-25 11:14:14.184 9513 ERROR rally.cli.cliutils     deployment = objects.Deployment(name=name, config=config)
2015-11-25 11:14:14.184 9513 ERROR rally.cli.cliutils   File "/usr/lib/python2.7/site-packages/rally/common/objects/deploy.py", line 29, in __init__
2015-11-25 11:14:14.184 9513 ERROR rally.cli.cliutils     self.deployment = db.deployment_create(attributes)
2015-11-25 11:14:14.184 9513 ERROR rally.cli.cliutils   File "/usr/lib/python2.7/site-packages/rally/common/db/api.py", line 206, in deployment_create
2015-11-25 11:14:14.184 9513 ERROR rally.cli.cliutils     return get_impl().deployment_create(values)
2015-11-25 11:14:14.184 9513 ERROR rally.cli.cliutils   File "/usr/lib/python2.7/site-packages/rally/common/db/sqlalchemy/api.py", line 215, in deployment_create
2015-11-25 11:14:14.184 9513 ERROR rally.cli.cliutils     deployment.save()
2015-11-25 11:14:14.184 9513 ERROR rally.cli.cliutils   File "/usr/lib/python2.7/site-packages/rally/common/db/sqlalchemy/models.py", line 52, in save
2015-11-25 11:14:14.184 9513 ERROR rally.cli.cliutils     super(RallyBase, self).save(session=session)
2015-11-25 11:14:14.184 9513 ERROR rally.cli.cliutils   File "/usr/lib/python2.7/site-packages/oslo_db/sqlalchemy/models.py", line 48, in save
2015-11-25 11:14:14.184 9513 ERROR rally.cli.cliutils     session.flush()
2015-11-25 11:14:14.184 9513 ERROR rally.cli.cliutils   File "/usr/lib64/python2.7/site-packages/sqlalchemy/orm/session.py", line 2004, in flush
2015-11-25 11:14:14.184 9513 ERROR rally.cli.cliutils     self._flush(objects)
2015-11-25 11:14:14.184 9513 ERROR rally.cli.cliutils   File "/usr/lib64/python2.7/site-packages/sqlalchemy/orm/session.py", line 2122, in _flush
2015-11-25 11:14:14.184 9513 ERROR rally.cli.cliutils     transaction.rollback(_capture_exception=True)
2015-11-25 11:14:14.184 9513 ERROR rally.cli.cliutils   File "/usr/lib64/python2.7/site-packages/sqlalchemy/util/langhelpers.py", line 60, in __exit__
2015-11-25 11:14:14.184 9513 ERROR rally.cli.cliutils     compat.reraise(exc_type, exc_value, exc_tb)
2015-11-25 11:14:14.184 9513 ERROR rally.cli.cliutils   File "/usr/lib64/python2.7/site-packages/sqlalchemy/orm/session.py", line 2086, in _flush
2015-11-25 11:14:14.184 9513 ERROR rally.cli.cliutils     flush_context.execute()
2015-11-25 11:14:14.184 9513 ERROR rally.cli.cliutils   File "/usr/lib64/python2.7/site-packages/sqlalchemy/orm/unitofwork.py", line 373, in execute
2015-11-25 11:14:14.184 9513 ERROR rally.cli.cliutils     rec.execute(self)
2015-11-25 11:14:14.184 9513 ERROR rally.cli.cliutils   File "/usr/lib64/python2.7/site-packages/sqlalchemy/orm/unitofwork.py", line 532, in execute
2015-11-25 11:14:14.184 9513 ERROR rally.cli.cliutils     uow
2015-11-25 11:14:14.184 9513 ERROR rally.cli.cliutils   File "/usr/lib64/python2.7/site-packages/sqlalchemy/orm/persistence.py", line 174, in save_obj
2015-11-25 11:14:14.184 9513 ERROR rally.cli.cliutils     mapper, table, insert)
2015-11-25 11:14:14.184 9513 ERROR rally.cli.cliutils   File "/usr/lib64/python2.7/site-packages/sqlalchemy/orm/persistence.py", line 781, in _emit_insert_statements
2015-11-25 11:14:14.184 9513 ERROR rally.cli.cliutils     execute(statement, params)
2015-11-25 11:14:14.184 9513 ERROR rally.cli.cliutils   File "/usr/lib64/python2.7/site-packages/sqlalchemy/engine/base.py", line 914, in execute
2015-11-25 11:14:14.184 9513 ERROR rally.cli.cliutils     return meth(self, multiparams, params)
2015-11-25 11:14:14.184 9513 ERROR rally.cli.cliutils   File "/usr/lib64/python2.7/site-packages/sqlalchemy/sql/elements.py", line 323, in _execute_on_connection
2015-11-25 11:14:14.184 9513 ERROR rally.cli.cliutils     return connection._execute_clauseelement(self, multiparams, params)
2015-11-25 11:14:14.184 9513 ERROR rally.cli.cliutils   File "/usr/lib64/python2.7/site-packages/sqlalchemy/engine/base.py", line 1010, in _execute_clauseelement
2015-11-25 11:14:14.184 9513 ERROR rally.cli.cliutils     compiled_sql, distilled_params
2015-11-25 11:14:14.184 9513 ERROR rally.cli.cliutils   File "/usr/lib64/python2.7/site-packages/sqlalchemy/engine/base.py", line 1146, in _execute_context
2015-11-25 11:14:14.184 9513 ERROR rally.cli.cliutils     context)
2015-11-25 11:14:14.184 9513 ERROR rally.cli.cliutils   File "/usr/lib64/python2.7/site-packages/sqlalchemy/engine/base.py", line 1337, in _handle_dbapi_exception
2015-11-25 11:14:14.184 9513 ERROR rally.cli.cliutils     util.raise_from_cause(newraise, exc_info)
2015-11-25 11:14:14.184 9513 ERROR rally.cli.cliutils   File "/usr/lib64/python2.7/site-packages/sqlalchemy/util/compat.py", line 199, in raise_from_cause
2015-11-25 11:14:14.184 9513 ERROR rally.cli.cliutils     reraise(type(exception), exception, tb=exc_tb)
2015-11-25 11:14:14.184 9513 ERROR rally.cli.cliutils   File "/usr/lib64/python2.7/site-packages/sqlalchemy/engine/base.py", line 1139, in _execute_context
2015-11-25 11:14:14.184 9513 ERROR rally.cli.cliutils     context)
2015-11-25 11:14:14.184 9513 ERROR rally.cli.cliutils   File "/usr/lib64/python2.7/site-packages/sqlalchemy/engine/default.py", line 450, in do_execute
2015-11-25 11:14:14.184 9513 ERROR rally.cli.cliutils     cursor.execute(statement, parameters)
2015-11-25 11:14:14.184 9513 ERROR rally.cli.cliutils OperationalError: (sqlite3.OperationalError) attempt to write a readonly database [SQL: u'INSERT INTO deployments (created_at, updated_at, uuid, parent_uuid, name, started_at, completed_at, config, admin, users, enum_deployments_status) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)'] [parameters: ('2015-11-25 16:14:14.181146', '2015-11-25 16:14:14.181172', '906fd674-434b-4956-bd12-1b0c4780631c', None, u'test_dep2', None, None, '{"admin": {"username": "admin", "tenant_name": "admin", "password": "qum5net"}, "type": "ExistingCloud", "endpoint": null, "auth_url": "http://10.35.160.183:5000/v2.0", "region_name": "RegionOne"}', None, <read-only buffer for 0x2e92d20, size -1, offset 0 at 0x2f5d6f0>, 'deploy->init')]
2015-11-25 11:14:14.184 9513 ERROR rally.cli.cliutils 
(sqlite3.OperationalError) attempt to write a readonly database [SQL: u'INSERT INTO deployments (created_at, updated_at, uuid, parent_uuid, name, started_at, completed_at, config, admin, users, enum_deployments_status) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)'] [parameters: ('2015-11-25 16:14:14.181146', '2015-11-25 16:14:14.181172', '906fd674-434b-4956-bd12-1b0c4780631c', None, u'test_dep2', None, None, '{"admin": {"username": "admin", "tenant_name": "admin", "password": "qum5net"}, "type": "ExistingCloud", "endpoint": null, "auth_url": "http://10.35.160.183:5000/v2.0", "region_name": "RegionOne"}', None, <read-only buffer for 0x2e92d20, size -1, offset 0 at 0x2f5d6f0>, 'deploy->init')]
Looks like Rally can't connect to it's DB.
Make a sure that connection string in rally.conf is proper:
sqlite:////tmp/rally.sqlite


Expected results:
[cloud-user@testing-rally-rpm ~(keystone_admin)]$ rally deployment create --name test_dep --fromenv
2015-11-25 10:47:13.235 9235 INFO rally.deployment.engine [-] Deployment f3b7f5ef-bb9e-4e33-8287-552b8af5e646 | Starting:  OpenStack cloud deployment.
2015-11-25 10:47:13.916 9235 INFO rally.deployment.engine [-] Deployment f3b7f5ef-bb9e-4e33-8287-552b8af5e646 | Completed: OpenStack cloud deployment.
+--------------------------------------+----------------------------+----------+------------------+--------+
| uuid                                 | created_at                 | name     | status           | active |
+--------------------------------------+----------------------------+----------+------------------+--------+
| f3b7f5ef-bb9e-4e33-8287-552b8af5e646 | 2015-11-25 15:47:12.954034 | test_dep | deploy->finished |        |
+--------------------------------------+----------------------------+----------+------------------+--------+

Additional info:
Command works from root user.
Comment 2 Ruchika K 2016-08-31 13:22:38 EDT
Seeing this:

There exists a folder /etc/rally but no file 
/etc/rally/rally.conf



[stack@manager ~]$ cat /etc/redhat-release
Red Hat Enterprise Linux Server release 7.2 (Maipo)
[stack@manager ~]$ rpm -qa | grep rally
openstack-rally-0.1.1-4.2.el7ost.noarch
[stack@manager ~]$ sudo yum install gcc libffi-devel python-devel openssl-devel gmp-devel libxml2-devel libxslt-devel postgresql-devel redhat-rpm-config^C
[stack@manager ~]$ ls *.json
existing.json  instackenv.json  overcloud-env.json
[stack@manager ~]$ cat existing.json 
{
    "type": "ExistingCloud",
    "auth_url": "http://10.0.0.100:5000/v2.0/",
    "region_name": "RegionOne",
    "endpoint_type": "public",
    "admin": {
        "username": "admin",
        "password": "7VtT8sNR9JsBRcfKRNd6qhqXq",
        "tenant_name": "demo"
    },
    "https_insecure": false,
    "https_cacert": ""
}
[stack@manager ~]$  rally deployment create --file=existing.json --name=overcloud
Traceback (most recent call last):
  File "/usr/bin/rally", line 10, in <module>
    sys.exit(main())
  File "/usr/lib/python2.7/site-packages/rally/cli/main.py", line 42, in main
    return cliutils.run(sys.argv, categories)
  File "/usr/lib/python2.7/site-packages/rally/cli/cliutils.py", line 464, in run
    default_config_files=find_config_files(CONFIG_SEARCH_PATHS))
  File "/usr/lib/python2.7/site-packages/oslo_config/cfg.py", line 1890, in __call__
    self._namespace._files_permission_denied)
oslo_config.cfg.ConfigFilesPermissionDeniedError: Failed to open some config files: /etc/rally/rally.conf
[stack@manager ~]$ sudo rally deployment create --file=existing.json --name=overcloud
(sqlite3.OperationalError) table deployments has no column named admin [SQL: u'INSERT INTO deployments (created_at, updated_at, uuid, parent_uuid, name, started_at, completed_at, config, admin, users, enum_deployments_status) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)'] [parameters: ('2016-08-31 17:20:55.137608', '2016-08-31 17:20:55.137636', '1788ec67-1f52-4668-9691-b67364b5fde2', None, u'overcloud', None, None, '{"endpoint_type": "public", "auth_url": "http://10.0.0.100:5000/v2.0/", "region_name": "RegionOne", "https_insecure": false, "admin": {"username": "admin", "tenant_name": "demo", "password": "7VtT8sNR9JsBRcfKRNd6qhqXq"}, "https_cacert": "", "type": "ExistingCloud"}', None, <read-only buffer for 0x3872180, size -1, offset 0 at 0x38777f0>, 'deploy->init')]
Looks like Rally can't connect to it's DB.
Make a sure that connection string in rally.conf is proper:
sqlite:////tmp/rally.sqlite

Note You need to log in before you can comment on or make changes to this bug.