标签:openstack
[root@controller scripts]# openstack image create "cirros" --file cirros-0.3.4-x86_64-disk.img --disk-format qcow2 --container-format bare --public
出现错误如下"500 Internal Server Error: The server has either erred or is incapable of performing the requested operation. (HTTP 500)"
查看/var/log/glance/api.log注意到如下错误
2016-08-21 09:30:18.343 13311 ERROR glance.common.wsgi [req-c7e5abcd-c6f8-462b-ab1b-4b5b76aad182 f7649ace8e334b18ab41bc469615040a eb048b599fc441b091d9cb
83b893351e - - -] Caught error: (_mysql_exceptions.OperationalError) (1045, "Access denied for user ‘glance‘@‘localhost‘ (using password: YES)")
1检查mysql
show grants for ‘glance‘@‘localhost‘;
GRANT USAGE ON *.* TO ‘glance‘@‘localhost‘ IDENTIFIED BY PASSWORD ‘********************************‘
确认数据库用户没有问题
2检查 /etc/glance/glance-api.conf
more /etc/glance/glance-api.conf|grep ^[^#]
发现忘记添加下面的数据库连接串
[database]
connection = mysql+pymysql://glance:GLANCE_DBPASS@controller/glance
3修改之后重启服务
systemctl restart openstack-glance-api.service openstack-glance-registry.service
4再次运行
[root@controller scripts]# openstack image create "cirros" --file cirros-0.3.4-x86_64-disk.img --disk-format qcow2 --container-format bare --public
依然报错
5查看/var/log/glance/api.log注意到如下错误
2016-08-21 09:51:58.360 2674 INFO eventlet.wsgi.server [req-679f0386-f300-4c7e-8792-462dde2e6189 f7649ace8e334b18ab41bc469615040a eb048b599fc441b091d9cb
83b893351e - - -] 10.0.0.11 - - [21/Aug/2016 09:51:58] "GET /v2/schemas/image HTTP/1.1" 200 4344 0.282085
2016-08-21 09:51:58.446 2674 ERROR glance.common.wsgi [req-cc9bc6ce-44f1-4df4-b18f-63aeadc8a50f f7649ace8e334b18ab41bc469615040a eb048b599fc441b091d9cb8
3b893351e - - -] Caught error: (pymysql.err.ProgrammingError) (1146, u"Table ‘glance.images‘ doesn‘t exist") [SQL: u‘INSERT INTO images (created_at, upd
ated_at, deleted_at, deleted, id, name, disk_format, container_format, size, virtual_size, status, is_public, checksum, min_disk, min_ram, owner, protec
ted) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)‘] [parameters: (datetime.datetime(2016, 8, 21, 13, 51, 58, 441792), dat
etime.datetime(2016, 8, 21, 13, 51, 58, 441792), None, 0, ‘22571831-2e2f-43a4-9941-5afcc1828fae‘, u‘cirros‘, u‘qcow2‘, u‘bare‘, None, None, ‘queued‘, 1,
None, 0, 0, u‘eb048b599fc441b091d9cb83b893351e‘, 0)]
6根据提示运行
[root@controller scripts]# su -s /bin/sh -c "glance-manage db_sync" glance
Option "verbose" from group "DEFAULT" is deprecated for removal. Its value may be silently ignored in the future.
/usr/lib/python2.7/site-packages/oslo_db/sqlalchemy/enginefacade.py:1056: OsloDBDeprecationWarning: EngineFacade is deprecated; please use oslo_db.sqlalchemy.enginefacade
expire_on_commit=expire_on_commit, _conf=conf)
/usr/lib/python2.7/site-packages/pymysql/cursors.py:146: Warning: Duplicate index ‘ix_image_properties_image_id_name‘ defined on the table ‘glance.image_properties‘. This is deprecated and will be disallowed in a future release.
result = self._query(query)
7然后重启服务
systemctl restart openstack-glance-api.service openstack-glance-registry.service
8再然后运行
[root@controller scripts]# openstack image create "cirros" --file cirros-0.3.4-x86_64-disk.img --disk-format qcow2 --container-format bare --public
成功
本文出自 “技术无废话版” 博客,请务必保留此出处http://zzabc.blog.51cto.com/2475519/1840908
标签:openstack
原文地址:http://zzabc.blog.51cto.com/2475519/1840908