[Openstack - rocky ] Nova install Error
"Access denied for user 'nova'@'%' to database 'nova_api_cell0'"
Openstack Rocky version의 nova 를 설치 단계인 DB를 생성단계에서 아래와 같은 오류가 발생하였다.
root@rocky:~# su -s /bin/sh -c "nova-manage db sync" nova
ERROR: Could not access cell0.
Has the nova_api database been created?
Has the nova_cell0 database been created?
Has "nova-manage api_db sync" been run?
Has "nova-manage cell_v2 map_cell0" been run?
Is [api_database]/connection set in nova.conf?
Is the cell0 database connection URL correct?
Error: (pymysql.err.OperationalError) (1044, u"Access denied for user 'nova'@'%' to database 'nova_api_cell0'") (Background on this error at: http://sqlalche.me/e/e3q8)
An error has occurred:
Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/nova/cmd/manage.py", line 2310, in main
ret = fn(*fn_args, **fn_kwargs)
File "/usr/lib/python2.7/dist-packages/nova/cmd/manage.py", line 489, in sync
return migration.db_sync(version)
File "/usr/lib/python2.7/dist-packages/nova/db/migration.py", line 26, in db_sync
return IMPL.db_sync(version=version, database=database, context=context)
File "/usr/lib/python2.7/dist-packages/nova/db/sqlalchemy/migration.py", line 57, in db_sync
current_version = db_version(database, context=context)
File "/usr/lib/python2.7/dist-packages/nova/db/sqlalchemy/migration.py", line 88, in db_version
_("Upgrade DB using Essex release first."))
NovaException: Upgrade DB using Essex release first.
openstack.org 에서 가이드 해주는 Install 문서를 몇번을 다시 보고 수정해도 문제가 해결되지 않았는데 error 내용을 천천히 보다 보니 ... 진작에 error를 자세히 볼껄 후회를 했다.
나같은 실수 또는 설치 오류를 경험한 사람들을 위해 필자가 해결한 방법을 공유하려 한다.
(다시는 이런 실수를 하지 말아야.....하는데... 쩝쩝... )
원인
"Access denied for user 'nova'@'%' to database 'nova_api_cell0'"
=> nova_api_cell0이라는 DB에 접속이 안된다고 되어 있다.
해결 방법
1. nova_api_cell0 DB를 생성
# mysql -uroot -pDB_PASSWORD -e "CREATE DATABASE nova_api_cell0;"
2. 해당 DB에 GRANT설정 (접근 권한 설정)
# mysql -uroot -pDB_PASSWORD -e "GRANT ALL PRIVILEGES ON nova_api_cell0.* TO 'nova'@'localhost' IDENTIFIED BY 'NOVA_DB_PW';"
# mysql -uroot -pDB_PASSWORD -e "GRANT ALL PRIVILEGES ON nova_api_cell0.* TO 'nova'@'%' IDENTIFIED BY 'NOVA_DB_PW';"
3. 다음 명령어 실행
# su -s /bin/sh -c "nova-manage db sync" nova
/usr/lib/python2.7/dist-packages/pymysql/cursors.py:165: Warning: (1831, u'Duplicate index `block_device_mapping_instance_uuid_virtual_name_device_name_idx`. This is deprecated and will be disallowed in a future release.')
result = self._query(query)
/usr/lib/python2.7/dist-packages/pymysql/cursors.py:165: Warning: (1831, u'Duplicate index `uniq_instances0uuid`. This is deprecated and will be disallowed in a future release.')
result = self._query(query)
이렇게 하면 DB내 중복되었다는 에러가 발생하긴 하지만 정상적으로 실행은 된다.
하지만.... 설치 가이드에 없는 nova_api_cell0 DB를 생성하고 나서 해당 DB에 뭔가 작업을 할 줄 았았는데
다른 곳에 작업이 되었다.
설치가이드에서 생성하라고한 nova_cell0이라는 DB 에 tables이 생성되었다.
root@rocky:~# mysql -uroot -pmaria.123 nova_cell0 -e "show tables;"
+--------------------------------------------+
| Tables_in_nova_cell0 |
+--------------------------------------------+
| agent_builds |
| aggregate_hosts |
| aggregate_metadata |
| aggregates |
| allocations |
| block_device_mapping |
| bw_usage_cache |
| cells |
| certificates |
| compute_nodes |
| console_auth_tokens |
| console_pools |
| consoles |
| dns_domains |
| fixed_ips |
| floating_ips |
| instance_actions |
| instance_actions_events |
| instance_extra |
| instance_faults |
| instance_group_member |
| instance_group_policy |
| instance_groups |
| instance_id_mappings |
| instance_info_caches |
| instance_metadata |
| instance_system_metadata |
| instance_type_extra_specs |
| instance_type_projects |
| instance_types |
| instances |
| inventories |
| key_pairs |
| migrate_version |
| migrations |
| networks |
| pci_devices |
| project_user_quotas |
| provider_fw_rules |
| quota_classes |
| quota_usages |
| quotas |
| reservations |
| resource_provider_aggregates |
| resource_providers |
| s3_images |
| security_group_default_rules |
| security_group_instance_association |
| security_group_rules |
| security_groups |
| services |
| shadow_agent_builds |
| shadow_aggregate_hosts |
| shadow_aggregate_metadata |
| shadow_aggregates |
| shadow_block_device_mapping |
| shadow_bw_usage_cache |
| shadow_cells |
| shadow_certificates |
| shadow_compute_nodes |
| shadow_console_pools |
| shadow_consoles |
| shadow_dns_domains |
| shadow_fixed_ips |
| shadow_floating_ips |
| shadow_instance_actions |
| shadow_instance_actions_events |
| shadow_instance_extra |
| shadow_instance_faults |
| shadow_instance_group_member |
| shadow_instance_group_policy |
| shadow_instance_groups |
| shadow_instance_id_mappings |
| shadow_instance_info_caches |
| shadow_instance_metadata |
| shadow_instance_system_metadata |
| shadow_instance_type_extra_specs |
| shadow_instance_type_projects |
| shadow_instance_types |
| shadow_instances |
| shadow_key_pairs |
| shadow_migrate_version |
| shadow_migrations |
| shadow_networks |
| shadow_pci_devices |
| shadow_project_user_quotas |
| shadow_provider_fw_rules |
| shadow_quota_classes |
| shadow_quota_usages |
| shadow_quotas |
| shadow_reservations |
| shadow_s3_images |
| shadow_security_group_default_rules |
| shadow_security_group_instance_association |
| shadow_security_group_rules |
| shadow_security_groups |
| shadow_services |
| shadow_snapshot_id_mappings |
| shadow_snapshots |
| shadow_task_log |
| shadow_virtual_interfaces |
| shadow_volume_id_mappings |
| shadow_volume_usage_cache |
| snapshot_id_mappings |
| snapshots |
| tags |
| task_log |
| virtual_interfaces |
| volume_id_mappings |
| volume_usage_cache |
+--------------------------------------------+
Error를 찍으면서 찾던 "nova_api_cell0" DB에는 실제 아무런 작업을 하지 않았다. (이상하군....)
root@rocky:~# mysql -uroot -pmaria.123 nova_api_cell0 -e "show tables;"
내가 잘못해서 그런건지 아니면 다른 뭔가가 있는지는 모르겠으나 필자는 이걸로 해결하였다.
도움이 되시길..