解决相关问题 Error occurred while writing image: ‘NoneType‘ object is not iterable: zun.common.exception

解决相关问题Error occurred while writing image: ‘NoneType’ object is not iterable: zun.common.exception.ZunException: Error occurred while writing image: ‘NoneType’ object is not iterable.


zun计算节点,错误日志类似如下:

2023-04-19 11:08:46.029 80205 ERROR zun.compute.manager [req-a87ba0f4-876a-4c88-b03b-133a4be8f815 171304d80cd049cc8d7ff813a6ba0793 6a91d7ed43284cc281c718451f269609 default - -] Unexpected exception: Error occurred while writing image: ‘NoneType’ object is not iterable: zun.common.exception.ZunException: Error occurred while writing image: ‘NoneType’ object is not iterable
2023-04-19 11:08:46.029 80205 ERROR zun.compute.manager Traceback (most recent call last):
2023-04-19 11:08:46.029 80205 ERROR zun.compute.manager File “/usr/local/lib/python3.6/site-packages/zun/image/glance/driver.py”, line 105, in pull_image
2023-04-19 11:08:46.029 80205 ERROR zun.compute.manager for chunk in image_chunks:
2023-04-19 11:08:46.029 80205 ERROR zun.compute.manager TypeError: ‘NoneType’ object is not iterable
2023-04-19 11:08:46.029 80205 ERROR zun.compute.manager
2023-04-19 11:08:46.029 80205 ERROR zun.compute.manager During handling of the above exception, another exception occurred:
2023-04-19 11:08:46.029 80205 ERROR zun.compute.manager
2023-04-19 11:08:46.029 80205 ERROR zun.compute.manager Traceback (most recent call last):
2023-04-19 11:08:46.029 80205 ERROR zun.compute.manager File “/usr/local/lib/python3.6/site-packages/zun/compute/manager.py”, line 302, in _do_container_create_base
2023-04-19 11:08:46.029 80205 ERROR zun.compute.manager registry=container.registry)
2023-04-19 11:08:46.029 80205 ERROR zun.compute.manager File “/usr/local/lib/python3.6/site-packages/zun/container/docker/driver.py”, line 191, in pull_image
2023-04-19 11:08:46.029 80205 ERROR zun.compute.manager context, repo, tag, image_pull_policy, registry)
2023-04-19 11:08:46.029 80205 ERROR zun.compute.manager File “/usr/local/lib/python3.6/site-packages/zun/image/glance/driver.py”, line 109, in pull_image
2023-04-19 11:08:46.029 80205 ERROR zun.compute.manager raise exception.ZunException(msg.format(e))
2023-04-19 11:08:46.029 80205 ERROR zun.compute.manager zun.common.exception.ZunException: Error occurred while writing image: ‘NoneType’ object is not iterable
2023-04-19 11:08:46.029 80205 ERROR zun.compute.manager


解决方法:

这种情况主要是由于 glance 保存的实际文件被删除了,但是glance 数据库中还保存有image信息,导致拉取的时候报错。

控制节点,查看镜像:

glance image-list

如果glance服务有问题,可以重启相关服务:

systemctl restart $(systemctl list-unit-files |grep -i glance | grep enabled | awk '{print $1}')

删除数据库中的image 信息:

 glance image-delete 329c4ee8-99d2-49c4-b015-b446ac64cf85

重新上传image到glance:

glance image-create --name portal11 --visibility public --disk-format raw --container-format docker --file portal.docker --progress

计算节点,查看docker服务是否正常:

systemctl status docker 

docker info

控制节点,如果相关的服务连接不上,可以到控制节点开放相关的端口策略:

iptables -I INPUT -p tcp --dport 9517 -j ACCEPT
iptables -I INPUT -p tcp --dport 8778 -j ACCEPT
iptables -I INPUT -p tcp --dport 2379 -j ACCEPT
iptables -I INPUT -p tcp --dport 2380 -j ACCEPT
iptables -I INPUT -p tcp --dport 5672 -j ACCEPT
iptables -I INPUT -p tcp --dport 6784 -j ACCEPT
iptables -I INPUT -p tcp --dport 11211 -j ACCEPT
iptables -I INPUT -p tcp --dport 3306 -j ACCEPT
service iptables save
service iptables restart

关联新的image_id 到部署,重新进行测试,服务正常启动。

猜你喜欢

转载自blog.csdn.net/u014374009/article/details/130239812