首页 > 其他分享 >Openstack虚拟机硬盘扩容

Openstack虚拟机硬盘扩容

时间:2023-03-20 16:35:40浏览次数:47  
标签:虚拟机 object nova instance gb Openstack null id 硬盘


1、扩容流程

# 确认虚机的宿主机,虚机关机。

# 登录到宿主机上,cd到虚机的磁盘目录。一般是/data/nova/instances/实例uuid/。

# 执行扩容命令 qemu-img resize disk +50G,查看扩容后的硬盘大小 qemu-img info disk。

# 虚机开机。

# 登录到openstack数据库,使用nova_api库,查询扩容硬盘后的目标flavors,找到这个flavor对应的id和flavorid。
use nova_api;
select * from flavors where name = '2c4g-200'; # 注意实例类型要存在

Openstack虚拟机硬盘扩容_d3

2、使用nova库,update instances和 instance_extra 表的记录,更新instance_type_id、root_gb,flavorid"

update instances set root_gb = '800', instance_type_id = '21' where uuid = '869ac684-2c3a-4df7-9e38-cd33e2d2de84';
update instance_extra set flavor = '{"new": null, "old": null, "cur": {"nova_object.version": "1.2", "nova_object.name": "Flavor", "nova_object.data": {"disabled": false, "root_gb": 800, "description": null, "flavorid": "84a58cd6-4e7d-4f97-ac92-a15858a5b482", "deleted": false, "created_at": "2019-11-11T11:14:48Z", "ephemeral_gb": 0, "updated_at": null, "memory_mb": 4096, "vcpus": 2, "extra_specs": {}, "swap": 0, "rxtx_factor": 1.0, "is_public": true, "deleted_at": null, "vcpu_weight": 0, "id": 7, "name": "2c4g-800"}, "nova_object.namespace": "nova"}}' where instance_uuid = '869ac684-2c3a-4df7-9e38-cd33e2d2de84';

标签:虚拟机,object,nova,instance,gb,Openstack,null,id,硬盘
From: https://blog.51cto.com/zzzhao/6133170

相关文章