分享

云计算--OpenStack中glance上传镜像出现500 Internal Server Error

desehawk 发表于 2014-12-23 19:05:32 [显示全部楼层] 回帖奖励 阅读模式 关闭右栏 1 18528
在openstack上传镜像的时候总是提示上传镜像错误,使用glance add命令上传后返回:
root@DevStackOSDomU:~# glance add name="ubuntu-13.04" is_public=true disk_format=vhd container_format=ovf < ~/precise-server-cloudimg-i386-disk1.img
Request returned failure status.
500 Internal Server Error
Failed to upload image f5459320-8fc0-4a92-ba53-b08d51920c1e
    (HTTP 500)
出现HTTP 500错误,修改一下glance的配置文件/etc/glance/glance-api.conf和/etc/glance/glangce-registry.conf文件,设置一下使用系统的日志/var/log/glance文件夹中的日志文件,重新启动glance服务。
然后再上传镜像文件,可以查看到日志如下:
2013-11-26 14:43:20.257 2556 DEBUG glance.registry.client.v1.client [b738b8fc-4fab-4295-9a6a-c220312c73d7 1c6331c7964743388e9d27537fd56b8c 67b67cf299a54ff9b38bfc45743fd1e1] Registry request POST /images HTTP 200 request id req-91517d63-4005-4d53-81cf-f0a1f300b50d do_request /opt/stack/glance/glance/registry/client/v1/client.py:115

2013-11-26 14:43:20.259 2556 DEBUG glance.common.client [b738b8fc-4fab-4295-9a6a-c220312c73d7 1c6331c7964743388e9d27537fd56b8c 67b67cf299a54ff9b38bfc45743fd1e1] Constructed URL: http://0.0.0.0:9191/images/f5459320-8fc0-4a92-ba53-b08d51920c1e _construct_url /opt/stack/glance/glance/common/client.py:408

2013-11-26 14:43:20.272 2556 DEBUG glance.registry.client.v1.client [b738b8fc-4fab-4295-9a6a-c220312c73d7 1c6331c7964743388e9d27537fd56b8c 67b67cf299a54ff9b38bfc45743fd1e1] Registry request GET /images/f5459320-8fc0-4a92-ba53-b08d51920c1e HTTP 200 request id req-893ea6e9-4892-423d-b470-eda7dff9df40 do_request /opt/stack/glance/glance/registry/client/v1/client.py:115

2013-11-26 14:43:20.273 2556 DEBUG glance.api.v1.images [b738b8fc-4fab-4295-9a6a-c220312c73d7 1c6331c7964743388e9d27537fd56b8c 67b67cf299a54ff9b38bfc45743fd1e1] Setting image f5459320-8fc0-4a92-ba53-b08d51920c1e to status 'saving' _upload /opt/stack/glance/glance/api/v1/images.py:542

2013-11-26 14:43:20.274 2556 DEBUG glance.registry.client.v1.api [b738b8fc-4fab-4295-9a6a-c220312c73d7 1c6331c7964743388e9d27537fd56b8c 67b67cf299a54ff9b38bfc45743fd1e1] Updating image metadata for image f5459320-8fc0-4a92-ba53-b08d51920c1e... update_image_metadata /opt/stack/glance/glance/registry/client/v1/api.py:168

2013-11-26 14:43:20.274 2556 DEBUG glance.common.client [b738b8fc-4fab-4295-9a6a-c220312c73d7 1c6331c7964743388e9d27537fd56b8c 67b67cf299a54ff9b38bfc45743fd1e1] Constructed URL: http://0.0.0.0:9191/images/f5459320-8fc0-4a92-ba53-b08d51920c1e _construct_url /opt/stack/glance/glance/common/client.py:408

2013-11-26 14:43:20.298 2556 DEBUG glance.registry.client.v1.client [b738b8fc-4fab-4295-9a6a-c220312c73d7 1c6331c7964743388e9d27537fd56b8c 67b67cf299a54ff9b38bfc45743fd1e1] Registry request PUT /images/f5459320-8fc0-4a92-ba53-b08d51920c1e HTTP 200 request id req-7fc61b96-9a88-44a6-a9c9-91ce65f18f39 do_request /opt/stack/glance/glance/registry/client/v1/client.py:115

2013-11-26 14:43:20.298 2556 DEBUG glance.api.v1.images [b738b8fc-4fab-4295-9a6a-c220312c73d7 1c6331c7964743388e9d27537fd56b8c 67b67cf299a54ff9b38bfc45743fd1e1] Uploading image data for image f5459320-8fc0-4a92-ba53-b08d51920c1e to swift store _upload /opt/stack/glance/glance/api/v1/images.py:547

2013-11-26 14:43:20.326 2556 DEBUG keystoneclient.httpclient [-] REQ: curl -i -X POST https://192.168.1.128:5000/v2.0/tokens -H "Content-Type: application/json" -H "User-Agent: python-keystoneclient" request /opt/stack/python-keystoneclient/keystoneclient/httpclient.py:101

2013-11-26 14:43:20.327 2556 DEBUG keystoneclient.httpclient [-] REQ BODY: {"auth": {"tenantName": "service", "passwordCredentials": {"username": "glance", "password": "citrix"}}}

request /opt/stack/python-keystoneclient/keystoneclient/httpclient.py:105

2013-11-26 14:43:20.328 2556 INFO requests.packages.urllib3.connectionpool [-] Starting new HTTPS connection (1): 192.168.1.128

2013-11-26 14:43:20.528 2556 ERROR swiftclient [-] Authorization Failure. Authorization Failed: Unable to establish connection to https://192.168.1.128:5000/v2.0/tokens

2013-11-26 14:43:20.528 2556 TRACE swiftclient Traceback (most recent call last):

2013-11-26 14:43:20.528 2556 TRACE swiftclient   File "/opt/stack/python-swiftclient/swiftclient/client.py", line 1105, in _retry

2013-11-26 14:43:20.528 2556 TRACE swiftclient     self.url, self.token = self.get_auth()

2013-11-26 14:43:20.528 2556 TRACE swiftclient   File "/opt/stack/python-swiftclient/swiftclient/client.py", line 1081, in get_auth

2013-11-26 14:43:20.528 2556 TRACE swiftclient     insecure=self.insecure)

2013-11-26 14:43:20.528 2556 TRACE swiftclient   File "/opt/stack/python-swiftclient/swiftclient/client.py", line 304, in get_auth

2013-11-26 14:43:20.528 2556 TRACE swiftclient     insecure=insecure)

2013-11-26 14:43:20.528 2556 TRACE swiftclient   File "/opt/stack/python-swiftclient/swiftclient/client.py", line 242, in get_keystoneclient_2_0

2013-11-26 14:43:20.528 2556 TRACE swiftclient     raise ClientException('Authorization Failure. %s' % err)

2013-11-26 14:43:20.528 2556 TRACE swiftclient ClientException: Authorization Failure. Authorization Failed: Unable to establish connection to https://192.168.1.128:5000/v2.0/tokens

2013-11-26 14:43:20.528 2556 TRACE swiftclient

2013-11-26 14:43:20.530 2556 ERROR glance.api.v1.upload_utils [b738b8fc-4fab-4295-9a6a-c220312c73d7 1c6331c7964743388e9d27537fd56b8c 67b67cf299a54ff9b38bfc45743fd1e1] Failed to upload image f5459320-8fc0-4a92-ba53-b08d51920c1e

2013-11-26 14:43:20.530 2556 TRACE glance.api.v1.upload_utils Traceback (most recent call last):

2013-11-26 14:43:20.530 2556 TRACE glance.api.v1.upload_utils   File "/opt/stack/glance/glance/api/v1/upload_utils.py", line 101, in upload_data_to_store

2013-11-26 14:43:20.530 2556 TRACE glance.api.v1.upload_utils     store)

2013-11-26 14:43:20.530 2556 TRACE glance.api.v1.upload_utils   File "/opt/stack/glance/glance/store/__init__.py", line 333, in store_add_to_backend

2013-11-26 14:43:20.530 2556 TRACE glance.api.v1.upload_utils     (location, size, checksum, metadata) = store.add(image_id, data, size)

2013-11-26 14:43:20.530 2556 TRACE glance.api.v1.upload_utils   File "/opt/stack/glance/glance/store/swift.py", line 339, in add

2013-11-26 14:43:20.530 2556 TRACE glance.api.v1.upload_utils     self._create_container_if_missing(location.container, connection)

2013-11-26 14:43:20.530 2556 TRACE glance.api.v1.upload_utils   File "/opt/stack/glance/glance/store/swift.py", line 500, in _create_container_if_missing

2013-11-26 14:43:20.530 2556 TRACE glance.api.v1.upload_utils     connection.head_container(container)

2013-11-26 14:43:20.530 2556 TRACE glance.api.v1.upload_utils   File "/opt/stack/python-swiftclient/swiftclient/client.py", line 1167, in head_container

2013-11-26 14:43:20.530 2556 TRACE glance.api.v1.upload_utils     return self._retry(None, head_container, container)

2013-11-26 14:43:20.530 2556 TRACE glance.api.v1.upload_utils   File "/opt/stack/python-swiftclient/swiftclient/client.py", line 1105, in _retry

2013-11-26 14:43:20.530 2556 TRACE glance.api.v1.upload_utils     self.url, self.token = self.get_auth()

2013-11-26 14:43:20.530 2556 TRACE glance.api.v1.upload_utils   File "/opt/stack/python-swiftclient/swiftclient/client.py", line 1081, in get_auth

2013-11-26 14:43:20.530 2556 TRACE glance.api.v1.upload_utils     insecure=self.insecure)

2013-11-26 14:43:20.530 2556 TRACE glance.api.v1.upload_utils   File "/opt/stack/python-swiftclient/swiftclient/client.py", line 304, in get_auth

2013-11-26 14:43:20.530 2556 TRACE glance.api.v1.upload_utils     insecure=insecure)

2013-11-26 14:43:20.530 2556 TRACE glance.api.v1.upload_utils   File "/opt/stack/python-swiftclient/swiftclient/client.py", line 242, in get_keystoneclient_2_0

2013-11-26 14:43:20.530 2556 TRACE glance.api.v1.upload_utils     raise ClientException('Authorization Failure. %s' % err)

2013-11-26 14:43:20.530 2556 TRACE glance.api.v1.upload_utils ClientException: Authorization Failure. Authorization Failed: Unable to establish connection to https://192.168.1.128:5000/v2.0/tokens

2013-11-26 14:43:20.530 2556 TRACE glance.api.v1.upload_utils

2013-11-26 14:43:20.534 2556 DEBUG glance.registry.client.v1.api [b738b8fc-4fab-4295-9a6a-c220312c73d7 1c6331c7964743388e9d27537fd56b8c 67b67cf299a54ff9b38bfc45743fd1e1] Updating image metadata for image f5459320-8fc0-4a92-ba53-b08d51920c1e... update_image_metadata /opt/stack/glance/glance/registry/client/v1/api.py:168

2013-11-26 14:43:20.534 2556 DEBUG glance.common.client [b738b8fc-4fab-4295-9a6a-c220312c73d7 1c6331c7964743388e9d27537fd56b8c 67b67cf299a54ff9b38bfc45743fd1e1] Constructed URL: http://0.0.0.0:9191/images/f5459320-8fc0-4a92-ba53-b08d51920c1e _construct_url /opt/stack/glance/glance/common/client.py:408

2013-11-26 14:43:20.589 2556 DEBUG glance.registry.client.v1.client [b738b8fc-4fab-4295-9a6a-c220312c73d7 1c6331c7964743388e9d27537fd56b8c 67b67cf299a54ff9b38bfc45743fd1e1] Registry request PUT /images/f5459320-8fc0-4a92-ba53-b08d51920c1e HTTP 200 request id req-8b07e644-476d-476d-96f4-063c901973f7 do_request /opt/stack/glance/glance/registry/client/v1/client.py:115

已有(1)人评论

跳转到指定楼层
desehawk 发表于 2014-12-23 19:06:05
问题解决:

可以查看日志看到Authorization Failure. Authorization Failed: Unable to establish connection to https://192.168.1.128:5000/v2.0/tokens 安全认证失败,在/etc/glance/glance-api.conf文件中设置配置项swift_store_auth_address = 192.168.1.128:5000/v2.0/默认使用https协议,可以手动设置为swift_store_auth_address = http://192.168.1.128:5000/v2.0/
然后再次上传镜像,上传之前使用glance index查看:
root@DevStackOSDomU:~# glance index

ID                                   Name                           Disk Format          Container Format     Size         
------------------------------------ ------------------------------ -------------------- -------------------- --------------

0bbe25cf-de39-4b82-97d6-b4be998c1104 ubuntu-12.04-vmlinuz           aki                  aki                         5026144

a71cabd4-b2c9-4590-80db-d3204ee7e919 cirros-0.3.1-x86_64-uec        ami                  ami                        25165824

3eb744fb-b3a0-47b0-9b63-ea454df71b52 cirros-0.3.1-x86_64-uec-ramdis ari                  ari                         3714968

79524558-c7ec-4f6f-8d9a-49484b3cfb58 cirros-0.3.1-x86_64-uec-kernel aki                  aki                         4955792

396045d7-e98e-4c1b-b6ea-51939c61c4e4 cirros-0.3.0-x86_64-disk       vhd                  ovf                         9220018

然后使用glance image-create上传镜像

root@DevStackOSDomU:~# glance image-create --name=ubuntu-13.04 --is-public=true --disk-format=vhd --container-format=ovf < ./precise-server-cloudimg-i386-disk1.img

+------------------+--------------------------------------+

| Property         | Value                                |

+------------------+--------------------------------------+

| checksum         | 346e28e1890f527fa1514057d723bdd0     |

| container_format | ovf                                  |

| created_at       | 2013-11-26T17:04:14                  |

| deleted          | False                                |

| deleted_at       | None                                 |

| disk_format      | vhd                                  |

| id               | 8cfd600d-8676-47de-ba4d-45e38bbfc1ed |

| is_public        | True                                 |

| min_disk         | 0                                    |

| min_ram          | 0                                    |

| name             | ubuntu-13.04                         |

| owner            | 67b67cf299a54ff9b38bfc45743fd1e1     |

| protected        | False                                |

| size             | 232325120                            |

| status           | active                               |

| updated_at       | 2013-11-26T17:04:21                  |

+------------------+--------------------------------------+

镜像上传成功。再次查看glance index:

root@DevStackOSDomU:~# glance index

ID                                   Name                           Disk Format          Container Format     Size         
------------------------------------ ------------------------------ -------------------- -------------------- --------------

8cfd600d-8676-47de-ba4d-45e38bbfc1ed ubuntu-13.04                   vhd                  ovf                       232325120

a71cabd4-b2c9-4590-80db-d3204ee7e919 cirros-0.3.1-x86_64-uec        ami                  ami                        25165824

3eb744fb-b3a0-47b0-9b63-ea454df71b52 cirros-0.3.1-x86_64-uec-ramdis ari                  ari                         3714968

79524558-c7ec-4f6f-8d9a-49484b3cfb58 cirros-0.3.1-x86_64-uec-kernel aki                  aki                         4955792

396045d7-e98e-4c1b-b6ea-51939c61c4e4 cirros-0.3.0-x86_64-disk       vhd                  ovf                         9220018

回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

关闭

推荐上一条 /2 下一条