openstack虚拟机从数据库修改卷虚拟机backend操作

欧阳英彦
2023-12-01

由于意外故障,volume-type其中一个backend后段出现性能问题,客户云主机出现卡顿。
因此临时从ceph将系统卷导出,并导入至同一个backend的另一个后端,并启动虚拟机。

Nova Cinder 数据库操作记录

1. 在nova api节点登录nova数据库修改BDM表信息

select * from block_device_mapping where volume_id='<系统盘卷ID>';

从输出结果获取connection_info值
更新nova BDM对应系统卷的connection_info值

update block_device_mapping set connection_info='<直接复制旧的BDM值,把修改的信息同步修改即可,现在的修改只涉及修改monitor host地址>' where volume_id='<系统盘卷ID>';

虚拟机硬重启,业务验证

2. 在cinder api节点登录cinder数据库修改volumes表记录

select host from volumes where id='<系统盘卷ID>'\G;
update volumes set host='BFJD@ebs_sys_ceph_cache01#ebs_sys_ceph_cache' where id='<系统盘卷ID>';
select host from volumes where id='<系统盘卷ID>'\G;

===============================================================================
10.33.42.1,10.33.42.2, 10.33.42.3

vms/volume-29a8988f-3556-4112-bf2c-0dd93884259d  cache01集群

{"driver_volume_type": "rbd", "connector": {"initiator": "iqn.1994-05.com.redhat:03032C1817", "ip": "172.20.52.245", "platform": "x86_64", "host": "BFJD-PSC-BCEC-YW-SV245", "os_type": "linux2", "multipath": true}, "serial": "29a8988f-3556-4112-bf2c-0dd93884259d", "data": {"secret_type": "ceph", "name": "vms/volume-29a8988f-3556-4112-bf2c-0dd93884259d", "encrypted": false, "cluster_name": "ceph", "secret_uuid": null, "qos_specs": {"total_iops_sec": "2400", "total_bytes_sec": "133693440"}, "hosts": ["10.33.42.21", "10.33.42.26", "10.33.42.36"], "volume_id": "29a8988f-3556-4112-bf2c-0dd93884259d", "auth_enabled": false, "access_mode": "rw", "auth_username": null, "ports": ["6789", "6789", "6789"]}}
 
select * from block_device_mapping where volume_id='29a8988f-3556-4112-bf2c-0dd93884259d';

update block_device_mapping set connection_info='{"driver_volume_type": "rbd", "connector": {"initiator": "iqn.1994-05.com.redhat:03032C1817", "ip": "172.20.52.245", "platform": "x86_64", "host": "BFJD-PSC-BCEC-YW-SV245", "os_type": "linux2", "multipath": true}, "serial": "29a8988f-3556-4112-bf2c-0dd93884259d", "data": {"secret_type": "ceph", "name": "vms/volume-29a8988f-3556-4112-bf2c-0dd93884259d", "encrypted": false, "cluster_name": "ceph", "secret_uuid": null, "qos_specs": {"total_iops_sec": "2400", "total_bytes_sec": "133693440"}, "hosts": ["10.33.42.1", "10.33.42.2", "10.33.42.3"], "volume_id": "29a8988f-3556-4112-bf2c-0dd93884259d", "auth_enabled": false, "access_mode": "rw", "auth_username": null, "ports": ["6789", "6789", "6789"]}}' where volume_id='29a8988f-3556-4112-bf2c-0dd93884259d';

BFJD@ebs_sys_ceph_cache01#ebs_sys_ceph_cache

select host from volumes where id='29a8988f-3556-4112-bf2c-0dd93884259d'\G;

update volumes set host='BFJD@ebs_sys_ceph_cache01#ebs_sys_ceph_cache' where id='29a8988f-3556-4112-bf2c-0dd93884259d';

尔后从nova侧直接硬重启,检查计算节点xml上的monitor IP是否更换为新集群的monIP即可。

 类似资料: