菜单 学习猿地 - LMONKEY

[原][openstack-pike][controller node][issue-2][glance] Could not parse rfc1738 URL from string 'mysql+pymysql=http://glance:glance@controller/glance'

gdnwxf profile image gdnwxf ・1 min read

问题点

在手动上传镜像的时候:出现错误

Could not parse rfc1738 URL from string 'mysql+pymysql=http://glance:glance@controller/glance'

查看错误应该是配置文件配错了 

查看/etc/glance/glance-api.conf (红色标记的地方为错误点)

connection = mysql+pymysql=http://glance:glance@controller/glance

改为:

connection = mysql+pymysql://glance:glance@controller/glance

期间还遇到一个问题(查看glance 的api.log):

 u"Table 'glance.images' doesn't exist"
 ProgrammingError: (pymysql.err.ProgrammingError) (1146, u"Table 'glance.images' doesn't exist") 
[SQL: u'INSERT INTO images (created_at, updated_at, deleted_at, deleted, id, name, disk_format,
container_format, size, virtual_size, status, visibility, checksum, min_disk, min_ram, owner, protected)
VALUES (%(created_at)s, %(updated_at)s, %(deleted_at)s, %(deleted)s, %(id)s, %(name)s, %(disk_format)s,
%(container_format)s, %(size)s, %(virtual_size)s, %(status)s, %(visibility)s, %(checksum)s, %(min_disk)s,
%(min_ram)s, %(owner)s, %(protected)s)
'] [parameters: {'status': 'queued', 'deleted_at': None, 'name': u'cirros', 'deleted': 0,

'container_format': u'bare', 'created_at': datetime.datetime(2018, 9, 4, 7, 50, 42, 618623), 'disk_format': u'qcow2',

'updated_at': datetime.datetime(2018, 9, 4, 7, 50, 42, 618623), 'visibility': 'shared', 'min_disk': 0, 'protected': 0, 'min_ram': 0,

'checksum': None, 'owner': u'620c7268112f447c87829781b5e96c7f', 'virtual_size': None, 'id': '7de71ffa-d84c-4874-b762-9118cc910258',
'size': None}]

上面的错误一看就可以推断是数据库里没有创建相应的表,所以只需要执行同步数据库的操作就可以了。

su -s /bin/sh -c "glance-manage db_sync" glance

查看相应的表:

MariaDB [glance]> show tables;
+----------------------------------+
| Tables_in_glance                 |
+----------------------------------+
| alembic_version                  |
| image_locations                  |
| image_members                    |
| image_properties                 |
| image_tags                       |
| images                           |
| metadef_namespace_resource_types |
| metadef_namespaces               |
| metadef_objects                  |
| metadef_properties               |
| metadef_resource_types           |
| metadef_tags                     |
| migrate_version                  |
| task_info                        |
| tasks                            |
+----------------------------------+
15 rows in set (0.00 sec)

再次测试上传,问题解决

[root@controller glance]# glance image-create --name cirros --disk-format=qcow2 --container-format=bare --file=/root/cirros-0.4.0-x86_64-disk.img --progress
[=============================>] 100%
+------------------+--------------------------------------+
| Property         | Value                                |
+------------------+--------------------------------------+
| checksum         | 443b7623e27ecf03dc9e01ee93f67afe     |
| container_format | bare                                 |
| created_at       | 2018-09-04T07:59:33Z                 |
| disk_format      | qcow2                                |
| id               | 824cb9aa-710d-4e76-afcf-6062b7e899cc |
| min_disk         | 0                                    |
| min_ram          | 0                                    |
| name             | cirros                               |
| owner            | 620c7268112f447c87829781b5e96c7f     |
| protected        | False                                |
| size             | 12716032                             |
| status           | active                               |
| tags             | []                                   |
| updated_at       | 2018-09-04T07:59:33Z                 |
| virtual_size     | None                                 |
| visibility       | shared                               |
+------------------+--------------------------------------+

 

 

评论 (0)