When using nova resize to modify the virtual machine configuration, the migrate code is actually called.
By default, when Resize is executed, the disk image and the backend image are first merged into raw and then converted into qcow2. It also performs the Migration action. The whole process will consume a considerable amount of time, and we generally only need to modify the CPU and memory size, and do not need to merge images, but do not need to perform migration.
In short, performing the Nova resize operation on a single host is very broken.
In fact, when you reboot an instance, the libvirt. xml of this instance (only considering the KVM environment) will be generated from the database again. You only need to modify the database.
Modify the flavor ID in the openstack corresponding to size_info in the script, and the mysql-related information in the mysql_obejcet object.
Usage: Python update_size.py instance_name flavor
After the modification, you must use the Nova reboot -- hard instance_id to restart the instance. You must use the -- hard command to forcibly restart the instance. Otherwise, the modification will not take effect.