一、 cinder存储类型为lvm盘转换成ceph盘
1 转换前,需要将原来的虚拟机删掉,注意默认删除虚拟机是不会删除虚拟机对应的volume,用笔记本记得虚拟机所在的volume id或者name。
# openstack volume list --long | grep 980c87ad-35e7-4a02-a67e-2606f3e39f2d
| 980c87ad-35e7-4a02-a67e-2606f3e39f2d | disk1005sg | in-use | 1 | None | true | Attached to vm1005sg on /dev/vda | |
|
作者环境默认存储为lvm,显示为None。
删除虚拟机
# openstack server delete vm1005sg
|
2 使用volume:980c87ad-35e7-4a02-a67e-2606f3e39f2d创建image,采用qcow2。
# openstack image create --container-format bare --disk-format qcow2 --volume 980c87ad-35e7-4a02-a67e-2606f3e39f2d disk-for-lvm-cirros
|
查看image
# openstack image list
|
显示如下:
根据这个镜像创建类型为rbd-1的volume
# openstack volume create --image disk-for-lvm-cirros --type rbd-1 --size 1 --bootable disk1108
|
查看volume列表:
# openstack volume list
|
发觉出错了:
在查看log:
# tailf /var/log/kolla/cinder/cinder-volume.log
2020-11-08 15:57:00.299 34 ERROR oslo_messaging.rpc.server File "/var/lib/kolla/venv/lib/python2.7/site-packages/taskflow/engines/action_engine/executor.py", line 53, in _execute_task
2020-11-08 15:57:00.299 34 ERROR oslo_messaging.rpc.server result = task.execute(**arguments)
2020-11-08 15:57:00.299 34 ERROR oslo_messaging.rpc.server File "/var/lib/kolla/venv/lib/python2.7/site-packages/cinder/volume/flows/manager/create_volume.py", line 1049, in execute
2020-11-08 15:57:00.299 34 ERROR oslo_messaging.rpc.server **volume_spec)
2020-11-08 15:57:00.299 34 ERROR oslo_messaging.rpc.server File "/var/lib/kolla/venv/lib/python2.7/site-packages/cinder/volume/flows/manager/create_volume.py", line 963, in _create_from_image
2020-11-08 15:57:00.299 34 ERROR oslo_messaging.rpc.server image_meta=image_meta)
2020-11-08 15:57:00.299 34 ERROR oslo_messaging.rpc.server File "/var/lib/kolla/venv/lib/python2.7/site-packages/cinder/volume/flows/manager/create_volume.py", line 444, in _handle_bootable_volume_glance_meta
2020-11-08 15:57:00.299 34 ERROR oslo_messaging.rpc.server raise exception.MetadataCopyFailure(reason=ex)
2020-11-08 15:57:00.299 34 ERROR oslo_messaging.rpc.server MetadataCopyFailure: Failed to copy metadata to volume: Glance metadata cannot be updated, key signature_verified exists for volume id 13e2f13a-fa3d-45d0-99f3-b582b7fb582e
2020-11-08 15:57:00.299 34 ERROR oslo_messaging.rpc.server
|
注意黑体字的描述,其实就是因为磁盘格式问题,ceph不支持qcow2。
2 将image创建镜像及出错的盘删除
# openstack image delete disk-for-lvm-cirros
# openstack volume delete disk1108
|
重新使用volume:980c87ad-35e7-4a02-a67e-2606f3e39f2d创建image,采用raw。
# openstack image create --container-format bare --disk-format raw --volume 980c87ad-35e7-4a02-a67e-2606f3e39f2d disk-for-lvm-cirros
|
根据这个镜像创建类型为rbd-1的volume
#openstack volume create --image disk-for-lvm-cirros --type rbd-1 --size 1 --bootable disk1108
|
查看volume列表:
# openstack volume list
|
显示正常:
根据这个盘创建虚拟机:
# openstack server create vm1108 --flavor nano.v1.128M.1G --volume disk1108 --network network1003
|
等待一段时间,查看虚拟机显示正常:
# openstack server list
|
进入虚拟机:
openstack console url show b9135ae9-4bd0-43fa-9489-f4debd05a4ca
+-------+-----------------------------------------------------------------------------------+
| Field | Value |
+-------+-----------------------------------------------------------------------------------+
| type | novnc |
| url | http://192.168.3.18:6080/vnc_auto.html?token=723af56f-80ef-462a-aa4b-6ade10259690 |
+-------+-----------------------------------------------------------------------------------+
|
显示: