glance image下载错误

1、问题描述

在开发kilo版openstack中,控制节点的glance-api服务,使用systemctl启动或者glance-control启动时,或出现以下错误

Failed to compute_task_build_instances: No valid host was found. There are not enough hosts available

进一步排查发现是虚拟机镜像下载失败引起的,当在计算节点使用glance image-download下载镜像时,出现如下错误

[Errno 32] Corrupt image download. Checksum was c44e7ed60c0afc665e934410a6a1d019 expected 380025f6d0f73c08db3abe7718bad747

于是,打开控制节点中glance-api的debug功能,重启glance-api服务,研究glance-api日志,最后发下glance-api进程不断重启,导致大镜像文件传输中断,最后导致了以上错误。

2、解决办法

这里使用了一个笨的解决办法,就是不使用systemctl或者glance-control开启glance-api服务,而是使用glance-api命令显示开启,如下

$glance-api >/dev/null &

当然,为了实现开机自启动,可以将上述命令写到/etc/rc.d/rc.local文件中,如下

#!/bin/bash
/usr/bin/glance-api >>/dev/null &

然后新建/usr/lib/systemd/system/rc-local.service,写入如下内容

#  This file is part of systemd.
#
#  systemd is free software; you can redistribute it and/or modify it
#  under the terms of the GNU Lesser General Public License as published by
#  the Free Software Foundation; either version 2.1 of the License, or
#  (at your option) any later version.

# This unit gets pulled automatically into multi-user.target by
# systemd-rc-local-generator if /etc/rc.d/rc.local is executable.
[Unit]
Description=/etc/rc.d/rc.local Compatibility
ConditionFileIsExecutable=/etc/rc.d/rc.local
After=network.target

[Service]
Type=forking
ExecStart=/etc/rc.d/rc.local start
TimeoutSec=0
RemainAfterExit=yes

[Install]
WantedBy=multi-user.target

最后设置开机自启动

systemctl enable rc-local.service

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.
永久连接: http://www.nfvschool.cn/?p=485
标签:

发表评论