在OpenStack创建云主机时报错。
OpenStack在创建云主机的时候,网络、租户、路由、镜像都创建没有问题,然后在创建云主机的时候,指定了云主机选择源是一个镜像cirros,主机类型选m1.tiny最小的,然后选择网络,但是创建中就报错,Block Device Mapping is Invalid。
在网上找了很多办法一一尝试。
openstack volume service list查看到cinder-volume 的状态一直为down。
原因是在于我没有创建卷。使用命令创建卷 cinder-volumes。
pvcreate /dev/sdb1
vgcreate cinder-volumes /dev/sdb1
systemctl restart openstack-cinder-volume 重启服务
openstack volume service list 再次查看
但是此时创建云主机还是原来的错误。继续排查。
再次查看日志
[root@test ~(keystone_admin)]# tail -l /var/log/cinder/volume.log
2021-06-09 21:19:35.088 117234 ERROR oslo_messaging.rpc.server File "/usr/lib/python2.7/site-packages/cinder/utils.py", line 123, in execute
2021-06-09 21:19:35.088 117234 ERROR oslo_messaging.rpc.server return processutils.execute(*cmd, **kwargs)
2021-06-09 21:19:35.088 117234 ERROR oslo_messaging.rpc.server File "/usr/lib/python2.7/site-packages/oslo_concurrency/processutils.py", line 389, in execute
2021-06-09 21:19:35.088 117234 ERROR oslo_messaging.rpc.server cmd=sanitized_cmd)
2021-06-09 21:19:35.088 117234 ERROR oslo_messaging.rpc.server ProcessExecutionError: Unexpected error while running command.
2021-06-09 21:19:35.088 117234 ERROR oslo_messaging.rpc.server Command: sudo cinder-rootwrap /etc/cinder/rootwrap.conf env LC_ALL=C lvcreate -n volume-1b9a7e95-e0cd-4696-8407-f2750460e05d cinder-volumes -L 1g
2021-06-09 21:19:35.088 117234 ERROR oslo_messaging.rpc.server Exit code: 5
2021-06-09 21:19:35.088 117234 ERROR oslo_messaging.rpc.server Stdout: u''
2021-06-09 21:19:35.088 117234 ERROR oslo_messaging.rpc.server Stderr: u'File descriptor 10 (/dev/urandom) leaked on lvcreate invocation. Parent PID 117539: /usr/bin/python2\n Volume group "cinder-volumes" has insufficient free space (255 extents): 256 required.\n'
重启系统,准备新增硬盘。重启完成后发现,卷重名了。
[root@test ~(keystone_admin)]# vgsVG #PV #LV #SN Attr VSize VFree cinder-volumes 1 0 0 wz--n- 20.60g 20.60gcinder-volumes 1 0 0 wz--n- 1020.00m 1020.00m[root@test ~(keystone_admin)]# vgdisplay --- Volume group ---VG Name cinder-volumesSystem ID Format lvm2Metadata Areas 1Metadata Sequence No 1VG Access read/writeVG Status resizableMAX LV 0Cur LV 0Open LV 0Max PV 0Cur PV 1Act PV 1VG Size 20.60 GiBPE Size 4.00 MiBTotal PE 5273Alloc PE / Size 0 / 0 Free PE / Size 5273 / 20.60 GiBVG UUID ckXeby-zj25-QBsz-TalV-iiat-9fdT-g7XB4r--- Volume group ---VG Name cinder-volumesSystem ID Format lvm2Metadata Areas 1Metadata Sequence No 1VG Access read/writeVG Status resizableMAX LV 0Cur LV 0Open LV 0Max PV 0Cur PV 1Act PV 1VG Size 1020.00 MiBPE Size 4.00 MiBTotal PE 255Alloc PE / Size 0 / 0 Free PE / Size 255 / 1020.00 MiBVG UUID Id4N9J-7K4K-4OHO-0z1C-PBR3-9Cwa-V85QJL[root@test ~(keystone_admin)]# vgrename Id4N9J-7K4K-4OHO-0z1C-PBR3-9Cwa-V85QJL newoneProcessing VG cinder-volumes because of matching UUID Id4N9J-7K4K-4OHO-0z1C-PBR3-9Cwa-V85QJLVolume group "Id4N9J-7K4K-4OHO-0z1C-PBR3-9Cwa-V85QJL" successfully renamed to "newone"
[root@test ~(keystone_admin)]# vgsVG #PV #LV #SN Attr VSize VFree cinder-volumes 1 0 0 wz--n- 20.60g 20.60gnewone 1 0 0 wz--n- 1020.00m 1020.00m[root@test ~(keystone_admin)]# systemctl restart openstack-cinder*
[root@test ~(keystone_admin)]# vgsVG #PV #LV #SN Attr VSize VFree cinder-volumes 1 0 0 wz--n- 20.60g 20.60gnewone 1 0 0 wz--n- 1020.00m 1020.00m
[root@test ~(keystone_admin)]# openstack volume service list
+------------------+------------------+------+---------+-------+----------------------------+
| Binary | Host | Zone | Status | State | Updated At |
+------------------+------------------+------+---------+-------+----------------------------+
| cinder-backup | test.abc.com | nova | enabled | up | 2021-06-09T13:50:10.000000 |
| cinder-volume | test.abc.com@lvm | nova | enabled | up | 2021-06-09T13:50:10.000000 |
| cinder-scheduler | test.abc.com | nova | enabled | up | 2021-06-09T13:50:09.000000 |
+------------------+------------------+------+---------+-------+----------------------------+
重新启动服务,再次生成主机成功!!!!!