resize和cold migration流程一样类似,区别在于resize的flavor是重新定义的,而migration的flavor是实例初始的flavor。而对于共享存储,因为映射关系,resize时,直接在本节点创建实例的文件,包括磁盘,磁盘信息,xml文件等。而对于非共享存储,则是通过实现在远端创建目录,而后通过scp或者sync的方式,将实例文件同步过去,见nova.virt.libvirt.volume.remotes.SshDriver.copy_file和ova.virt.libvirt.volume.remotes.RsyncDriver.copy_file
具体流程可参考:
http://blog.youkuaiyun.com/tantexian/article/details/41444461
http://blog.youkuaiyun.com/tantexian/article/details/41519135
http://blog.youkuaiyun.com/tantexian/article/details/41519179
关键步骤:nova/virt/libvirt/driver.py
def migrate_disk_and_power_off(self, context, instance, dest,
flavor, network_info,
block_device_info=None,
timeout=0, retry_interval=0):
LOG.debug("Starting migrate_disk_and_power_off",
instance=instance)
……
……
# copy disks to destination
# rename instance dir to +_resize at first for using
# shared storage for instance dir (eg. NFS).
inst_base = libvirt_utils.get_instance_path(instance)
inst_base_resize = inst_base + "_resize"
shared_storage = self._is_storage_shared_with(dest, inst_base)
# try to create the directory on the remote compute node
&nbs
具体流程可参考:
http://blog.youkuaiyun.com/tantexian/article/details/41444461
http://blog.youkuaiyun.com/tantexian/article/details/41519135
http://blog.youkuaiyun.com/tantexian/article/details/41519179
关键步骤:nova/virt/libvirt/driver.py
def migrate_disk_and_power_off(self, context, instance, dest,
flavor, network_info,
block_device_info=None,
timeout=0, retry_interval=0):
LOG.debug("Starting migrate_disk_and_power_off",
instance=instance)
……
……
# copy disks to destination
# rename instance dir to +_resize at first for using
# shared storage for instance dir (eg. NFS).
inst_base = libvirt_utils.get_instance_path(instance)
inst_base_resize = inst_base + "_resize"
shared_storage = self._is_storage_shared_with(dest, inst_base)
# try to create the directory on the remote compute node
&nbs

本文详细介绍了在共享存储环境下OpenStack虚拟机resize的过程,与冷迁移的区别在于resize涉及更改实例的flavor。对于共享存储,实例文件直接在原节点复制,而非共享存储则需要通过SCP或sync远程同步。关键步骤包括关机、复制磁盘到目的地、在目标节点创建目录。文章引用了具体代码实现来说明流程。
最低0.47元/天 解锁文章
601

被折叠的 条评论
为什么被折叠?



