[go: up one dir, main page]

CN102917055A - Method and device of online migration of virtual machine, and terminal device - Google Patents

Method and device of online migration of virtual machine, and terminal device Download PDF

Info

Publication number
CN102917055A
CN102917055A CN2012103980426A CN201210398042A CN102917055A CN 102917055 A CN102917055 A CN 102917055A CN 2012103980426 A CN2012103980426 A CN 2012103980426A CN 201210398042 A CN201210398042 A CN 201210398042A CN 102917055 A CN102917055 A CN 102917055A
Authority
CN
China
Prior art keywords
virtual machine
message
client device
memory pages
sent
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN2012103980426A
Other languages
Chinese (zh)
Other versions
CN102917055B (en
Inventor
向光蓉
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Huawei Technologies Co Ltd
Original Assignee
Huawei Technologies Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Huawei Technologies Co Ltd filed Critical Huawei Technologies Co Ltd
Priority to CN201210398042.6A priority Critical patent/CN102917055B/en
Publication of CN102917055A publication Critical patent/CN102917055A/en
Application granted granted Critical
Publication of CN102917055B publication Critical patent/CN102917055B/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Computer And Data Communications (AREA)

Abstract

本发明公开了一种虚拟机在线迁移的方法、装置和终端设备,属于通信技术领域。该方法包括:启动在线迁移;复制虚拟机的内存页面,并向目的主机发送复制的内存页面;当所述虚拟机中处于更新状态的内存页面数量小于第一预设阈值,将所述虚拟机发送的报文的窗口阈值修改为第二预设阈值,并将修改后的报文发送给目的客户端设备,使得所述目的客户端设备和所述虚拟机之间不继续报文传输;暂停所述虚拟机的运行,复制所述处于更新状态的内存页面,并向所述目的主机发送复制的所述处于更新状态的内存页面,使得所述虚拟机在线迁移成功。本发明避免了源主机单方面进行停机复制造成的TCP连接异常关闭,避免了由于异常关闭而导致的数据丢失和不完整。

The invention discloses a method, device and terminal equipment for online migration of a virtual machine, belonging to the technical field of communication. The method includes: starting online migration; copying the memory pages of the virtual machine, and sending the copied memory pages to the destination host; Modifying the window threshold of the sent message to a second preset threshold, and sending the modified message to the destination client device, so that the message transmission does not continue between the destination client device and the virtual machine; suspend The running of the virtual machine copies the memory page in the updated state, and sends the copied memory page in the updated state to the destination host, so that the online migration of the virtual machine succeeds. The invention avoids the abnormal closing of the TCP connection caused by the unilateral shutdown and replication of the source host, and avoids the loss and incompleteness of data caused by the abnormal closing.

Description

虚拟机在线迁移的方法、装置和终端设备Method, device and terminal equipment for online migration of virtual machine

技术领域 technical field

本发明涉及通信技术领域,特别涉及一种虚拟机在线迁移的方法、装置和终端设备。The invention relates to the field of communication technology, in particular to a method, device and terminal equipment for online migration of a virtual machine.

背景技术 Background technique

VM(Virtual Machine,虚拟机)技术常应用于数据中心、集群计算场合。该技术让多个操作系统可以运行在同一个物理机上,并提供了可靠的隔离,大大提高了物理资源的复用性。而为了实现服务器的在线维护、在线升级和动态负载均衡,可进行在线迁移,也称实时迁移,即是在保持虚拟机运行的同时,把它从一个计算机迁移到另一个计算机,并在目的计算机恢复运行。VM (Virtual Machine, virtual machine) technology is often used in data centers and cluster computing occasions. This technology allows multiple operating systems to run on the same physical machine, provides reliable isolation, and greatly improves the reusability of physical resources. In order to achieve online maintenance, online upgrade and dynamic load balancing of servers, online migration can be performed, also known as live migration, that is, to migrate a virtual machine from one computer to another while keeping the virtual machine running, and transfer it to the destination computer. resume operation.

目前为止,对于VM的迁移,一般采用了主流的预复制(pre-copy)的策略。虚拟机的迁移是通过源主机和目的主机之间的交互完成的,以预复制方式进行,具体地,预复制方式的在线迁移可以包括:保持VM运行,源主机以循环的方式将VM的内存页复制到目的主机上,在第一轮循环中,所有的内存页都要从源主机传送到目的主机,以后的循环只复制前一轮传送过程中被修改过的页面(脏页面)。停止源主机上的VM,把它的网络连接重定向到目的主机,CPU状态和前一轮传送过程中修改过的页都在这个步骤被传送,最后,源主机和目的主机上有一致的VM映像。源主机确认迁移成功,则抛弃或销毁其上的VM。启动迁移到目的主机上的VM,迁移后使用目的计算机的设备驱动,广播新的IP地址。So far, for VM migration, the mainstream pre-copy (pre-copy) strategy is generally adopted. The migration of the virtual machine is completed through the interaction between the source host and the destination host, and is carried out in a pre-copy manner. Specifically, online migration in the pre-copy mode may include: keeping the VM running, and the source host recycles the memory of the VM Pages are copied to the destination host. In the first cycle, all memory pages are transferred from the source host to the destination host, and only the modified pages (dirty pages) in the previous round of transfer are copied in subsequent cycles. Stop the VM on the source host and redirect its network connection to the destination host. The CPU status and pages modified during the previous round of transfer are transferred at this step. Finally, there are consistent VMs on the source and destination hosts. image. After the source host confirms that the migration is successful, the VM on it is discarded or destroyed. Start the VM migrated to the destination host, use the device driver of the destination computer after migration, and broadcast the new IP address.

在实施本发明的过程中,发明人发现现有技术中至少存在以下缺点:In the process of implementing the present invention, the inventor finds that there are at least the following shortcomings in the prior art:

在进行迁移时,对于更新速度非常快的内存部分,由于其每次循环过程都会变脏,需要重复预复制,同时也导致循环次数非常多,迁移的时间变长。针对这种情况,KVM虚拟机采取了有限循环措施,控制循环次数,也即是对每轮预复制的效果进行计算,若预复制对于减少不一致内存数量的效果不显著,或者循环次数超过了上限,循环将中止,进入停机复制阶段。而在对服务可用性要求很高的场景下,服务器停机是令人难以接受的,一旦已经建立的会话被强制中断,不可避免地会丢失正在传输过程中的报文,进而可能影响数据的一致性和完整性。During the migration, for the memory part with a very fast update speed, because it will get dirty every cycle, it needs to repeat the pre-copy, which also leads to a very large number of cycles and a longer migration time. In response to this situation, the KVM virtual machine has adopted limited loop measures to control the number of loops, that is, to calculate the effect of each round of pre-copying. If the effect of pre-copying on reducing the amount of inconsistent memory is not significant, or the number of loops exceeds the upper limit , the loop will abort and enter the shutdown replication phase. However, in a scenario that requires high service availability, server downtime is unacceptable. Once an established session is forcibly interrupted, messages in transit will inevitably be lost, which may affect data consistency. and integrity.

发明内容 Contents of the invention

为了解决现有技术的问题,本发明实施例提供了一种虚拟机在线迁移的方法、装置和终端设备。所述技术方案如下:In order to solve the problems in the prior art, the embodiments of the present invention provide a method, an apparatus and a terminal device for online migration of a virtual machine. Described technical scheme is as follows:

一方面,一种虚拟机在线迁移的方法,所述方法包括:In one aspect, a method for online migration of a virtual machine, the method comprising:

启动在线迁移;Start online migration;

复制虚拟机的内存页面,并向目的主机发送复制的内存页面;Copy the memory page of the virtual machine and send the copied memory page to the destination host;

当所述虚拟机中处于更新状态的内存页面数量小于第一预设阈值,将所述虚拟机发送的报文的窗口阈值修改为第二预设阈值,并将修改后的报文发送给目的客户端设备,使得所述目的客户端设备和所述虚拟机之间不继续报文传输;When the number of memory pages in the update state in the virtual machine is less than the first preset threshold, modify the window threshold of the message sent by the virtual machine to the second preset threshold, and send the modified message to the destination The client device, so that the packet transmission between the destination client device and the virtual machine is not continued;

暂停所述虚拟机的运行,复制所述处于更新状态的内存页面,并向所述目的主机发送复制的所述处于更新状态的内存页面,使得所述虚拟机在线迁移成功。Suspending the operation of the virtual machine, copying the memory page in the update state, and sending the copied memory page in the update state to the destination host, so that the online migration of the virtual machine succeeds.

当所述虚拟机中处于更新状态的内存页面数量小于第一预设阈值,将所述虚拟机发送的报文的窗口阈值修改为第二预设阈值,并将修改后的报文发送给目的客户端设备,使得所述目的客户端设备和所述虚拟机之间不继续报文传输,之后还包括:When the number of memory pages in the update state in the virtual machine is less than the first preset threshold, modify the window threshold of the message sent by the virtual machine to the second preset threshold, and send the modified message to the destination The client device, so that the message transmission is not continued between the destination client device and the virtual machine, and then further includes:

缓存各个客户端设备向所述虚拟机发送的报文,并在向所述目的主机发送复制的所述处于更新状态的内存页面之后,向所述目的主机发送缓存的报文。Buffering the messages sent by each client device to the virtual machine, and sending the cached messages to the destination host after sending the copied memory page in the update state to the destination host.

所述方法还包括:The method also includes:

当所述虚拟机中处于更新状态的内存页面数量小于第一预设阈值,将客户端设备向所述虚拟机发送的报文的窗口阈值修改为第二预设阈值,并将修改后的报文发送给所述虚拟机,使得所述客户端设备和所述虚拟机之间不继续报文传输。When the number of memory pages in the update state in the virtual machine is less than the first preset threshold, modify the window threshold of the message sent by the client device to the virtual machine to a second preset threshold, and send the modified message The message is sent to the virtual machine, so that the message transmission between the client device and the virtual machine does not continue.

所述第二预设阈值为零。The second preset threshold is zero.

另一方面,一种虚拟机在线迁移的装置,所述装置包括:In another aspect, an apparatus for online migration of a virtual machine, the apparatus includes:

启动模块,用于启动在线迁移;Startup module, used to start online migration;

发送模块,用于复制虚拟机的内存页面,并向目的主机发送复制的内存页面;The sending module is used to copy the memory page of the virtual machine, and send the copied memory page to the destination host;

阈值修改模块,用于当所述虚拟机中处于更新状态的内存页面数量小于第一预设阈值,将所述虚拟机发送的报文的窗口阈值修改为第二预设阈值,并将修改后的报文发送给目的客户端设备,使得所述目的客户端设备和所述虚拟机之间不继续报文传输;A threshold modifying module, configured to modify the window threshold of the message sent by the virtual machine to a second preset threshold when the number of memory pages in the update state in the virtual machine is less than a first preset threshold, and change the modified The message is sent to the destination client device, so that the message transmission does not continue between the destination client device and the virtual machine;

所述发送模块,还用于暂停所述虚拟机的运行,复制所述处于更新状态的内存页面,并向所述目的主机发送复制的所述处于更新状态的内存页面,使得所述虚拟机在线迁移成功。The sending module is further configured to suspend the operation of the virtual machine, copy the memory page in the update state, and send the copied memory page in the update state to the destination host, so that the virtual machine is online The migration was successful.

所述装置还包括:The device also includes:

缓存模块,用于缓存各个客户端设备向所述虚拟机发送的报文;相应地,所述发送模块还用于在向所述目的主机发送复制的所述处于更新状态的内存页面之后,向所述目的主机发送缓存的报文。A caching module, configured to cache messages sent by each client device to the virtual machine; correspondingly, the sending module is also configured to send the copied memory page in an updated state to the destination host, The destination host sends the cached message.

所述阈值修改模块当所述虚拟机中处于更新状态的内存页面数量小于第一预设阈值时,将客户端设备向所述虚拟机发送的报文的窗口阈值修改为第二预设阈值,并将修改后的报文发送给所述虚拟机,使得所述客户端设备和所述虚拟机之间不继续报文传输。The threshold modifying module modifies the window threshold of the message sent by the client device to the virtual machine to a second preset threshold when the number of memory pages in the update state in the virtual machine is less than a first preset threshold, and sending the modified message to the virtual machine, so that message transmission does not continue between the client device and the virtual machine.

所述第二预设阈值为零。The second preset threshold is zero.

又一方面,一种终端设备,所述终端设备包括:收发器和处理器,所述收发器和所述处理器耦合,In another aspect, a terminal device includes: a transceiver and a processor, the transceiver is coupled to the processor,

所述收发器,用于接收和发送报文;The transceiver is used to receive and send messages;

所述处理器,用于启动在线迁移;The processor is configured to start online migration;

所述处理器,还用于复制虚拟机的内存页面,并触发所述收发器向目的主机发送复制的内存页面;The processor is further configured to copy the memory page of the virtual machine, and trigger the transceiver to send the copied memory page to the destination host;

所述处理器,还用于当所述虚拟机中处于更新状态的内存页面数量小于第一预设阈值,将所述虚拟机发送的报文的窗口阈值修改为第二预设阈值,并触发所述收发器将修改后的报文发送给目的客户端设备,使得所述目的客户端设备和所述虚拟机之间不继续报文传输;The processor is further configured to modify the window threshold of the message sent by the virtual machine to a second preset threshold when the number of memory pages in the update state in the virtual machine is less than a first preset threshold, and trigger The transceiver sends the modified message to the destination client device, so that message transmission does not continue between the destination client device and the virtual machine;

所述处理器,还用于暂停所述虚拟机的运行,复制所述处于更新状态的内存页面,并触发所述收发器向所述目的主机发送复制的所述处于更新状态的内存页面,使得所述虚拟机在线迁移成功。The processor is further configured to suspend the operation of the virtual machine, copy the memory page in the update state, and trigger the transceiver to send the copied memory page in the update state to the destination host, so that The online migration of the virtual machine is successful.

所述终端设备还包括:存储器,用于缓存各个客户端设备向所述虚拟机发送的报文,并在向所述目的主机发送复制的所述处于更新状态的内存页面之后,触发所述收发器向所述目的主机发送缓存的报文。The terminal device further includes: a memory, configured to cache messages sent by each client device to the virtual machine, and after sending the copied memory page in an updated state to the destination host, trigger the sending and receiving The router sends the buffered message to the destination host.

所述处理器还用于当所述虚拟机中处于更新状态的内存页面数量小于第一预设阈值,将客户端设备向所述虚拟机发送的报文的窗口阈值修改为第二预设阈值,并触发所述收发器将修改后的报文发送给所述虚拟机,使得所述客户端设备和所述虚拟机之间不继续报文传输。The processor is further configured to modify the window threshold of the message sent by the client device to the virtual machine to a second preset threshold when the number of memory pages in the update state in the virtual machine is less than a first preset threshold , and trigger the transceiver to send the modified message to the virtual machine, so that the message transmission between the client device and the virtual machine does not continue.

所述第二预设阈值为零。The second preset threshold is zero.

本发明实施例提供的一种虚拟机在线迁移的方法、装置和终端设备,通过所述源主机启动在线迁移;所述源主机复制虚拟机的内存页面,并向目的主机发送复制的内存页面;当所述虚拟机中处于更新状态的内存页面数量小于第一预设阈值,所述源主机将所述虚拟机发送的报文的窗口阈值修改为第二预设阈值,并将修改后的报文发送给目的客户端设备,使得所述目的客户端设备和所述虚拟机之间不继续报文传输;所述源主机暂停所述虚拟机的运行,复制所述处于更新状态的内存页面,并向所述目的主机发送复制的所述处于更新状态的内存页面,使得所述虚拟机在线迁移成功。采取本发明提供的技术方案,通过在虚拟机在线迁移过程中,当满足处于更新状态的内存页面数量小于第一预设阈值时,对虚拟机所发送报文的窗口阈值进行修改,使得虚拟机和目的客户端设备之间的报文传输量逐渐减小,最终达到流量趋近于零的目的,并在此时对处于更新状态的内存页面进行复制,相当于在虚拟机没有报文传输的情况下进行了停机复制,避免了源主机单方面进行停机复制造成的TCP连接异常关闭,进一步避免了由于异常关闭而导致的数据丢失和数据不完整。A method, device, and terminal device for online migration of a virtual machine provided by an embodiment of the present invention start the online migration through the source host; the source host copies a memory page of the virtual machine, and sends the copied memory page to the destination host; When the number of memory pages in the update state in the virtual machine is less than the first preset threshold, the source host modifies the window threshold of the message sent by the virtual machine to the second preset threshold, and sends the modified message send the message to the destination client device, so that the message transmission does not continue between the destination client device and the virtual machine; the source host suspends the operation of the virtual machine, copies the memory page in the updated state, And send the copied memory page in the updated state to the destination host, so that the online migration of the virtual machine succeeds. By adopting the technical solution provided by the present invention, during the online migration process of the virtual machine, when the number of memory pages in the update state is less than the first preset threshold, the window threshold of the message sent by the virtual machine is modified, so that the virtual machine The packet transmission volume between the target client device and the destination client device gradually decreases, and finally reaches the goal of zero traffic, and at this time, the memory page in the updated state is copied, which is equivalent to the virtual machine without packet transmission. Under the circumstances, the downtime copying is carried out, which avoids the abnormal closing of the TCP connection caused by the unilateral downtime copying of the source host, and further avoids the data loss and data incompleteness caused by the abnormal closing.

附图说明 Description of drawings

为了更清楚地说明本发明实施例中的技术方案,下面将对实施例描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本发明的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings that need to be used in the description of the embodiments will be briefly introduced below. Obviously, the drawings in the following description are only some embodiments of the present invention. For those skilled in the art, other drawings can also be obtained based on these drawings without creative effort.

图1本发明实施例提供了一种虚拟机在线迁移方法的流程图;Fig. 1 embodiment of the present invention provides a flow chart of a virtual machine online migration method;

图2本发明实施例提供了一种虚拟机在线迁移方法的流程图;FIG. 2 is a flowchart of a method for online migration of a virtual machine provided by an embodiment of the present invention;

图3本发明实施例提供了一种虚拟机在线迁移装置的结构示意图;FIG. 3 is a schematic structural diagram of a virtual machine online migration device provided by an embodiment of the present invention;

图4是本发明实施例提供的一种终端设备的结构示意图。Fig. 4 is a schematic structural diagram of a terminal device provided by an embodiment of the present invention.

具体实施方式 Detailed ways

为使本发明的目的、技术方案和优点更加清楚,下面将结合附图对本发明实施方式作进一步地详细描述。In order to make the object, technical solution and advantages of the present invention clearer, the implementation manner of the present invention will be further described in detail below in conjunction with the accompanying drawings.

图1本发明实施例提供了一种虚拟机在线迁移方法的流程图。该实施例的执行主体为源主机,该源主机为运行虚拟机的服务器或终端设备。参见图1,该方法包括:FIG. 1 provides a flowchart of a method for online migration of a virtual machine according to an embodiment of the present invention. The execution subject of this embodiment is a source host, and the source host is a server or a terminal device running a virtual machine. Referring to Figure 1, the method includes:

101:启动在线迁移;101: start online migration;

102:复制虚拟机的内存页面,并向目的主机发送复制的内存页面;102: Copy the memory page of the virtual machine, and send the copied memory page to the destination host;

103:当所述虚拟机中处于更新状态的内存页面数量小于第一预设阈值,所述将所述虚拟机发送的报文的窗口阈值修改为第二预设阈值,并将修改后的报文发送给目的客户端设备,使得所述目的客户端设备和所述虚拟机之间不继续报文传输;103: When the number of memory pages in the update state in the virtual machine is less than a first preset threshold, modify the window threshold of the message sent by the virtual machine to a second preset threshold, and send the modified message Send the message to the destination client device, so that the message transmission does not continue between the destination client device and the virtual machine;

104:所述源主机暂停所述虚拟机的运行,复制所述处于更新状态的内存页面,并向所述目的主机发送复制的所述处于更新状态的内存页面,使得所述虚拟机在线迁移成功。104: The source host suspends the operation of the virtual machine, copies the memory page in the updated state, and sends the copied memory page in the updated state to the destination host, so that the online migration of the virtual machine succeeds .

采取本发明提供的技术方案,通过在虚拟机在线迁移过程中,当满足处于更新状态的内存页面数量小于第一预设阈值时,对源主机上来往的报文的窗口阈值进行修改,使得发送端和接收端之间的报文传输量逐渐减小,最终达到流量趋近于零的目的,并在此时对处于更新状态的内存页面进行复制,相当于在虚拟机没有报文传输的情况下进行了停机复制,避免了由于源主机单方面进行停机复制造成的TCP连接异常关闭,进一步避免了由于异常关闭而导致的数据丢失和数据不完整。Adopting the technical solution provided by the present invention, during the online migration process of the virtual machine, when the number of memory pages in the update state is less than the first preset threshold, modify the window threshold of the messages sent and received on the source host, so that the sending The amount of message transmission between the end and the receiving end gradually decreases, and finally reaches the goal of zero traffic, and at this time, the memory page in the update state is copied, which is equivalent to the situation where there is no message transmission in the virtual machine Downtime replication is carried out under the following conditions, which avoids the abnormal shutdown of the TCP connection caused by the unilateral shutdown of the source host, and further avoids data loss and data incompleteness caused by abnormal shutdown.

图2本发明实施例提供了一种虚拟机在线迁移方法的流程图,参见图2,方法流程包括:Fig. 2 The embodiment of the present invention provides a flow chart of a virtual machine online migration method, referring to Fig. 2, the method flow includes:

201:源主机启动在线迁移;201: The source host starts online migration;

对于源主机来说,该源主机上可以同时运行有多个虚拟机,而本发明实施例仅以对其中一个虚拟机的在线迁移为例进行说明,具体地,源主机启动在线迁移,在启动过程中,选定目的主机,该目的主机是指该虚拟机在线迁移的目的终端,则源主机向目的主机发起迁移请求,目的主机确认该目的主机当前是否有必需的资源,若有,则预留这些资源,同时响应源主机的请求;若没有,目的主机拒绝源主机的请求,使得虚拟机仍在源主机上运行,则源主机可以继续选择其他目的终端作为目的主机。For the source host, multiple virtual machines can run on the source host at the same time, and this embodiment of the present invention only uses online migration of one of the virtual machines as an example for illustration. Specifically, when the source host starts online migration, During the process, the destination host is selected. The destination host refers to the destination terminal for online migration of the virtual machine. The source host initiates a migration request to the destination host. The destination host confirms whether the destination host currently has the necessary resources. Reserve these resources and respond to the request of the source host at the same time; if not, the destination host rejects the request of the source host, so that the virtual machine is still running on the source host, and the source host can continue to select other destination terminals as the destination host.

202:所述源主机复制虚拟机的内存页面,并向目的主机发送所述复制的内存页面;202: The source host copies the memory page of the virtual machine, and sends the copied memory page to the destination host;

在选定目的主机后,源主机以迭代的方式将虚拟机的内存页复制到目的主机上,这一阶段虚拟机仍然运行,而该步骤202即是指该迭代过程中的第一轮迭代,在该第一次迭代中,源主机复制所有的内存页,并将复制的所有内存也发送到目的主机,而在该第一次迭代过程中,该虚拟机上还包括处于更新状态的内存页面,也即是在前一轮复制、发送过程中被修改过的页面,我们称之为脏页。After the destination host is selected, the source host copies the memory pages of the virtual machine to the destination host in an iterative manner, and the virtual machine is still running at this stage, and this step 202 refers to the first round of iteration in the iteration process. In this first iteration, the source host copies all memory pages and sends all the copied memory to the destination host, and during this first iteration, the virtual machine also includes memory pages in an updated state , that is, pages that have been modified during the previous round of copying and sending, we call them dirty pages.

其中,脏页是linux内核中的概念,因为硬盘的读写速度远赶不上内存的速度,系统就把读写比较频繁的数据事先放到内存中,以提高读写速度,这就叫高速缓存,linux是以页作为高速缓存的单位,当进程修改了高速缓存里的数据时,该页就被内核标记为脏页,内核将会在合适的时间把脏页的数据写到磁盘中去,以保持高速缓存中的数据和磁盘中的数据是一致的。Among them, dirty page is a concept in the Linux kernel. Because the read and write speed of the hard disk is far behind the speed of the memory, the system puts the data that is read and written more frequently into the memory in advance to improve the read and write speed. This is called cache. Linux uses pages as the unit of cache. When a process modifies the data in the cache, the page is marked as a dirty page by the kernel, and the kernel will write the data of the dirty page to the disk at an appropriate time, so as to Keep the data in the cache consistent with the data on disk.

203:所述源主机将所述虚拟机发送的报文的窗口阈值修改为零,并将修改后的报文发送给目的客户端设备,使得所述目的客户端设备和所述虚拟机之间不继续报文传输;203: The source host modifies the window threshold of the packet sent by the virtual machine to zero, and sends the modified packet to the destination client device, so that the communication between the destination client device and the virtual machine Do not continue message transmission;

对于一个虚拟机来说,其可能为多个客户端设备服务,因此,虚拟机在发送报文时,是向目的客户端设备发送,该目的客户端设备可以是虚拟机所服务的多个客户端设备中的一个或多个,本发明实施例不做具体限定。For a virtual machine, it may serve multiple client devices. Therefore, when the virtual machine sends a message, it is sent to the destination client device. The destination client device can be multiple clients served by the virtual machine. One or more of the end devices are not specifically limited in this embodiment of the present invention.

204、所述源主机将客户端设备向所述虚拟机发送的报文的窗口阈值修改为第二预设阈值,并将修改后的报文发送给所述虚拟机,使得所述客户端设备和所述虚拟机之间不继续报文传输;204. The source host modifies the window threshold of the packet sent by the client device to the virtual machine to a second preset threshold, and sends the modified packet to the virtual machine, so that the client device Do not continue message transmission with the virtual machine;

对于一个虚拟机来说,由于其可能为多个客户端设备服务,因此源主机可以接收到来自多个客户端设备的报文,而不一定仅是步骤203中目的客户端设备的报文,因此,需要对接收端为虚拟机的报文的窗口阈值进行修改,以使得虚拟机与发送报文的客户端设备之间不继续报文传输。For a virtual machine, since it may serve multiple client devices, the source host may receive packets from multiple client devices, not necessarily only the packets of the destination client device in step 203, Therefore, it is necessary to modify the window threshold of the message whose receiving end is a virtual machine, so that message transmission does not continue between the virtual machine and the client device sending the message.

更进一步地,对于步骤203和204来说,还有以下的实现方式:根据虚拟机上处于更新状态的内存页面的具体更新情况,判断该更新是否由虚拟机的报文发送引起,如果否,则执行步骤203,如果是,则执行步骤204。优选地,为了避免复杂的过程,在该发明实施例中,仅以既执行步骤203,也执行步骤204为例进行说明。Furthermore, for steps 203 and 204, there is also the following implementation: according to the specific update situation of the memory page in the update state on the virtual machine, it is judged whether the update is caused by the message sending of the virtual machine, if not, Then execute step 203, and if yes, execute step 204. Preferably, in order to avoid complicated procedures, in this embodiment of the invention, only the execution of step 203 and step 204 is taken as an example for illustration.

由于在步骤202的复制、发送过程中,虚拟机上还包括了脏页,为了能够保证能够在不进行强制停机复制的情况下,能够在短时间内,不被用户感知的对处于更新状态的内存页面进行复制和发送,本发明实施例对处于更新状态的内存页面的剩余数量进行了限制,其剩余数量需小于第一预设阈值,因此,在执行步骤203和204之前,该方法还可以包括多次迭代,每次迭代的过程中,对在前一次迭代过程中处于更新状态的内存页面即是被修改的内存页面进行复制和发送,需要说明的是,该第一预设阈值可以由技术人员根据源主机和/或目的主机的性能、数据复制速度等进行设置。Since the virtual machine also includes dirty pages during the copying and sending process in step 202, in order to ensure that the virtual machine in the update state can be updated without being perceived by the user in a short period of time without forced downtime copying The memory page is copied and sent. The embodiment of the present invention limits the remaining number of memory pages in the update state, and the remaining number needs to be less than the first preset threshold. Therefore, before performing steps 203 and 204, the method can also Including multiple iterations, in the process of each iteration, copy and send the memory page that was in the update state in the previous iteration process, that is, the modified memory page. It should be noted that the first preset threshold can be determined by Technicians make settings according to the performance of the source host and/or destination host, data replication speed, etc.

在本实施例中,以客户端设备和虚拟机之间为TCP连接为例进行说明,则本实施例中的报文均为TCP报文,对于TCP报文来说,其窗口(Window)阈值用于表示允许接收端发送报文的接收窗口,其字节数用于通知接收端仅能够发送该接收窗口大小的数据,因此,通过在步骤203和204中对来往报文窗口阈值的修改,可以对虚拟机与客户端设备之间的报文传输进行流量控制,第二预设阈值可以取值0,1,2,3……等,优选的,第二预设阈值为0。In this embodiment, a TCP connection between the client device and the virtual machine is used as an example for illustration, and the packets in this embodiment are all TCP packets. For TCP packets, the window (Window) threshold It is used to indicate the receiving window that allows the receiving end to send messages, and its number of bytes is used to notify the receiving end that it can only send data of the size of the receiving window. Therefore, by modifying the message window threshold in steps 203 and 204, Flow control can be performed on packet transmission between the virtual machine and the client device, and the second preset threshold can take values of 0, 1, 2, 3, . . . and so on. Preferably, the second preset threshold is 0.

需要说明的是,本实施例中所述的发送、接收和修改等均可以由源主机服务器网卡实现,当然,还可以由源主机中相应的功能模块实现。It should be noted that the sending, receiving, and modifying described in this embodiment can all be implemented by the network card of the source host server, and of course, can also be implemented by corresponding functional modules in the source host.

具体地,步骤203的具体实现可以为:源主机的服务器网卡接收到来自虚拟机的第一报文,则将该第一报文的窗口阈值修改为第二预设阈值,并将修改后的第一报文发送给目的客户端设备,使得所述目的客户端设备和所述虚拟机之间不继续报文传输;Specifically, the specific implementation of step 203 may be: the server network card of the source host receives the first packet from the virtual machine, then modifies the window threshold of the first packet to the second preset threshold, and converts the modified sending the first message to the destination client device, so that message transmission does not continue between the destination client device and the virtual machine;

具体地,步骤204的具体实现可以为:如果所述源主机服务器网卡接收到来自由客户端设备发送的该虚拟机的第二报文,则所述源主机服务器网卡将第二报文的窗口阈值修改为第二预设阈值,并将修改后的第二报文发送给所述虚拟机,使得所述客户端设备和虚拟机之间不继续报文传输。Specifically, the specific implementation of step 204 may be: if the network card of the source host server receives the second message from the virtual machine sent by the client device, the network card of the source host server sets the window threshold of the second message to modifying to the second preset threshold, and sending the modified second message to the virtual machine, so that the message transmission between the client device and the virtual machine does not continue.

205:所述目的客户端设备和所述虚拟机之间的TCP连接关闭;205: Close the TCP connection between the destination client device and the virtual machine;

当目的客户端设备在接收到所述窗口阈值为0的TCP报文,会等待1-2秒,然后发送窗口阈值为0的探测报文,看所述源主机虚拟机服务器是否允许发送数据,如果源主机服务器发送的TCP报文中窗口阈值仍然为0,则继续等待,否则,目的客户端设备将传输数据,若目的客户端设备多次询问得到的TCP报文中窗口阈值都为0,将会发送TCP关闭握手消息,虚拟机在收到消息后,发送关闭握手响应,使得目的客户端设备和虚拟机之间的TCP连接关闭。When the destination client device receives a TCP message with a window threshold of 0, it will wait for 1-2 seconds, and then send a detection message with a window threshold of 0 to see if the source host virtual machine server is allowed to send data. If the window threshold value in the TCP message sent by the source host server is still 0, then continue to wait, otherwise, the destination client device will transmit data, if the window threshold value in the TCP message obtained by the destination client device multiple times is 0, A TCP close handshake message will be sent, and after receiving the message, the virtual machine will send a close handshake response to close the TCP connection between the destination client device and the virtual machine.

同理,虚拟机在接收到多次TCP报文窗口阈值为0时,也将发送TCP关闭握手消息,客户端设备收到后,发送关闭握手响应,此时,客户端设备和虚拟机之间的TCP连接关闭。Similarly, when the virtual machine receives multiple TCP packets with a window threshold of 0, it will also send a TCP close handshake message, and the client device will send a close handshake response after receiving it. The TCP connection is closed.

206:所述源主机暂停所述虚拟机的运行,复制所述处于更新状态的内存页面,并向所述目的主机发送复制的所述处于更新状态的内存页面,使得所述虚拟机在线迁移成功;206: The source host suspends the operation of the virtual machine, copies the memory page in the updated state, and sends the copied memory page in the updated state to the destination host, so that the online migration of the virtual machine succeeds ;

由于在步骤205中TCP连接已经关闭,极大地降低了TCP连接的数据流量,使得虚拟机所在源主机能在极短的时间内复制并发送所述处于更新状态的内存页面,因此,源主机暂停虚拟机的运行,把它的网络连接重定向到目的主机,源主机中处于更新状态的内存页面都在这个步骤被传送,直到源主机和目的主机上有一致的虚拟机映像。Since the TCP connection has been closed in step 205, the data flow of the TCP connection is greatly reduced, so that the source host where the virtual machine is located can copy and send the memory page in the updated state in a very short time, therefore, the source host pauses The operation of the virtual machine redirects its network connection to the destination host, and the memory pages in the updated state in the source host are transferred in this step until there are consistent virtual machine images on the source host and the destination host.

207:当所述源主机接收到由所述客户端设备向所述虚拟机发送的报文时,所述源主机缓存接收到的报文;207: When the source host receives a packet sent by the client device to the virtual machine, the source host caches the received packet;

在停机复制期间,源主机和目的主机都是不可用的。此时,对于没有关闭TCP连接的客户端设备(也可以包括本实施例中的目的客户端设备)与虚拟机,他们之间的连接依然存在,同时,可能会有新的客户端设备发送连接请求,客户端设备发送的消息被存放在源主机的服务器网卡缓存中,以便于目的主机启用虚拟机后继续和客户端设备进行会话,在保证数据不丢失以及数据完整性的同时,还进一步保证了虚拟机服务不会因为停机复制而中断。During downtime replication, both the source and destination hosts are unavailable. At this time, for the client device (which may also include the destination client device in this embodiment) and the virtual machine that has not closed the TCP connection, the connection between them still exists, and at the same time, there may be a new client device sending a connection Request, the message sent by the client device is stored in the server network card cache of the source host, so that the destination host can continue to communicate with the client device after enabling the virtual machine. While ensuring data loss and data integrity, it also further ensures The virtual machine service will not be interrupted due to downtime replication.

208:所述目的主机启用虚拟机,所述源主机向所述目的主机发送缓存的报文。208: The destination host activates the virtual machine, and the source host sends the cached packet to the destination host.

在停机复制完成后,目的主机通知源主机已经成功收到了虚拟机的映像,源主机对这个消息进行确认,然后,源主机可以抛弃或销毁其上的虚拟机,目的主机启用虚拟机,虚拟机广播新的IP地址,和客户端设备进行会话连接。After the shutdown replication is completed, the destination host notifies the source host that it has successfully received the image of the virtual machine. The source host confirms the message. Then, the source host can discard or destroy the virtual machine on it. Broadcast the new IP address and establish a session connection with the client device.

本发明实施例提供的一种虚拟机在线迁移的方法,通过所述源主机启动在线迁移;所述源主机复制虚拟机的内存页面,并向目的主机发送复制的内存页面;当所述虚拟机中处于更新状态的内存页面数量小于第一预设阈值,所述源主机将所述虚拟机发送的报文的窗口阈值修改为第二预设阈值,并将修改后的报文发送给目的客户端设备,使得所述目的客户端设备和所述虚拟机之间不继续报文传输;所述源主机暂停所述虚拟机的运行,复制所述处于更新状态的内存页面,并向所述目的主机发送复制的所述处于更新状态的内存页面,使得所述虚拟机在线迁移成功。采取本发明提供的技术方案,通过在虚拟机在线迁移过程中,当满足处于更新状态的内存页面数量小于第一预设阈值时,对源主机上来往的报文的窗口阈值进行修改,使得发送端和接收端之间的报文传输量逐渐减小,最终达到流量趋近于零的目的,并在此时对处于更新状态的内存页面进行复制,相当于在虚拟机没有报文传输的情况下进行了停机复制,避免了由于源主机单方面进行停机复制造成的TCP连接异常关闭,进一步避免了由于异常关闭而导致的数据丢失和数据不完整。进一步地,通过在源主机上缓存在停机复制期间接收到的报文,能够进一步保证虚拟机服务不会因为停机复制而中断。According to a method for online migration of a virtual machine provided by an embodiment of the present invention, the online migration is started by the source host; the source host copies the memory page of the virtual machine, and sends the copied memory page to the destination host; when the virtual machine If the number of memory pages in the updated state is less than the first preset threshold, the source host modifies the window threshold of the message sent by the virtual machine to the second preset threshold, and sends the modified message to the destination client end device, so that the message transmission between the destination client device and the virtual machine does not continue; the source host suspends the operation of the virtual machine, copies the memory page in the updated state, and sends the message to the destination The host sends the copied memory page in the updated state, so that the online migration of the virtual machine succeeds. Adopting the technical solution provided by the present invention, during the online migration process of the virtual machine, when the number of memory pages in the update state is less than the first preset threshold, modify the window threshold of the messages sent and received on the source host, so that the sending The amount of message transmission between the end and the receiving end gradually decreases, and finally reaches the goal of zero traffic, and at this time, the memory page in the update state is copied, which is equivalent to the situation where there is no message transmission in the virtual machine Downtime replication is carried out under the following conditions, which avoids the abnormal shutdown of the TCP connection caused by the unilateral shutdown of the source host, and further avoids data loss and data incompleteness caused by abnormal shutdown. Further, by caching the packets received during the downtime replication on the source host, it can be further ensured that the virtual machine service will not be interrupted due to downtime replication.

图3本发明实施例提供了一种虚拟机在线迁移装置的结构图,参见图3,该装置包括:Fig. 3 The embodiment of the present invention provides a structural diagram of a virtual machine online migration device, referring to Fig. 3, the device includes:

启动模块301,用于启动在线迁移;Start module 301, for starting online migration;

发送模块302,用于复制虚拟机的内存页面,并向目的主机发送所述的复制的内存页面;A sending module 302, configured to copy the memory page of the virtual machine, and send the copied memory page to the destination host;

阈值修改模块303,用于当所述虚拟机中处于更新状态的内存页面数量小于第一预设阈值,将所述虚拟机发送的报文的窗口阈值修改为第二预设阈值,并将修改后的报文发送给目的客户端设备,使得所述目的客户端设备和所述虚拟机之间不继续报文传输;A threshold modifying module 303, configured to modify the window threshold of the message sent by the virtual machine to a second preset threshold when the number of memory pages in the update state in the virtual machine is less than a first preset threshold, and modify the The subsequent message is sent to the destination client device, so that the message transmission does not continue between the destination client device and the virtual machine;

缓存模块304,用于缓存各个客户端设备向所述虚拟机发送的报文;相应地,所述发送模块还用于在向所述目的主机发送复制的所述处于更新状态的内存页面之后,向所述目的主机发送缓存的报文。The caching module 304 is configured to cache the packets sent by each client device to the virtual machine; correspondingly, the sending module is also configured to send the copied memory page in the updated state to the destination host, Send the cached message to the destination host.

所述发送模块302,还用于暂停所述虚拟机的运行,复制所述处于更新状态的内存页面,并向所述目的主机发送复制的所述处于更新状态的内存页面,使得所述虚拟机在线迁移成功。The sending module 302 is further configured to suspend the operation of the virtual machine, copy the memory page in the update state, and send the copied memory page in the update state to the destination host, so that the virtual machine Online migration was successful.

所述阈值修改模块303,用于当所述虚拟机中处于更新状态的内存页面数量小于第一预设阈值时,将客户端设备向所述虚拟机发送的报文的窗口阈值修改为第二预设阈值,并将修改后的报文发送给所述虚拟机,使得所述客户端设备和所述虚拟机之间不继续报文传输。The threshold modifying module 303 is configured to modify the window threshold of the message sent by the client device to the virtual machine to the second threshold when the number of memory pages in the update state in the virtual machine is less than the first preset threshold. A threshold is preset, and the modified message is sent to the virtual machine, so that the message transmission between the client device and the virtual machine does not continue.

本发明实施例提供的一种虚拟机在线迁移的装置,通过启动在线迁移;复制虚拟机的内存页面,并向目的主机发送复制的内存页面;当所述虚拟机中处于更新状态的内存页面数量小于第一预设阈值,将所述虚拟机发送的报文的窗口阈值修改为第二预设阈值,并将修改后的报文发送给目的客户端设备,使得所述目的客户端设备和所述虚拟机之间不继续报文传输;暂停所述虚拟机的运行,复制所述处于更新状态的内存页面,并向所述目的主机发送复制的所述处于更新状态的内存页面,使得所述虚拟机在线迁移成功。采取本发明提供的技术方案,通过在虚拟机在线迁移过程中,当满足处于更新状态的内存页面数量小于第一预设阈值时,对源主机上来往的报文的窗口阈值进行修改,使得发送端和接收端之间的报文传输量逐渐减小,最终达到流量趋近于零的目的,并在此时对处于更新状态的内存页面进行复制,相当于在虚拟机没有报文传输的情况下进行了停机复制,避免了由于源主机单方面进行停机复制造成的TCP连接异常关闭,进一步避免了由于异常关闭而导致的数据丢失和数据不完整。A device for online migration of a virtual machine provided by an embodiment of the present invention starts online migration; copies the memory pages of the virtual machine and sends the copied memory pages to the destination host; when the number of memory pages in the update state in the virtual machine is less than the first preset threshold, modifying the window threshold of the message sent by the virtual machine to a second preset threshold, and sending the modified message to the destination client device, so that the destination client device and the Do not continue message transmission between the virtual machines; suspend the operation of the virtual machine, copy the memory page in the update state, and send the copied memory page in the update state to the destination host, so that the The online migration of the virtual machine is successful. Adopting the technical solution provided by the present invention, during the online migration process of the virtual machine, when the number of memory pages in the update state is less than the first preset threshold, modify the window threshold of the messages sent and received on the source host, so that the sending The amount of message transmission between the end and the receiving end gradually decreases, and finally reaches the goal of zero traffic, and at this time, the memory page in the update state is copied, which is equivalent to the situation where there is no message transmission in the virtual machine Downtime replication is carried out under the following conditions, which avoids the abnormal shutdown of the TCP connection caused by the unilateral shutdown of the source host, and further avoids data loss and data incompleteness caused by abnormal shutdown.

需要说明的是:上述实施例提供的虚拟机在线迁移装置在虚拟机在线迁移时,仅以上述各功能模块的划分进行举例说明,实际应用中,可以根据需要而将上述功能分配由不同的功能模块完成,即将设备的内部结构划分成不同的功能模块,以完成以上描述的全部或者部分功能。另外,上述实施例提供的虚拟机在线迁移装置与虚拟机在线迁移方法实施例属于同一构思,其具体实现过程详见方法实施例,这里不再赘述。It should be noted that: the virtual machine online migration device provided by the above embodiment only uses the division of the above-mentioned functional modules as an example when the virtual machine is migrated online. In practical applications, the above-mentioned functions can be assigned to different function Module completion means that the internal structure of the device is divided into different functional modules to complete all or part of the functions described above. In addition, the device for online virtual machine migration provided by the above-mentioned embodiments belongs to the same idea as the embodiment of the method for online migration of virtual machine, and its specific implementation process is detailed in the method embodiment, and will not be repeated here.

本领域普通技术人员可以理解实现上述实施例的全部或部分步骤可以通过硬件来完成,也可以通过程序来指令相关的硬件完成,所述的程序可以存储于一种计算机可读存储介质中,上述提到的存储介质可以是只读存储器,磁盘或光盘等。Those of ordinary skill in the art can understand that all or part of the steps for implementing the above embodiments can be completed by hardware, and can also be completed by instructing related hardware through a program. The program can be stored in a computer-readable storage medium. The above-mentioned The storage medium mentioned may be a read-only memory, a magnetic disk or an optical disk, and the like.

图4是本发明实施例提供的一种终端设备的结构示意图。参见图4,所述终端设备包括:收发器401和处理器402,所述收发器401和所述处理器402耦合,Fig. 4 is a schematic structural diagram of a terminal device provided by an embodiment of the present invention. Referring to FIG. 4, the terminal device includes: a transceiver 401 and a processor 402, the transceiver 401 and the processor 402 are coupled,

收发器401,用于接收和发送报文;Transceiver 401, configured to receive and send messages;

所述处理器402,用于启动在线迁移;The processor 402 is configured to start online migration;

所述处理器402,还用于复制虚拟机的内存页面,并触发所述收发器401向目的主机发送复制的内存页面;The processor 402 is further configured to copy the memory page of the virtual machine, and trigger the transceiver 401 to send the copied memory page to the destination host;

所述处理器402,还用于当所述虚拟机中处于更新状态的内存页面数量小于第一预设阈值,将所述虚拟机发送的报文的窗口阈值修改为第二预设阈值,并触发所述收发器401将修改后的报文发送给目的客户端设备,使得所述目的客户端设备和所述虚拟机之间不继续报文传输;The processor 402 is further configured to modify the window threshold of the message sent by the virtual machine to a second preset threshold when the number of memory pages in the update state in the virtual machine is less than a first preset threshold, and Triggering the transceiver 401 to send the modified message to the destination client device, so that the message transmission between the destination client device and the virtual machine does not continue;

所述处理器402,还用于暂停所述虚拟机的运行,复制所述处于更新状态的内存页面,并触发所述收发器401向所述目的主机发送复制的所述处于更新状态的内存页面,使得所述虚拟机在线迁移成功。The processor 402 is further configured to suspend the operation of the virtual machine, copy the memory page in the update state, and trigger the transceiver 401 to send the copied memory page in the update state to the destination host , making the online migration of the virtual machine successful.

所述终端设备还包括:存储器403,所述存储器403与收发器401耦合,所述存储器403还与处理器402耦合,存储器403用于缓存各个客户端设备向所述虚拟机发送的报文,并在向所述目的主机发送复制的所述处于更新状态的内存页面之后,触发所述收发器401向所述目的主机发送缓存的报文。The terminal device further includes: a memory 403, the memory 403 is coupled to the transceiver 401, the memory 403 is also coupled to the processor 402, and the memory 403 is used for buffering messages sent by each client device to the virtual machine, And after sending the copied memory page in the update state to the destination host, trigger the transceiver 401 to send the cached message to the destination host.

所述处理器402还用于当所述虚拟机中处于更新状态的内存页面数量小于第一预设阈值,将客户端设备向所述虚拟机发送的报文的窗口阈值修改为第二预设阈值,并触发所述收发器401将修改后的报文发送给所述虚拟机,使得所述客户端设备和所述虚拟机之间不继续报文传输。The processor 402 is further configured to modify the window threshold of the message sent by the client device to the virtual machine to a second preset when the number of memory pages in the update state in the virtual machine is less than a first preset threshold threshold, and trigger the transceiver 401 to send the modified message to the virtual machine, so that the message transmission between the client device and the virtual machine does not continue.

所述第二预设阈值为零。The second preset threshold is zero.

本发明实施例提供的一种终端设备,通过启动在线迁移;复制虚拟机的内存页面,并向目的主机发送复制的内存页面;当所述虚拟机中处于更新状态的内存页面数量小于第一预设阈值,将所述虚拟机发送的报文的窗口阈值修改为第二预设阈值,并将修改后的报文发送给目的客户端设备,使得所述目的客户端设备和所述虚拟机之间不继续报文传输;暂停所述虚拟机的运行,复制所述处于更新状态的内存页面,并向所述目的主机发送复制的所述处于更新状态的内存页面,使得所述虚拟机在线迁移成功。采取本发明提供的技术方案,通过在虚拟机在线迁移过程中,当满足处于更新状态的内存页面数量小于第一预设阈值时,对源主机上来往的报文的窗口阈值进行修改,使得发送端和接收端之间的报文传输量逐渐减小,最终达到流量趋近于零的目的,并在此时对处于更新状态的内存页面进行复制,相当于在虚拟机没有报文传输的情况下进行了停机复制,避免了由于源主机单方面进行停机复制造成的TCP连接异常关闭,进一步避免了由于异常关闭而导致的数据丢失和数据不完整。A terminal device provided by an embodiment of the present invention starts online migration; copies the memory pages of the virtual machine and sends the copied memory pages to the destination host; when the number of memory pages in the update state in the virtual machine is less than the first preset Setting a threshold, modifying the window threshold of the message sent by the virtual machine to a second preset threshold, and sending the modified message to the destination client device, so that the relationship between the destination client device and the virtual machine do not continue message transmission; suspend the operation of the virtual machine, copy the memory page in the update state, and send the copied memory page in the update state to the destination host, so that the virtual machine migrates online success. Adopting the technical solution provided by the present invention, during the online migration process of the virtual machine, when the number of memory pages in the update state is less than the first preset threshold, modify the window threshold of the messages sent and received on the source host, so that the sending The amount of message transmission between the end and the receiving end gradually decreases, and finally reaches the goal of zero traffic, and at this time, the memory page in the update state is copied, which is equivalent to the situation where there is no message transmission in the virtual machine Downtime replication is carried out under the following conditions, which avoids the abnormal shutdown of the TCP connection caused by the unilateral shutdown of the source host, and further avoids data loss and data incompleteness caused by abnormal shutdown.

以上所述仅为本发明的较佳实施例,并不用以限制本发明,凡在本发明的精神和原则之内,所作的任何修改、等同替换、改进等,均应包含在本发明的保护范围之内。The above descriptions are only preferred embodiments of the present invention, and are not intended to limit the present invention. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principles of the present invention shall be included in the protection of the present invention. within range.

Claims (12)

1. the method for the online migration of a virtual machine is characterized in that described method comprises:
Start online migration;
Copy the memory pages of virtual machine, and send the memory pages that copies to destination host;
In described virtual machine, be in the memory pages quantity of update mode less than the first predetermined threshold value, the window threshold modifying of the message that described virtual machine is sent is the second predetermined threshold value, and amended message sent to the purpose client device, so that do not continue message transmissions between described purpose client device and the described virtual machine;
Suspend the operation of described virtual machine, copy the described memory pages that is in update mode, and send the described memory pages that is in update mode that copies to described destination host, so that described virtual machine moves successfully online.
2. method according to claim 1, it is characterized in that, in described virtual machine, be in the memory pages quantity of update mode less than the first predetermined threshold value, the window threshold modifying of the message that described virtual machine is sent is the second predetermined threshold value, and amended message sent to the purpose client device, so that do not continue message transmissions between described purpose client device and the described virtual machine, also comprise afterwards:
The message that each client device of buffer memory sends to described virtual machine, and after sending copy described to described destination host and being in the memory pages of update mode, send the message of buffer memory to described destination host.
3. method according to claim 1 is characterized in that, described method also comprises:
In described virtual machine, be in the memory pages quantity of update mode less than the first predetermined threshold value, the window threshold modifying of the message that client device is sent to described virtual machine is the second predetermined threshold value, and amended message sent to described virtual machine, so that do not continue message transmissions between described client device and the described virtual machine.
4. each described method is characterized in that according to claim 1-3, and described the second predetermined threshold value is zero.
5. the device of the online migration of a virtual machine is characterized in that described device comprises:
Start module, be used for starting online migration;
Sending module is used for copying the memory pages of virtual machine, and sends the memory pages that copies to destination host;
The threshold modifying module, be used for being in the memory pages quantity of update mode less than the first predetermined threshold value when described virtual machine, the window threshold modifying of the message that described virtual machine is sent is the second predetermined threshold value, and amended message sent to the purpose client device, so that do not continue message transmissions between described purpose client device and the described virtual machine;
Described sending module also is used for suspending the operation of described virtual machine, copies the described memory pages that is in update mode, and sends the described memory pages that is in update mode that copies to described destination host, so that described virtual machine moves successfully online.
6. device according to claim 5 is characterized in that, described device also comprises:
Cache module is used for the message that each client device of buffer memory sends to described virtual machine; Correspondingly, described sending module also is used for sending the message of buffer memory to described destination host after sending copy described to described destination host and being in the memory pages of update mode.
7. device according to claim 5, it is characterized in that, described threshold modifying module is when the memory pages quantity that is in update mode in the described virtual machine during less than the first predetermined threshold value, the window threshold modifying of the message that client device is sent to described virtual machine is the second predetermined threshold value, and amended message sent to described virtual machine, so that do not continue message transmissions between described client device and the described virtual machine.
8. each described device is characterized in that according to claim 5-7, and described the second predetermined threshold value is zero.
9. a terminal equipment is characterized in that, described terminal equipment comprises: transceiver and processor, and described transceiver and the coupling of described processor,
Described transceiver is used for receiving and sending message;
Described processor is used for starting online migration;
Described processor also is used for copying the memory pages of virtual machine, and triggers the memory pages that described transceiver copies to the destination host transmission;
Described processor, also be used for being in the memory pages quantity of update mode less than the first predetermined threshold value when described virtual machine, the window threshold modifying of the message that described virtual machine is sent is the second predetermined threshold value, and trigger described transceiver amended message is sent to the purpose client device, so that do not continue message transmissions between described purpose client device and the described virtual machine;
Described processor, also be used for suspending the operation of described virtual machine, copy the described memory pages that is in update mode, and trigger the described memory pages that is in update mode that described transceiver copies to described destination host transmission, so that described virtual machine moves successfully online.
10. terminal equipment according to claim 9, it is characterized in that, described terminal equipment also comprises: memory, be used for the message that each client device of buffer memory sends to described virtual machine, and after sending copy described to described destination host and being in the memory pages of update mode, trigger described transceiver sends message from buffer memory to described destination host.
11. terminal equipment according to claim 9, it is characterized in that, described processor also is used for being in the memory pages quantity of update mode less than the first predetermined threshold value when described virtual machine, the window threshold modifying of the message that client device is sent to described virtual machine is the second predetermined threshold value, and trigger described transceiver amended message is sent to described virtual machine, so that do not continue message transmissions between described client device and the described virtual machine.
12. each described terminal equipment is characterized in that according to claim 9-11, described the second predetermined threshold value is zero.
CN201210398042.6A 2012-10-18 2012-10-18 The method that virtual machine moves online, device and terminal equipment Expired - Fee Related CN102917055B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201210398042.6A CN102917055B (en) 2012-10-18 2012-10-18 The method that virtual machine moves online, device and terminal equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201210398042.6A CN102917055B (en) 2012-10-18 2012-10-18 The method that virtual machine moves online, device and terminal equipment

Publications (2)

Publication Number Publication Date
CN102917055A true CN102917055A (en) 2013-02-06
CN102917055B CN102917055B (en) 2015-11-25

Family

ID=47615285

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201210398042.6A Expired - Fee Related CN102917055B (en) 2012-10-18 2012-10-18 The method that virtual machine moves online, device and terminal equipment

Country Status (1)

Country Link
CN (1) CN102917055B (en)

Cited By (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104123171A (en) * 2014-06-10 2014-10-29 浙江大学 Virtual machine migrating method and system based on NUMA architecture
CN104268003A (en) * 2014-09-30 2015-01-07 南京理工大学 Memory state migration method applicable to dynamic migration of virtual machine
CN106293781A (en) * 2015-05-15 2017-01-04 阿里巴巴集团控股有限公司 The method and apparatus of online upgrading machine virtual machine
CN107133093A (en) * 2017-06-02 2017-09-05 郑州云海信息技术有限公司 The online moving method and device of a kind of virtual machine
CN108121589A (en) * 2016-11-30 2018-06-05 中标软件有限公司 A kind of online migration automatic convergent method of virtual machine
CN111090496A (en) * 2019-12-06 2020-05-01 苏州浪潮智能科技有限公司 Virtual machine memory migration method and device based on automatic iteration time adjustment
CN112749015A (en) * 2021-01-25 2021-05-04 杭州迪普科技股份有限公司 Load balancing method and device
CN114168528A (en) * 2021-10-31 2022-03-11 陕西浪潮英信科技有限公司 Snapshot generation method, device and medium
CN114710408A (en) * 2022-03-18 2022-07-05 阿里云计算有限公司 Method and device for realizing hot upgrade of virtual switch
CN116339917A (en) * 2023-03-22 2023-06-27 京东科技信息技术有限公司 Data hot migration method, device, electronic device and readable medium of terminal equipment
CN117193948A (en) * 2023-11-07 2023-12-08 中航金网(北京)电子商务有限公司 Virtual machine migration method and device

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101605084A (en) * 2009-06-29 2009-12-16 北京航空航天大学 Method and system for processing virtual network packets based on virtual machine
US20120110237A1 (en) * 2009-12-01 2012-05-03 Bin Li Method, apparatus, and system for online migrating from physical machine to virtual machine
CN102662723A (en) * 2012-02-28 2012-09-12 北京邮电大学 A virtual machine internal storage migration method based on down time threshold
CN102694672A (en) * 2011-03-24 2012-09-26 华为技术有限公司 Method for parameter migration of virtual machine, equipment and virtual machine server

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101605084A (en) * 2009-06-29 2009-12-16 北京航空航天大学 Method and system for processing virtual network packets based on virtual machine
US20120110237A1 (en) * 2009-12-01 2012-05-03 Bin Li Method, apparatus, and system for online migrating from physical machine to virtual machine
CN102694672A (en) * 2011-03-24 2012-09-26 华为技术有限公司 Method for parameter migration of virtual machine, equipment and virtual machine server
CN102662723A (en) * 2012-02-28 2012-09-12 北京邮电大学 A virtual machine internal storage migration method based on down time threshold

Cited By (15)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104123171A (en) * 2014-06-10 2014-10-29 浙江大学 Virtual machine migrating method and system based on NUMA architecture
CN104123171B (en) * 2014-06-10 2017-05-10 浙江大学 Virtual machine migrating method and system based on NUMA architecture
CN104268003A (en) * 2014-09-30 2015-01-07 南京理工大学 Memory state migration method applicable to dynamic migration of virtual machine
CN104268003B (en) * 2014-09-30 2017-11-14 南京理工大学 A kind of internal storage state moving method suitable for dynamic migration of virtual machine
CN106293781A (en) * 2015-05-15 2017-01-04 阿里巴巴集团控股有限公司 The method and apparatus of online upgrading machine virtual machine
US11487523B2 (en) 2015-05-15 2022-11-01 Alibaba Group Holding Limited Updating machine emulator
CN108121589A (en) * 2016-11-30 2018-06-05 中标软件有限公司 A kind of online migration automatic convergent method of virtual machine
CN107133093A (en) * 2017-06-02 2017-09-05 郑州云海信息技术有限公司 The online moving method and device of a kind of virtual machine
CN111090496A (en) * 2019-12-06 2020-05-01 苏州浪潮智能科技有限公司 Virtual machine memory migration method and device based on automatic iteration time adjustment
CN111090496B (en) * 2019-12-06 2022-12-20 苏州浪潮智能科技有限公司 Virtual machine memory migration method and device based on automatic iteration time adjustment
CN112749015A (en) * 2021-01-25 2021-05-04 杭州迪普科技股份有限公司 Load balancing method and device
CN114168528A (en) * 2021-10-31 2022-03-11 陕西浪潮英信科技有限公司 Snapshot generation method, device and medium
CN114710408A (en) * 2022-03-18 2022-07-05 阿里云计算有限公司 Method and device for realizing hot upgrade of virtual switch
CN116339917A (en) * 2023-03-22 2023-06-27 京东科技信息技术有限公司 Data hot migration method, device, electronic device and readable medium of terminal equipment
CN117193948A (en) * 2023-11-07 2023-12-08 中航金网(北京)电子商务有限公司 Virtual machine migration method and device

Also Published As

Publication number Publication date
CN102917055B (en) 2015-11-25

Similar Documents

Publication Publication Date Title
CN102917055B (en) The method that virtual machine moves online, device and terminal equipment
CN108369604B (en) Method and device for sharing file system by multiple operating systems and electronic equipment
US10719463B1 (en) Hardware handling memory write request during memory data migration
CN104094230B (en) For the system and method for the dynamic migration for supporting the virtual machine in virtualized environment
US9588807B2 (en) Live logical partition migration with stateful offload connections using context extraction and insertion
US9473598B2 (en) Network connection failover during application service interruption
US9286171B2 (en) Priming failover of stateful offload adapters
US9588796B2 (en) Live migration with pre-opened shared disks
US8830870B2 (en) Network adapter hardware state migration discovery in a stateful environment
CN104199716B (en) A kind of method of live migration of virtual machine, physical host and system
US10291723B2 (en) Externally initiated application session endpoint migration
CN103812823A (en) Method, device and system for configuration information migration in thermal migration of virtual machine
CN114371811A (en) Method, electronic device and computer program product for storage management
TW201543225A (en) Systems and methods for supporting hot plugging of remote storage devices accessed over a network via NVMe controller
CN102932409B (en) The method and system that a kind of virtual machine moves online
WO2023011254A1 (en) Remote direct data storage-based live migration method and apparatus, and device
US20170094034A1 (en) User datagram protocol (udp) application handling during live kernel update
WO2022267427A1 (en) Virtual machine migration method and system, and electronic device
CN107168786B (en) Method and device for dynamic migration of virtual machine
TW201817197A (en) Upgrading method and device for virtual switch
CN106844012A (en) A kind of method and system of unshared storage dynamic migration virtual machine
CN113424149B (en) Low latency events across VM boundaries
CN112052291A (en) Method and system for accessing distributed block storage system by user mode
CN115629840A (en) Method and system for hot migration of RDMA virtual machine and corresponding physical machine
WO2023231572A1 (en) Container creation method and apparatus, and storage medium

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C14 Grant of patent or utility model
GR01 Patent grant
CF01 Termination of patent right due to non-payment of annual fee
CF01 Termination of patent right due to non-payment of annual fee

Granted publication date: 20151125