CN103891243B - Method and device for realizing virtual machine migration - Google Patents
Method and device for realizing virtual machine migration Download PDFInfo
- Publication number
- CN103891243B CN103891243B CN201280001470.9A CN201280001470A CN103891243B CN 103891243 B CN103891243 B CN 103891243B CN 201280001470 A CN201280001470 A CN 201280001470A CN 103891243 B CN103891243 B CN 103891243B
- Authority
- CN
- China
- Prior art keywords
- virtual machine
- group
- physical machine
- virtual
- machine
- 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.)
- Active
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/44—Arrangements for executing specific programs
- G06F9/455—Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
- G06F9/45533—Hypervisors; Virtual machine monitors
- G06F9/45558—Hypervisor-specific management and integration aspects
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/46—Multiprogramming arrangements
- G06F9/50—Allocation of resources, e.g. of the central processing unit [CPU]
- G06F9/5083—Techniques for rebalancing the load in a distributed system
- G06F9/5088—Techniques for rebalancing the load in a distributed system involving task migration
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/44—Arrangements for executing specific programs
- G06F9/455—Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
- G06F9/45533—Hypervisors; Virtual machine monitors
- G06F9/45558—Hypervisor-specific management and integration aspects
- G06F2009/4557—Distribution of virtual machine instances; Migration and load balancing
Landscapes
- Engineering & Computer Science (AREA)
- Software Systems (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Computer And Data Communications (AREA)
- Data Exchanges In Wide-Area Networks (AREA)
Abstract
Description
技术领域technical field
本发明涉及通信网络技术领域,尤其涉及一种实现虚拟机迁移的方法和相应装置。The present invention relates to the technical field of communication networks, in particular to a method and a corresponding device for realizing virtual machine migration.
背景技术Background technique
云计算有两种模式:狭义云计算IaaS(Infrastructure as a Service)和广义云计算SaaS(Software as a Service),其中IaaS提供给用户的服务是对所有基础设施的利用,包括处理、存储、网络和其它基本的计算资源,SaaS提供给用户的服务是运营商运行在基础设施上的应用程序。There are two modes of cloud computing: narrow cloud computing IaaS (Infrastructure as a Service) and generalized cloud computing SaaS (Software as a Service), in which the service provided by IaaS to users is the utilization of all infrastructure, including processing, storage, network And other basic computing resources, the service provided by SaaS to users is the application program that the operator runs on the infrastructure.
多数IaaS平台通过提供虚拟机的方式提供虚拟计算资源,SaaS供应商可以作为IaaS平台的用户,在IaaS平台上部署应用,再向应用用户提供业务。当IaaS平台是基于虚拟机构建的,那么IaaS平台向SaaS供应商提供的虚拟资源则是根据SaaS供应商要求定制的虚拟机,虚拟机的实际运行位置对SaaS供应商是透明的。IaaS供应商负责虚拟机硬件与相应软件(如虚拟化软件、客户操作系统等)的维护、故障修复、安全监控和计费等,而SaaS供应商负责向用户提供应用服务。通常的,终端访问SaaS提供的一个应用时,例如启动一个网络游戏,SaaS请求IaaS平台为该终端分配一台虚拟机,而且该虚拟机只用于该终端的该应用。Most IaaS platforms provide virtual computing resources by providing virtual machines. SaaS providers can serve as users of the IaaS platform, deploy applications on the IaaS platform, and then provide services to application users. When the IaaS platform is built based on virtual machines, the virtual resources provided by the IaaS platform to the SaaS provider are virtual machines customized according to the requirements of the SaaS provider. The actual running location of the virtual machine is transparent to the SaaS provider. The IaaS provider is responsible for the maintenance, fault repair, security monitoring and billing of virtual machine hardware and corresponding software (such as virtualization software, guest operating system, etc.), while the SaaS provider is responsible for providing application services to users. Usually, when a terminal accesses an application provided by SaaS, such as starting an online game, SaaS requests the IaaS platform to allocate a virtual machine for the terminal, and the virtual machine is only used for the application of the terminal.
协同群组应用是指多个终端获取网络中的计算资源后,共同参与、互相协作完成的应用,该类应用的例子包含网络游戏、文件共享、视频会议等。这多个参与协同群组应用的终端构成一个协同群组。A collaborative group application refers to an application in which multiple terminals participate in and cooperate with each other after obtaining computing resources in the network. Examples of such applications include online games, file sharing, and video conferencing. The multiple terminals participating in the cooperative group application form a cooperative group.
现有技术中,当SaaS供应商所提供的软件应用为协同群组应用时,如果SaaS平台是构建在虚拟机之上的,则协同群组应用具体是由分配给组成协同群组应用的终端的一组虚拟机完成。其中,这一组虚拟机则组成虚拟机群组。虚拟机群组中的虚拟机可能运行于不同的子网上或不同物理机上,它们之间会产生大量通信,而跨子网通信所需时间较长,远大于相同子网内通信所需时间;即使相同子网中不同物理机之间通信也大于同一物理机内通信所需时间。因此,现有技术存在应用响应时间较长、导致用户应用体验不好的缺陷。In the prior art, when the software application provided by the SaaS provider is a collaborative group application, if the SaaS platform is built on a virtual machine, the collaborative group application is specifically assigned to the terminals that form the collaborative group application. A set of virtual machines is complete. Wherein, this group of virtual machines constitutes a virtual machine group. The virtual machines in the virtual machine group may run on different subnets or different physical machines, and there will be a lot of communication between them, and the time required for cross-subnet communication is much longer than that required for communication within the same subnet; Even the communication between different physical machines in the same subnet is longer than the time required for communication within the same physical machine. Therefore, the prior art has the defect that the application response time is relatively long, resulting in poor application experience for users.
发明内容Contents of the invention
本发明实施例提供了一种实现虚拟机迁移的方法和装置,用于提高完成协同群组应用的虚拟机群组内虚拟机之间数据通信的速度,从而减少了应用响应时间、极大提升用户体验。Embodiments of the present invention provide a method and device for implementing virtual machine migration, which are used to increase the speed of data communication between virtual machines in a virtual machine group that completes collaborative group applications, thereby reducing application response time and greatly improving user experience.
第一方面,本发明实施例提供的实现虚拟机迁移的方法包含:In the first aspect, the method for implementing virtual machine migration provided by the embodiment of the present invention includes:
接收应用管理服务器发送的虚拟机群组的信息,该虚拟机群组包含完成指定的协同群组应用的多台虚拟机,该虚拟机群组的信息包含该虚拟机群组中每台虚拟机的唯一标识;Receive the information of the virtual machine group sent by the application management server. The virtual machine group includes multiple virtual machines that complete the specified collaborative group application. The information of the virtual machine group includes the information of each virtual machine in the virtual machine group. unique identifier of
根据该虚拟机群组的信息,查找该虚拟机群组中每台虚拟机的部署位置信息,该虚拟机的部署位置信息包含该虚拟机所归属子网的唯一标识和所运行于的物理机的唯一标识;According to the information of the virtual machine group, find the deployment location information of each virtual machine in the virtual machine group. The deployment location information of the virtual machine includes the unique identifier of the subnet to which the virtual machine belongs and the physical machine on which it runs unique identifier of
根据该虚拟机的部署位置信息,确定能够容纳该虚拟机群组、并且容纳后该虚拟机群组中各虚拟机之间的通信响应时间比当前通信响应时间更短的一个目的物理机集合;According to the deployment location information of the virtual machine, determine a set of target physical machines that can accommodate the virtual machine group and whose communication response time between virtual machines in the virtual machine group is shorter than the current communication response time after the accommodation;
判断该虚拟机群组中各台虚拟机所运行于的物理机是否属于该确定出的目的物理机集合,当该虚拟机所运行于的物理机不属于该目的物理机集合时,将该虚拟机迁移到该目的物理机集合。Judging whether the physical machine on which each virtual machine in the virtual machine group runs belongs to the determined target physical machine set, and when the physical machine on which the virtual machine runs does not belong to the target physical machine set, the virtual machine The machine is migrated to the target physical machine set.
在第一方面的第一种可能的实现方式中,确定能够容纳该虚拟机群组、并且容纳后该虚拟机群组中各虚拟机之间的通信响应时间比当前通信响应时间更短的一个目的物理机集合的方法包含:当该虚拟机群组中所有虚拟机在同一个子网的不同物理机时,确定出该子网中能够容纳该虚拟机群组、且包含物理机个数最少的物理机集合;选择其中一个物理机集合作为目的物理机集合。In a first possible implementation manner of the first aspect, a virtual machine group that can accommodate the virtual machine group and that has a shorter communication response time between virtual machines in the virtual machine group than the current communication response time is determined. The method for collecting the target physical machines includes: when all the virtual machines in the virtual machine group are in different physical machines in the same subnet, determine the virtual machine group in the subnet that can accommodate the virtual machine group and contains the least number of physical machines Physical machine collection; select one of the physical machine collections as the target physical machine collection.
在第一方面的第二种可能的实现方式中,确定能够容纳该虚拟机群组、并且容纳后该虚拟机群组中各虚拟机之间的通信响应时间比当前通信响应时间更短的一个目的物理机集合的方法包含:当该虚拟机群组中所有虚拟机在不同子网的不同物理机时,确定出该所有子网中能够容纳该虚拟机群组、并且包含子网数量最少的子网集合;在该子网集合中确定出能够容纳该虚拟机群组、且包含物理机个数最少的物理机集合;选择其中一个物理机集合作为目的物理机集合。In the second possible implementation manner of the first aspect, determine a virtual machine group that can accommodate the virtual machine group, and after the accommodation, the communication response time between the virtual machines in the virtual machine group is shorter than the current communication response time The method for the target physical machine collection includes: when all the virtual machines in the virtual machine group are in different physical machines in different subnets, determine the one that can accommodate the virtual machine group and contains the least number of subnets among all the subnets A subnet set; determine a physical machine set in the subnet set that can accommodate the virtual machine group and contains the least number of physical machines; select one of the physical machine sets as the target physical machine set.
在第一方面的第三种可能的实现方式中,将该虚拟机迁移到该目的物理机集合,进一步的包含:如果该迁移是跨子网迁移,向应用管理服务器发送该虚拟机迁移后的IP地址。In a third possible implementation of the first aspect, migrating the virtual machine to the target physical machine set further includes: if the migration is cross-subnet migration, sending the migration of the virtual machine to the application management server IP address.
结合第一方面的第一种可能的实现方式,在第四种可能的实现方式中,选择其中一个物理机集合作为该目的物理机集合具体包括:如果该确定出的物理机集合有多个时,选择需要该虚拟机群组中虚拟机迁移次数最少的一个物理机集合为该目的物理机集合。With reference to the first possible implementation of the first aspect, in a fourth possible implementation, selecting one of the physical machine sets as the target physical machine set specifically includes: if the determined physical machine set has multiple , select a physical machine set that requires the least number of virtual machine migrations in the virtual machine group as the target physical machine set.
结合第一方面的第二种可能的实现方式,在第五种可能的实现方式中,选择其中一个物理机集合作为该目的物理机集合包括:如果该确定出的物理机集合有多个时,选择需要该虚拟机群组中虚拟机迁移次数最少的一个物理机集合作为目的物理机集合。With reference to the second possible implementation of the first aspect, in a fifth possible implementation, selecting one of the physical machine sets as the target physical machine set includes: if there are multiple physical machine sets determined, A physical machine set requiring the least number of virtual machine migrations in the virtual machine group is selected as the target physical machine set.
第二方面,本发明实施例提供的资源管理服务器包含:In the second aspect, the resource management server provided by the embodiment of the present invention includes:
接口单元,用于接收应用管理服务器发送的虚拟机群组的信息,该虚拟机群组包含完成指定的协同群组应用的多台虚拟机,该虚拟机群组的信息包含该虚拟机群组中每台虚拟机的唯一标识;The interface unit is used to receive the information of the virtual machine group sent by the application management server, the virtual machine group includes multiple virtual machines that complete the specified collaborative group application, and the information of the virtual machine group includes the virtual machine group A unique identifier for each virtual machine in the ;
查找单元,用于根据接口单元接收到的该虚拟机群组的信息查找该虚拟机群组中每台虚拟机的部署位置信息,该虚拟机的部署位置信息包含该虚拟机所归属子网的唯一标识和所运行于的物理机的唯一标识;The search unit is configured to search for the deployment location information of each virtual machine in the virtual machine group according to the information of the virtual machine group received by the interface unit, and the deployment location information of the virtual machine includes the information of the subnet to which the virtual machine belongs. The unique identifier and the unique identifier of the physical machine on which it runs;
确定单元,用于根据查找单元查找到的该虚拟机的部署位置信息确定能够容纳该虚拟机群组、并且容纳后该虚拟机群组中各虚拟机之间通信响应时间比当前通信响应时间更短的一个目的物理机集合;The determining unit is configured to determine, according to the deployment location information of the virtual machine found by the searching unit, that the virtual machine group can be accommodated, and that after the accommodation, the communication response time between the virtual machines in the virtual machine group is faster than the current communication response time A short set of destination physical machines;
判断单元,用于判断该虚拟机群组中各台虚拟机所运行于的物理机是否属于该确定出的目的物理机集合;A judging unit, configured to judge whether the physical machine on which each virtual machine in the virtual machine group runs belongs to the determined target physical machine set;
迁移单元,用于当该虚拟机所运行于的物理机不属于该目的物理机集合时,将该虚拟机迁移到该目的物理机集合。The migration unit is configured to migrate the virtual machine to the target physical machine set when the physical machine on which the virtual machine runs does not belong to the target physical machine set.
在第二方面的第一种可能的实现方式中,确定单元包含:In a first possible implementation manner of the second aspect, the determining unit includes:
第一确定模块,用于当该虚拟机群组中所有虚拟机在同一个子网的不同物理机时,确定出该子网中能够容纳该虚拟机群组、且包含物理机个数最少的物理机集合;The first determination module is used to determine the physical machine that can accommodate the virtual machine group and contains the least number of physical machines in the subnet when all the virtual machines in the virtual machine group are on different physical machines in the same subnet. machine collection;
第一选择模块,用于在该第一确定模块确定出的物理机集合中选择其中一个作为该目的物理机集合。A first selecting module, configured to select one of the physical machine sets determined by the first determining module as the target physical machine set.
在第二方面的第二种可能的实现方式中,确定单元包含:In a second possible implementation manner of the second aspect, the determining unit includes:
第二确定模块,用于当该虚拟机群组中所有虚拟机在不同子网的不同物理机时,确定出该所有子网中能够容纳该虚拟机群组、并且包含子网数量最少的子网集合;The second determination module is used to determine the subnet that can accommodate the virtual machine group and contains the least number of subnets in all subnets when all the virtual machines in the virtual machine group are on different physical machines in different subnets net collection;
第三确定模块:用于在第二确定模块确定出的子网集合中,确定出能够容纳该虚拟机群组、且包含物理机个数最少的物理机集合;The third determination module: used to determine, among the subnet sets determined by the second determination module, a physical machine set capable of accommodating the virtual machine group and containing the least number of physical machines;
第二选择模块,用于在第三确定模块确定出的物理机集合中选择其中一个作为目的物理机集合。The second selecting module is configured to select one of the physical machine sets determined by the third determining module as the target physical machine set.
在第二方面的第三种可能的实现方式中,接口单元还用于在该迁移单元执行了虚拟机的跨子网迁移后,向应用管理服务器发送该虚拟机迁移后的IP地址。In a third possible implementation manner of the second aspect, the interface unit is further configured to send the migrated IP address of the virtual machine to the application management server after the migration unit performs cross-subnet migration of the virtual machine.
结合第二方面的第一种可能的实现方式,在第四种可能的实现方式中,第一选择模块,进一步的用于在该第一确定模块确定出的物理机集合有多个时,选择需要该虚拟机群组中虚拟机迁移次数最少的一个物理机集合为该目的物理机集合。结合第二方面的第二种可能的实现方式,在第五种可能的实现方式中,第二选择模块,进一步的用于在第三确定模块确定出的物理机集合有多个时,选择需要该虚拟机群组中虚拟机迁移次数最少的一个物理机集合为目的物理机集合。With reference to the first possible implementation of the second aspect, in a fourth possible implementation, the first selection module is further configured to, when there are multiple sets of physical machines determined by the first determination module, select A physical machine set with the least number of virtual machine migrations in the virtual machine group is required to be the target physical machine set. With reference to the second possible implementation of the second aspect, in the fifth possible implementation, the second selection module is further configured to select the required A set of physical machines with the least number of virtual machine migrations in the virtual machine group is the set of target physical machines.
由以上技术方案可以看出,由于通过将提供协同群组应用的虚拟机群组中的虚拟机部署在包含子网数目最少的前提下、包含物理机数目最少的物理机集合上,实现虚拟机群组内虚拟机通信数据快速交换,从而达到提高应用用户体验的目的。It can be seen from the above technical solutions that by deploying the virtual machines in the virtual machine group that provides collaborative group applications on the physical machine set that includes the least number of subnets and the least number of physical machines, the realization of virtual machine The virtual machine communication data in the group is exchanged quickly, so as to achieve the purpose of improving the user experience of the application.
附图说明Description of drawings
为了更清楚地说明本发明实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本发明的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动性的前提下,还可以根据这些附图获得其他的附图。In order to more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the following will briefly introduce the drawings that need to be used in the description of the embodiments or the prior art. Obviously, the accompanying drawings in the following description are only These are some embodiments of the present invention. For those skilled in the art, other drawings can also be obtained according to these drawings without any creative effort.
图1为本发明一个实施例提供的实现虚拟机迁移的方法流程图;FIG. 1 is a flowchart of a method for implementing virtual machine migration provided by an embodiment of the present invention;
图2为图1所示方法的确定能够容纳虚拟机群组、并且使得虚拟机群组中各虚拟机之间的通信响应时间比当前通信响应时间更短的一个目的物理机集合的方法实施例流程图;Fig. 2 is a method embodiment of the method shown in Fig. 1 for determining a target physical machine set that can accommodate a virtual machine group and make the communication response time between virtual machines in the virtual machine group shorter than the current communication response time flow chart;
图3为图1所示方法的将虚拟机群组中其所运行于的物理机不属于目的物理机集合的虚拟机迁移到该目的物理机集合的一个方法实施例流程图;FIG. 3 is a flow chart of a method embodiment of the method shown in FIG. 1 for migrating a virtual machine whose physical machine in the virtual machine group does not belong to the target physical machine set to the target physical machine set;
图4为本发明一个实施例提供的多个用户进行群组游戏的时序图;Fig. 4 is a sequence diagram of multiple users playing a group game provided by an embodiment of the present invention;
图5为本发明一个实施例提供的用于实现虚拟机迁移的资源管理服务器的结构图;FIG. 5 is a structural diagram of a resource management server for implementing virtual machine migration provided by an embodiment of the present invention;
图6为本发明另一个实施例提供的用于实现虚拟机迁移的资源管理服务器的结构图;FIG. 6 is a structural diagram of a resource management server for implementing virtual machine migration provided by another embodiment of the present invention;
图7为本发明再一个实施例提供的用于实现虚拟机迁移的资源管理服务器的结构图;FIG. 7 is a structural diagram of a resource management server for implementing virtual machine migration provided by another embodiment of the present invention;
图8为本发明再一个实施例提供的基于计算机系统的资源管理服务器的结构图。FIG. 8 is a structural diagram of a resource management server based on a computer system provided by another embodiment of the present invention.
具体实施方式detailed description
下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本发明一部分实施例,而不是全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有作出创造性劳动前提下所获得的所有其他实施例,都属于本发明保护的范围。The following will clearly and completely describe the technical solutions in the embodiments of the present invention with reference to the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only some, not all, embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by persons of ordinary skill in the art without creative efforts fall within the protection scope of the present invention.
从资源管理服务器的角度进行描述,本发明一个实施例提供了实现虚拟机迁移的方法,其流程如图1所示:Described from the perspective of a resource management server, an embodiment of the present invention provides a method for implementing virtual machine migration, the process of which is shown in Figure 1:
101、接收应用管理服务器发送的虚拟机群组的信息,该虚拟机群组包含完成指定的协同群组应用的多台虚拟机,该虚拟机群组的信息包含该虚拟机群组中每台虚拟机的唯一标识。101. Receive the information of the virtual machine group sent by the application management server, the virtual machine group includes multiple virtual machines that complete the specified collaborative group application, and the information of the virtual machine group includes the information of each virtual machine in the virtual machine group A unique identifier for the virtual machine.
具体而言,虚拟机的唯一标识可以是虚拟机的当前IP地址或标识符ID。Specifically, the unique identifier of the virtual machine may be a current IP address or an identifier ID of the virtual machine.
102、根据接收到的虚拟机群组的信息,查找所述虚拟机群组中每台虚拟机的部署位置信息,该部署位置信息包括虚拟机所归属子网的唯一标识和该虚拟机所运行于的物理机的唯一标识。102. According to the received information of the virtual machine group, search for the deployment location information of each virtual machine in the virtual machine group, where the deployment location information includes the unique identifier of the subnet to which the virtual machine belongs and the virtual machine running The unique identifier of the physical machine.
103、根据查找到的虚拟机的部署位置信息,确定出能够容纳该虚拟机群组、且容纳后该虚拟机群组中各虚拟机之间的通信响应时间比当前通信响应时间更短的一个目的物理机集合。103. According to the found deployment position information of the virtual machine, determine a virtual machine group that can accommodate the virtual machine group, and after the accommodation, the communication response time between the virtual machines in the virtual machine group is shorter than the current communication response time A collection of target physical machines.
其中,该步骤具体包括:当该虚拟机群组中的虚拟机运行于同一个子网的不同物理机时,确定出该子网中能够容纳该虚拟机群组、且包含物理机个数最少的物理机集合。如果确定出的物理机集合只有一个,将该物理机集合作为目的物理机集合;如果确定出的物理机集合有多个时,计算将虚拟机群组中的虚拟机迁移到确定出的每一个物理机集合需要迁移的次数,选择需要虚拟机群组中的虚拟机迁移次数最少的一个物理机集合为目的物理机集合;Wherein, this step specifically includes: when the virtual machines in the virtual machine group run on different physical machines in the same subnet, determine the virtual machine group in the subnet that can accommodate the virtual machine group and contains the least number of physical machines collection of physical machines. If there is only one physical machine set determined, use this physical machine set as the target physical machine set; if there are multiple determined physical machine sets, the calculation will migrate the virtual machines in the virtual machine group to each determined The number of times the physical machine set needs to be migrated, select a physical machine set that requires the least number of virtual machine migrations in the virtual machine group as the target physical machine set;
当该虚拟机群组的虚拟机运行于不同子网的不同物理机时,在所述不同子网中确定出能够容纳该虚拟机群组、并且包含子网数量最少的子网集合。在该确定出的子网集合中确定出能够容纳该虚拟机群组、且包含物理机个数最少的物理机集合。如果确定出的物理机集合只有一个,将该物理机集合作为目的物理机集合;如果确定出的物理机集合有多个时,计算将虚拟机群组中的虚拟机迁移到确定出的每一个物理机集合需要迁移的次数,选择需要虚拟机群组中虚拟机迁移次数最少的一个物理机集合为目的物理机集合。When the virtual machines in the virtual machine group run on different physical machines in different subnets, a subnet set that can accommodate the virtual machine group and includes the least number of subnets is determined in the different subnets. A physical machine set capable of accommodating the virtual machine group and containing the least number of physical machines is determined in the determined subnet set. If there is only one physical machine set determined, use this physical machine set as the target physical machine set; if there are multiple determined physical machine sets, the calculation will migrate the virtual machines in the virtual machine group to each determined The number of times the physical machine set needs to be migrated, and a physical machine set that requires the least number of virtual machine migrations in the virtual machine group is selected as the target physical machine set.
104、判断虚拟机群组中各台虚拟机所运行于的物理机是否属于确定出的目的物理机集合,当虚拟机所运行于的物理机不属于目的物理机集合时,将该虚拟机迁移到目的物理机集合。104. Determine whether the physical machine on which each virtual machine in the virtual machine group runs belongs to the determined target physical machine set, and when the physical machine on which the virtual machine runs does not belong to the target physical machine set, migrate the virtual machine to the destination physical machine collection.
其中,该步骤还可以包含:如果该迁移是跨子网迁移,向应用管理服务器发送该虚拟机迁移后的IP地址。Wherein, this step may further include: if the migration is cross-subnet migration, sending the migrated IP address of the virtual machine to the application management server.
本发明再一个实施例提供了上述实施例中,根据查找到的虚拟机的部署位置信息,确定出能够容纳该虚拟机群组、并且容纳后虚拟机群组中各虚拟机之间的通信响应时间比当前通信响应时间更短的一个目的物理机集合的方法,具体流程如图2所示:Another embodiment of the present invention provides that in the above-mentioned embodiment, according to the deployment position information of the found virtual machine, it is determined that the virtual machine group can be accommodated, and the communication response between the virtual machines in the virtual machine group is determined. The method of a target physical machine set whose time is shorter than the current communication response time, the specific process is shown in Figure 2:
201、判断虚拟机群组中的所有虚拟机是否运行于同一台物理机上,如果是,则进入步骤202;如果不是,则进入步骤203。201. Determine whether all the virtual machines in the virtual machine group run on the same physical machine, if yes, go to step 202; if not, go to step 203.
202、不存在能够容纳该虚拟机群组、并且容纳后虚拟机群组中各虚拟机之间的通信响应时间比当前通信响应时间更短的目的物理机集合,流程结束。202. There is no target physical machine set that can accommodate the virtual machine group, and the communication response time between the virtual machines in the accommodated virtual machine group is shorter than the current communication response time, and the process ends.
203、计算虚拟机群组中所有虚拟机所需要的资源总和。203. Calculate the sum of resources required by all the virtual machines in the virtual machine group.
204、判断虚拟机群组中的虚拟机所运行于的物理机是否属于同一子网,假如是则进入步骤205,假如不是则进入步骤210。204 . Determine whether the physical machines on which the virtual machines in the virtual machine group run belong to the same subnet, if yes, go to step 205 , if not, go to step 210 .
205、令自然数变量k的初始值为1。205. Let the initial value of the natural number variable k be 1.
206、在该子网内确定是否存在可以同时容纳该群组中所有虚拟机的物理机集合,即,该物理机集合中已经分配给上述虚拟机群组的资源与剩余的空闲资源的总和大于或等于步骤203计算出的资源总和,且该物理机集合包含的物理机数目为k。如果存在,则进入步骤208,否则进入步骤207。206. Determine whether there is a physical machine set in the subnet that can accommodate all the virtual machines in the group at the same time, that is, the sum of the resources allocated to the above-mentioned virtual machine group and the remaining free resources in the physical machine set is greater than Or equal to the sum of resources calculated in step 203, and the number of physical machines included in the physical machine set is k. If yes, go to step 208, otherwise go to step 207.
207、将变量k值加1,转到步骤206。207. Add 1 to the value of the variable k, and go to step 206.
208、将确定出的一个或多个物理机集合记录为候选目的物理机集合,对每个候选目的物理机集合计算虚拟机群组中的虚拟机需要的迁移次数。具体的,针对每个候选目的物理机集合的计算方法可以为,对于虚拟机群组中的每台虚拟机,分别确定其运行在哪一台物理机上,针对每台虚拟机判断一次其所运行的物理机是否属于该候选目的物理机集合,累计不属于该候选目的物理机集合的判断次数,该判断次数即为迁移次数。208 . Record the determined one or more sets of physical machines as a set of candidate target physical machines, and calculate the migration times required by the virtual machines in the virtual machine group for each set of candidate target physical machines. Specifically, the calculation method for the set of physical machines for each candidate purpose can be as follows: for each virtual machine in the virtual machine group, determine which physical machine it is running on, and determine once for each virtual machine which virtual machine it is running on. Whether the physical machine belongs to the candidate target physical machine set, and the number of judgments that do not belong to the candidate target physical machine set is accumulated, and the judgment number is the number of migrations.
209、选择迁移次数最少(即迁移代价最小)的候选目的物理机集合作为目的物理机集合,假如存在多个迁移次数最少的候选目的物理机集合,则任选其中一个作为目的物理机集合。209. Select the candidate target physical machine set with the least number of migrations (that is, the smallest migration cost) as the target physical machine set, and if there are multiple candidate target physical machine sets with the least number of migrations, select one of them as the target physical machine set.
210、令自然数变量k的初始值为1。210. Let the initial value of the natural number variable k be 1.
211、在该不同子网内查找是否存在可以同时容纳该群组中所有虚拟机的子网集合,即该子网集合中已经分配给虚拟机群组中虚拟机的资源与剩余的空闲资源的总和大于或等于步骤203计算出的资源总和,且该个集合包含k个子网。如果存在,则进入步骤213,否则进入步骤212。211. Find whether there is a subnet set in the different subnets that can accommodate all the virtual machines in the group at the same time, that is, the difference between the resources allocated to the virtual machines in the virtual machine group and the remaining idle resources in the subnet set The sum is greater than or equal to the sum of resources calculated in step 203, and this set includes k subnets. If yes, go to step 213, otherwise go to step 212.
212、将变量k值加1,转到步骤211。212. Add 1 to the variable k, and go to step 211.
213、将查找到的一个或多个子网集合记录为候选子网集合,令自然数变量s的初始值为k,k为子网集合包含子网的个数。213. Record one or more found subnet sets as a candidate subnet set, and set the initial value of the natural number variable s to k, where k is the number of subnets included in the subnet set.
214、在所有找到的候选子网集合中查找是否存在可以容纳虚拟机群组中所有虚拟机的物理机集合,即该物理机集合中已经分配给虚拟机群组中虚拟机的资源与剩余的空闲资源的总和大于或等于步骤203计算出的资源总和,且每个物理机集合包含s台物理机。如果存在,则进入步骤216,否则进入步骤215。214. Find out whether there is a physical machine set that can accommodate all the virtual machines in the virtual machine group in all the found candidate subnet sets, that is, the resources that have been allocated to the virtual machines in the virtual machine group and the remaining resources in the physical machine set The sum of free resources is greater than or equal to the sum of resources calculated in step 203, and each physical machine set includes s physical machines. If yes, go to step 216, otherwise go to step 215.
215、将变量s值加1,跳转到步骤214。215. Add 1 to the value of the variable s, and jump to step 214.
216、将查找到的一个或多个物理机集合记录为候选目的物理机集合,对每个候选目的物理机集合计算虚拟机群组中的虚拟机需要的迁移次数。具体的,针对每个候选目的物理机集合的计算方法可以为,对于群组中的每台虚拟机,分别确定其运行在哪一台物理机上,并针对每台虚拟机判断一次其所运行的物理机是否属于该候选目的物理机集合,累计不属于该候选目的物理机集合的判断次数,该判断次数即为迁移次数。216. Record the found one or more sets of physical machines as a set of candidate target physical machines, and calculate the number of migrations required by the virtual machines in the virtual machine group for each set of candidate target physical machines. Specifically, the calculation method for the set of physical machines for each candidate purpose can be as follows: for each virtual machine in the group, determine which physical machine it is running on, and judge once for each virtual machine which virtual machine it is running on. Whether the physical machine belongs to the candidate target physical machine set, and the number of times of judging that it does not belong to the candidate target physical machine set is accumulated, and the judging times are the migration times.
217、选择迁移次数最少(即迁移代价最小)的候选目的物理机集合作为目的物理机集合;假如存在多个迁移次数最少的候选目的物理机集合,则任选其中一个作为目的物理机集合。217. Select the candidate target physical machine set with the least number of migrations (that is, the smallest migration cost) as the target physical machine set; if there are multiple candidate target physical machine sets with the least number of migrations, select one of them as the target physical machine set.
上述实施例中,在包含子网数目最少的前提下,查找包含物理机数目最少的物理机集合,因此将虚拟机群组部署到该集合后虚拟机群组之间的通信响应时间会比现有部署方式下虚拟机群组之间的通信响应时间更短。In the above-mentioned embodiment, on the premise of including the least number of subnets, the set of physical machines with the least number of physical machines is searched for. Therefore, after the virtual machine group is deployed to this set, the communication response time between the virtual machine groups will be slower than the current one. The communication response time between virtual machine groups is shorter in the deployment mode.
本发明又一个实施例提供了在实现虚拟机迁移的方法中、确定出一个目的物理机集合之后、将该虚拟机群组中其所运行于的物理机不属于该目的物理机集合的虚拟机迁移到该目的物理机集合的方法,其流程如图3所示:Yet another embodiment of the present invention provides a method for implementing virtual machine migration, after a target physical machine set is determined, the virtual machine on which the physical machine in the virtual machine group does not belong to the target physical machine set The process of migrating to the target physical machine set is shown in Figure 3:
301、读取目的物理机集合中每台物理机的IP地址所属的子网,记录子网集合。301. Read the subnet to which the IP address of each physical machine in the target physical machine set belongs, and record the subnet set.
302、将虚拟机群组中所有的虚拟机分为三个类型,类型1:虚拟机所运行于的物理机属于该目的物理机集合;类型2:虚拟机所运行于的物理机不属于该目的物理机集合,但该物理机所属的子网属于该子网集合;类型3:虚拟机所运行于的物理机不属于该目的物理机集合,该物理机所属的子网也不属于该子网集合。302. Divide all virtual machines in the virtual machine group into three types, type 1: the physical machine on which the virtual machine runs belongs to the target physical machine set; type 2: the physical machine on which the virtual machine runs does not belong to the target physical machine set The target physical machine set, but the subnet to which the physical machine belongs belongs to the subnet set; type 3: the physical machine on which the virtual machine runs does not belong to the target physical machine set, and the subnet to which the physical machine belongs does not belong to the subnet Web collection.
303、对于类型2的每台虚拟机,在目的物理机集合中查找是否存在与该虚拟机所运行于的物理机属于相同子网且有空闲资源的物理机,若有则将该虚拟机迁移到该物理机,否则随机迁移到目的物理机集合中任一具有空闲资源的物理机。303. For each virtual machine of type 2, check in the target physical machine set whether there is a physical machine that belongs to the same subnet as the physical machine on which the virtual machine runs and has idle resources, and if so, migrate the virtual machine Otherwise, randomly migrate to any physical machine with free resources in the target physical machine set.
304、对于类型3的每台虚拟机,将其随机迁移到目的物理机集合中任一具有空闲资源的物理机。304. For each virtual machine of type 3, randomly migrate it to any physical machine with idle resources in the target physical machine set.
上述实施例中,对于其所运行于的物理机不属于目的物理机集合的虚拟机优先迁移到与该虚拟机所运行于的物理机在相同子网的物理机上,因而可以减少跨网段的迁移,并且能够使得迁移所消耗的系统资源最少。In the above embodiment, the virtual machine on which the physical machine does not belong to the target physical machine set is preferentially migrated to the physical machine on the same subnet as the physical machine on which the virtual machine is running, thus reducing cross-network segment Migration, and can minimize the system resources consumed by migration.
本发明一个实施例采用时序图的方式描述了实现虚拟机迁移的方法,如图4所示,用户user1、user2、user3将要进行一次群组游戏,具体实现步骤的详细描述如下。假设这三个用户在进行本次群组游戏前,应用管理服务器已经为他们分配了用于提供游戏业务的虚拟机,具体的分配方式可以是用户启动终端上的游戏应用(登录游戏平台)后、应用管理服务器请求资源管理服务器为他分配一台虚拟机,也可以是用户加入到一个具体游戏后、应用管理服务器请求资源管理服务器为他分配一台虚拟机。只有在用户退出该游戏平台后,系统才会注销为他分配的虚拟机资源:An embodiment of the present invention uses a sequence diagram to describe a method for implementing virtual machine migration. As shown in FIG. 4 , users user1, user2, and user3 are about to play a group game, and the specific implementation steps are described in detail as follows. Assume that before these three users play this group game, the application management server has assigned them virtual machines for providing game services. 1. The application management server requests the resource management server to allocate a virtual machine for him, or after the user joins a specific game, the application management server requests the resource management server to allocate a virtual machine for him. Only after the user exits the game platform, the system will cancel the virtual machine resources allocated to him:
S401,用户user1通过其终端UE1访问为他分配的虚拟机VM1(其标识符为ID1,IP地址为ip1)上的游戏应用,点击“新建房间”按钮,VM1将向应用管理服务器发送新建游戏房间的请求。应用管理服务器收到请求后初始化游戏房间A,即创建群组号为A的游戏群组;并且,创建群组号为A的虚拟机群组,将该虚拟机群组A与游戏群组A绑定。将VM1加入到虚拟机群组A,记录虚拟机群组A的信息(包含虚拟机群组号A、虚拟机VM1的标识符和IP地址信息)。S401, the user user1 accesses the game application on the virtual machine VM1 (its identifier is ID1, IP address is ip1) assigned to him through its terminal UE1, clicks the "new room" button, and VM1 will send a new game room to the application management server request. After receiving the request, the application management server initializes game room A, that is, creates a game group with group number A; and creates a virtual machine group with group number A, and connects virtual machine group A with game group A bound. Add VM1 to virtual machine group A, and record the information of virtual machine group A (including virtual machine group number A, identifier and IP address information of virtual machine VM1).
S402,用户user2通过其终端UE2访问为他分配的虚拟机VM2(其标识符为ID2,IP地址为ip2)上的游戏应用,看到游戏房间A,点击“加入”按钮;VM2将向应用管理服务器发送加入群组游戏的请求,应用管理服务器将VM2加入到虚拟机群组A,刷新虚拟机群组A的信息(包含群组号A、虚拟机VM1和VM2的标识符和IP地址信息),并为虚拟机VM1和VM2之间建立通信连接。S402, the user user2 accesses the game application on the virtual machine VM2 (its identifier is ID2, IP address is ip2) assigned to him through its terminal UE2, sees the game room A, clicks the "Join" button; VM2 will add to the application management The server sends a request to join the group game, and the application management server adds VM2 to virtual machine group A, and refreshes the information of virtual machine group A (including group number A, identifiers and IP address information of virtual machines VM1 and VM2) , and establish a communication connection between the virtual machines VM1 and VM2.
S403,用户user3通过UE3访问虚拟机VM3(其标识符为ID3,IP地址为ip3)上的游戏应用,加入到虚拟机群组A中,处理方式和步骤S402类似。S403, the user user3 accesses the game application on the virtual machine VM3 (its identifier is ID3 and IP address is ip3) through UE3, and joins the virtual machine group A, and the processing method is similar to step S402.
S404,用户user1通过其终端查看当前游戏房间A满足游戏开始人数下限,点击“开始游戏”按钮,VM1给应用管理服务器发送开始应用的请求,请求包含群组游戏的群组号A。S404, the user user1 checks through his terminal that the current game room A satisfies the minimum number of players to start the game, clicks the "Start Game" button, VM1 sends a request to the application management server to start the application, and the request includes the group number A of the group game.
S405,应用管理服务器收到VM1发送的请求后,根据包含的群组号判断出这是一个群组游戏的开始请求,将与游戏群组A绑定的虚拟机群组A的信息发送给资源管理服务器,虚拟机群组A的信息包括虚拟机群组A中的虚拟机VM1,VM2和V M3的标识符数组VMID[]={ID1,ID2,ID3}。S405. After receiving the request sent by VM1, the application management server determines that this is a group game start request according to the included group number, and sends the information of the virtual machine group A bound to the game group A to the resource In the management server, the information of the virtual machine group A includes an array of identifiers VMID[]={ID1, ID2, ID3} of the virtual machines VM1, VM2 and VM3 in the virtual machine group A.
S406,资源管理服务器根据群组中虚拟机的标识符数组VMID[]={ID1,ID2,ID3}查找VM1,VM2和VM3所归属子网的唯一标识和所运行于的物理机的唯一标识。S406, the resource management server looks up the unique identifier of the subnet to which VM1, VM2 and VM3 belong and the unique identifier of the physical machine on which they run according to the identifier array VMID[]={ID1, ID2, ID3} of the virtual machines in the group.
S407,资源管理服务器确定能容纳VM1,VM2和VM3这三个虚拟机、并且让它们之间通信响应时间比当前更短的迁移目的物理机集合。S407, the resource management server determines a migration target physical machine set that can accommodate the three virtual machines VM1, VM2, and VM3, and make the communication response time between them shorter than the current one.
通常,虚拟机群组中的的虚拟机分布会存在如下三种不同情况:Generally, there are three different situations in the distribution of virtual machines in a virtual machine group as follows:
情况1.虚拟机群组中的所有虚拟机运行于同一物理机上;情况2.虚拟机群组中的虚拟机运行于相同子网的不同物理机上;情况3.虚拟机群组中的虚拟机运行于不同子网的不同物理机上。Case 1. All virtual machines in the virtual machine group run on the same physical machine; Case 2. The virtual machines in the virtual machine group run on different physical machines in the same subnet; Case 3. The virtual machines in the virtual machine group Running on different physical machines on different subnets.
具体地,在本实施例中,针对情况1,资源管理服务器获取的VM1,VM2,VM3这三个虚拟机部署位置信息为:子网数组VMNS[]={子网A,子网A,子网A}和物理机编号数组MID[]={M1,M1,M1}。针对情况2,资源管理服务器获取的三个虚拟机部署位置信息为:子网数组VMNS[]={子网A,子网A,子网A}和物理机编号数组MID[]={M1,M1,M2}。针对情况3,资源管理服务器获取的三个虚拟机部署位置信息为:子网数组VMNS[]={子网A,子网A,子网B}和物理机编号数组MID[]={M1,M1,M3}。Specifically, in this embodiment, for case 1, the deployment location information of the three virtual machines VM1, VM2, and VM3 obtained by the resource management server is: subnet array VMNS[]={subnet A, subnet A, subnet Network A} and physical machine number array MID[]={M1, M1, M1}. For case 2, the deployment location information of the three virtual machines obtained by the resource management server is: subnet array VMNS[]={subnet A, subnet A, subnet A} and physical machine number array MID[]={M1, M1, M2}. For case 3, the deployment location information of the three virtual machines obtained by the resource management server is: subnet array VMNS[]={subnet A, subnet A, subnet B} and physical machine number array MID[]={M1, M1, M3}.
相应于这三种情况,步骤S407中,资源管理服务器确定能容纳上述VM1,VM2,VM3,并且让他们之间通信响应时间比当前更短的迁移目的物理机集合的过程具体如下:Corresponding to these three situations, in step S407, the resource management server determines the migration target physical machine set that can accommodate the aforementioned VM1, VM2, and VM3, and allows them to communicate with each other with a shorter response time than the current one. The process is as follows:
针对情况1.虚拟机群组中所有虚拟机已经运行于同一物理机M1,没有满足条件的目的物理机集合;For case 1. All virtual machines in the virtual machine group are already running on the same physical machine M1, and there is no target physical machine set that meets the conditions;
针对情况2.判断出虚拟机群组中三个虚拟机运行在不同物理机后,计算出这三个虚拟机所需要的系统资源总和为3。进一步的判断出这三个虚拟机运行在同一子网A,令自然数变量k的初始值为1,经过查找得知,在子网A中包含的物理机M1的可使用资源数为5(包含已经分配给VM1和VM2的资源),物理机M2的可使用资源数为6(包含已经分配给VM3的资源),判断出只包含一台物理机的物理机集合{M1}和{M2}的可使用资源均大于3,将集合{M1}和{M2}记录为候选目的物理机集合。For case 2. After judging that the three virtual machines in the virtual machine group are running on different physical machines, the sum of the system resources required by the three virtual machines is calculated to be 3. It is further judged that these three virtual machines are running in the same subnet A, and the initial value of the natural number variable k is 1. After searching, it is known that the number of available resources of the physical machine M1 contained in the subnet A is 5 (including Resources already allocated to VM1 and VM2), the number of available resources of physical machine M2 is 6 (including the resources allocated to VM3), and it is determined that the physical machine sets {M1} and {M2} contain only one physical machine The available resources are both greater than 3, and the sets {M1} and {M2} are recorded as candidate destination physical machine sets.
对于候选目的物理机集合{M1},虚拟机VM1运行于M1,属于集合{M1},虚拟机VM2运行于M1,属于集合{M1},VM3运行于M2,不属于集合{M1},所以不属于集合{M1}的次数累计值为1,即迁移次数为1,同样的方式,对于候选目的物理机集合{M2},计算出迁移次数为2。在候选目的物理机集合中,选择迁移次数最少的{M1}作为目的物理机集合。For the candidate target physical machine set {M1}, the virtual machine VM1 runs on M1 and belongs to the set {M1}, the virtual machine VM2 runs on M1 and belongs to the set {M1}, and VM3 runs on M2 and does not belong to the set {M1}, so no The cumulative value of the number of times belonging to the set {M1} is 1, that is, the number of migrations is 1. In the same way, for the set of candidate destination physical machines {M2}, the calculated number of migrations is 2. In the candidate target physical machine set, select {M1} with the least number of migrations as the target physical machine set.
针对情况3.判断出虚拟机群组中三个虚拟机运行在不同物理机后,计算出这三个虚拟机所需要的系统资源总和为3。进一步的判断出这三个虚拟机运行在不同的子网A和B,令自然数变量k的初始值为1,经过查找得知,子网A的可使用资源数为11(包含已经分配给VM1和VM2的资源),子网B的可使用资源数为6(包含已经分配给VM3的资源),判断出只包含1个子网数的子网集合{A}和{B}的可使用资源均大于3,将子网集合{A}和{B}记录为候选子网集合。For case 3. After it is determined that the three virtual machines in the virtual machine group are running on different physical machines, the sum of the system resources required by the three virtual machines is calculated to be 3. It is further judged that these three virtual machines are running in different subnets A and B, and the initial value of the natural number variable k is 1. After searching, it is found that the number of available resources in subnet A is 11 (including those already allocated to VM1 and the resources of VM2), the number of available resources of subnet B is 6 (including the resources already allocated to VM3), and it is judged that the available resources of the subnet sets {A} and {B} containing only 1 subnet number are both If it is greater than 3, record the subnet sets {A} and {B} as candidate subnet sets.
令自然数变量s的初始值为k(k=1,所以s的初始值为1),经过查找得知,在子网A中包含的物理机M1的可使用资源数为5(包含已经分配给VM1和VM2的资源),物理机M2的可使用资源数为6(包含已经分配给VM3的资源),在子网B中包含的物理机M3的可使用资源数为6(包含已经分配给VM3的资源),判断出候选子网集合{A}和{B}中只包含一台物理机的物理机集合{M1}和{M2}、{M3}的可使用资源均大于3,将集合{M1}和{M2}、{M3}记录为候选目的物理机集合。Let the initial value of the natural number variable s be k (k=1, so the initial value of s is 1), and after searching, it is found that the number of available resources of the physical machine M1 contained in the subnet A is 5 (including the resources already allocated to resources of VM1 and VM2), the number of available resources of physical machine M2 is 6 (including resources already allocated to VM3), and the number of available resources of physical machine M3 contained in subnet B is 6 (including resources already allocated to VM3 resources), it is determined that the available resources of the physical machine sets {M1}, {M2}, and {M3} containing only one physical machine in the candidate subnet sets {A} and {B} are greater than 3, and the set { M1}, {M2}, and {M3} are recorded as a set of candidate destination physical machines.
对于候选目的物理机集合{M1},虚拟机VM1运行于M1,属于集合{M1},虚拟机VM2运行于M1,属于集合{M1},VM3运行于M3,不属于集合{M1},所以不属于集合{M1}的次数累计值为1,即迁移次数为1,同样的方式,对于候选目的物理机集合{M2},计算出迁移次数为3,对于候选目的物理机集合{M3},计算出迁移次数为2。在候选目的物理机集合中,选择迁移次数最少的{M1}作为目的物理机集合。For the candidate destination physical machine set {M1}, the virtual machine VM1 runs on M1 and belongs to the set {M1}, the virtual machine VM2 runs on M1 and belongs to the set {M1}, and VM3 runs on M3 and does not belong to the set {M1}, so no The accumulative value of the number of times belonging to the set {M1} is 1, that is, the number of migrations is 1. In the same way, for the set of candidate physical machines {M2}, the calculated number of migrations is 3. For the set of candidate physical machines {M3}, calculate The number of outgoing migrations is 2. In the candidate target physical machine set, select {M1} with the least number of migrations as the target physical machine set.
S408,资源管理服务器判断虚拟机群组中虚拟机VM1、VM2、VM3所运行于的物理机是否属于S407计算出的目的物理机集合,对于其所运行于物理机不属于该目的物理机集合的虚拟机,采用虚拟机热迁移技术将它迁移到目的物理机集合,如果该迁移是跨子网迁移,向应用管理服务器发消息,通知该虚拟机信息迁移后的信息以及该虚拟机的唯一标识。S408, the resource management server judges whether the physical machines on which the virtual machines VM1, VM2, and VM3 run in the virtual machine group belong to the target physical machine set calculated in S407, and the physical machines on which they run do not belong to the target physical machine set Virtual machine, use virtual machine live migration technology to migrate it to the target physical machine set, if the migration is cross-subnet migration, send a message to the application management server to notify the information of the virtual machine information after migration and the unique identification of the virtual machine .
根据步骤S407中针对情况1的确定结果,没有满足条件的目的物理机集合,不需要迁移。According to the determination result for case 1 in step S407, there is no target physical machine set satisfying the condition, and migration is not needed.
根据步骤S407中针对情况2计算出的目的物理机集合,本步骤中将不属于该目的物理机集合的虚拟机,采用虚拟机热迁移技术将它迁移到目的物理机集合的具体过程如下:According to the target physical machine set calculated for case 2 in step S407, in this step, the virtual machine that does not belong to the target physical machine set is migrated to the target physical machine set using virtual machine live migration technology. The specific process is as follows:
目的物理机集合{M1}中包含物理机M1,M1属于子网A,记录子网集合{A}。将虚拟机群组中的三个虚拟机分类,其中VM1和VM2属于类型1,其运行于的物理机M1属于目的物理机集合,其中VM3属于类型2,其运行于的物理机M2不属于目的物理机集合,但M2所属的子网A属于子网集合{A}。对于属于类型2的VM3,在目的物理机集合{M1}中查找到M1具有空闲资源,且与VM3运行于的物理机M2属于相同的子网,资源管理服务器向VM3所在的物理机M2发送热迁移命令,将VM3迁移至M1,因为在相同子网迁移,VM3的IP地址不需要改变。The target physical machine set {M1} includes the physical machine M1, and M1 belongs to subnet A, and the subnet set {A} is recorded. Classify the three virtual machines in the virtual machine group, where VM1 and VM2 belong to type 1, the physical machine M1 they run on belongs to the target physical machine set, and VM3 belongs to type 2, and the physical machine M2 they run on does not belong to the target A collection of physical machines, but the subnet A to which M2 belongs belongs to the subnet collection {A}. For VM3 belonging to type 2, it is found in the target physical machine set {M1} that M1 has idle resources and belongs to the same subnet as the physical machine M2 on which VM3 runs, and the resource management server sends hot Migrate command to migrate VM3 to M1, because the IP address of VM3 does not need to be changed because it migrates on the same subnet.
根据步骤S407中针对情况3计算出的物理机集合,本步骤中将不属于该目的物理机集合的虚拟机,采用虚拟机热迁移技术将它迁移到目的物理机集合的具体过程如下:According to the physical machine set calculated for case 3 in step S407, in this step, the virtual machine that does not belong to the target physical machine set is migrated to the target physical machine set using virtual machine live migration technology. The specific process is as follows:
目的物理机集合{M1}中包含物理机M1,M1属于子网A,记录子网集合{A}。将虚拟机群组中的三个虚拟机分类,其中VM1和VM2属于类型1,其运行于的物理机M1属于目的物理机集合,其中VM3属于类型3,其运行于的物理机M3不属于目的物理机集合,M3所属的子网B也不属于子网集合{A}。在目的物理机集合{M1}中具有空闲资源的物理机是M1,选择M1作为VM3的迁移目的物理机。资源管理服务器向VM3所在的物理机M3发送热迁移命令,将VM3迁移至M1,迁移后的虚拟机VM3的IP地址为ip4。该迁移是跨子网迁移,向应用管理服务器发送虚拟机迁移后的信息,包含VM3的标示符ID3和新IP地址ip4。The target physical machine set {M1} includes the physical machine M1, and M1 belongs to subnet A, and the subnet set {A} is recorded. Classify the three virtual machines in the virtual machine group, where VM1 and VM2 belong to type 1, the physical machine M1 they run on belongs to the target physical machine set, and VM3 belongs to type 3, and the physical machine M3 they run on does not belong to the target In the collection of physical machines, the subnet B to which M3 belongs does not belong to the subnet collection {A} either. The physical machine with idle resources in the target physical machine set {M1} is M1, and M1 is selected as the migration target physical machine of VM3. The resource management server sends a live migration command to the physical machine M3 where VM3 is located to migrate VM3 to M1, and the IP address of the migrated virtual machine VM3 is ip4. The migration is a cross-subnet migration, and the migration information of the virtual machine is sent to the application management server, including the identifier ID3 of VM3 and the new IP address ip4.
S409,应用管理服务器更新该群组虚拟机信息;情况1、情况2不需要更新;情况3应用管理服务器更新其维护的群组A的群组虚拟机的信息,快速建立用户终端UE3与迁移后虚拟机VM3的连接,并基于VM3的新IP地址快速建立VM1与VM3、VM2与VM3之间的游戏应用通信连接。S409, the application management server updates the group virtual machine information; case 1 and case 2 do not need to be updated; case 3 the application management server updates the group virtual machine information of group A maintained by it, and quickly establishes the user terminal UE3 and the post-migration The virtual machine VM3 is connected, and the game application communication connection between VM1 and VM3, VM2 and VM3 is quickly established based on the new IP address of VM3.
本发明一个实施例提供了用于实现虚拟机迁移的资源管理服务器,如图5所示,该资源管理服务器500包含:An embodiment of the present invention provides a resource management server for implementing virtual machine migration. As shown in FIG. 5, the resource management server 500 includes:
接口单元501,用于接收应用管理服务器发送的虚拟机群组的信息,该虚拟机群组包含完成指定的协同群组应用的多台虚拟机,该虚拟机群组的信息包含该虚拟机群组中每台虚拟机的唯一标识。具体而言,虚拟机的唯一标识可以是虚拟机的当前IP地址或标识符ID;The interface unit 501 is configured to receive the information of the virtual machine group sent by the application management server, the virtual machine group includes multiple virtual machines that complete the application of the specified collaborative group, and the information of the virtual machine group includes the virtual machine group A unique identifier for each virtual machine in the group. Specifically, the unique identifier of the virtual machine may be the current IP address or identifier ID of the virtual machine;
查找单元502,用于根据所述接口单元501接收到的虚拟机群组的信息查找虚拟机群组中每台虚拟机的部署位置信息,该部署位置信息包含虚拟机群组中每台虚拟机所归属子网的唯一标识和所运行于的物理机的唯一标识;The search unit 502 is configured to search for the deployment location information of each virtual machine in the virtual machine group according to the information of the virtual machine group received by the interface unit 501, and the deployment location information includes the deployment location information of each virtual machine in the virtual machine group The unique identifier of the subnet to which it belongs and the unique identifier of the physical machine it runs on;
确定单元503,用于根据查找单元502查找到的虚拟机的部署位置信息,确定能够容纳该虚拟机群组、并且容纳后该虚拟机群组中各虚拟机之间通信响应时间比当前通信响应时间更短的一个目的物理机集合;The determining unit 503 is configured to determine, according to the deployment location information of the virtual machines found by the searching unit 502, that the virtual machine group can be accommodated, and that after the accommodation, the communication response time between virtual machines in the virtual machine group is shorter than the current communication response time. A set of destination physical machines with a shorter time;
判断单元504,用于判断该虚拟机群组中各台虚拟机所运行于的物理机是否属于该确定出的目的物理机集合;A judging unit 504, configured to judge whether the physical machine on which each virtual machine in the virtual machine group runs belongs to the determined target physical machine set;
迁移单元505,用于当该虚拟机所运行于的物理机不属于确定单元503确定出的目的物理机集合时,将该虚拟机迁移到该目的物理机集合;A migration unit 505, configured to migrate the virtual machine to the target physical machine set when the physical machine on which the virtual machine runs does not belong to the target physical machine set determined by the determining unit 503;
可选的,接口单元501,进一步的还用于在迁移单元505执行了虚拟机的跨子网迁移后,向应用管理服务器发送该虚拟机迁移后的IP地址。Optionally, the interface unit 501 is further configured to send the migrated IP address of the virtual machine to the application management server after the migration unit 505 performs cross-subnet migration of the virtual machine.
参考图6所示,该资源管理服务器500中,确定单元503进一步的可以包含:Referring to FIG. 6, in the resource management server 500, the determining unit 503 may further include:
第一确定模块5031,用于当该虚拟机群组中所有虚拟机在同一个子网的不同物理机时,确定出该子网中能够容纳该虚拟机群组、且包含物理机个数最少的物理机集合;The first determination module 5031 is configured to determine the subnet that can accommodate the virtual machine group and contains the least number of physical machines when all the virtual machines in the virtual machine group are on different physical machines in the same subnet collection of physical machines;
第一选择模块5032,用于在第一确定模块5031确定出的物理机集合中选择其中一个作为所述目的物理机集合;例如,用于在第一确定模块5031确定出的物理机集合有多个时,选择需要该虚拟机群组中虚拟机迁移次数最少的一个物理机集合为目的物理机集合。The first selection module 5032 is configured to select one of the physical machine sets determined by the first determining module 5031 as the target physical machine set; for example, for how many physical machine sets determined by the first determining module 5031 , select a physical machine set that requires the least number of virtual machine migrations in the virtual machine group as the target physical machine set.
参考图7所示,该资源管理服务器500中,确定单元503进一步的可以包含:Referring to FIG. 7, in the resource management server 500, the determining unit 503 may further include:
第二确定模块5033,用于当该虚拟机群组中所有虚拟机在同一个子网的不同物理机时,确定出该所有子网中能够容纳该虚拟机群组、并且包含子网数量最少的子网集合;The second determination module 5033 is used to determine the subnet that can accommodate the virtual machine group and contains the least number of subnets when all the virtual machines in the virtual machine group are on different physical machines in the same subnet collection of subnets;
第三确定模块5034,用于在第二确定模块5033确定出的子网集合中,确定出能够容纳该虚拟机群组、且包含物理机个数最少的物理机集合;The third determination module 5034 is configured to determine, among the subnet sets determined by the second determination module 5033, a physical machine set capable of accommodating the virtual machine group and containing the least number of physical machines;
第二选择模块5035,用于在第三确定模块5034确定出的物理机集合中选择其中一个作为所述目的物理机集合;例如,用于在第三确定模块5034确定出的物理机集合有多个时,选择需要该虚拟机群组中虚拟机迁移次数最少的一个物理机集合为目的物理机集合。本发明实施例中的资源管理服务器可以基于计算机系统来实现,图1-图4所示的方法均可在基于计算机系统的资源管理服务器来实现。图8示出了基于计算机系统来实现的资源管理服务器的实施例。本实施例中资源管理服务器可以包括:处理器801、存储器802和通信接口803,其中:The second selection module 5035 is configured to select one of the physical machine sets determined by the third determining module 5034 as the target physical machine set; for example, for how many physical machine sets determined by the third determining module 5034 , select a physical machine set that requires the least number of virtual machine migrations in the virtual machine group as the target physical machine set. The resource management server in the embodiment of the present invention can be implemented based on a computer system, and the methods shown in FIGS. 1-4 can all be implemented on a resource management server based on a computer system. Fig. 8 shows an embodiment of a resource management server implemented based on a computer system. In this embodiment, the resource management server may include: a processor 801, a memory 802, and a communication interface 803, wherein:
通信接口803,用于与应用管理服务器通信。资源管理服务器与应用管理服务器之间交互的消息(如方法实施例图1-4所示)均通过通信接口803发送和接收。具体地,通信接口803用于接收应用管理服务器发送的虚拟机群组的信息,以及在发生虚拟机的跨子网迁移时向应用管理服务器发送该虚拟机迁移后的IP地址;存储器802用于存储程序指令;处理器801用于在接收到应用管理服务器发送的虚拟机群组的信息之后,调用存储器802中存储的程序指令,执行如下操作:根据所述虚拟机群组的信息,查找所述虚拟机群组中每台虚拟机的部署位置信息,所述虚拟机的部署位置信息包含所述虚拟机所归属子网的唯一标识和所运行于的物理机的唯一标识;根据所述虚拟机的部署位置信息,确定能够容纳所述虚拟机群组、并且容纳后所述虚拟机群组中各虚拟机之间的通信响应时间比当前通信响应时间更短的一个目的物理机集合;判断所述虚拟机群组中各台虚拟机所运行于的物理机是否属于所述确定出的目的物理机集合,当所述虚拟机所运行于的物理机不属于所述目的物理机集合时,将该虚拟机迁移到所述目的物理机集合。The communication interface 803 is used for communicating with the application management server. The messages exchanged between the resource management server and the application management server (as shown in FIGS. 1-4 of the method embodiment) are all sent and received through the communication interface 803 . Specifically, the communication interface 803 is used to receive the information of the virtual machine group sent by the application management server, and send the migrated IP address of the virtual machine to the application management server when the cross-subnet migration of the virtual machine occurs; the memory 802 is used to storing program instructions; the processor 801 is configured to call the program instructions stored in the memory 802 after receiving the information of the virtual machine group sent by the application management server, and perform the following operations: according to the information of the virtual machine group, find the The deployment location information of each virtual machine in the virtual machine group, the deployment location information of the virtual machine includes the unique identifier of the subnet to which the virtual machine belongs and the unique identifier of the physical machine it runs on; according to the virtual machine Deployment location information of the machine, determine a target physical machine set that can accommodate the virtual machine group, and the communication response time between the virtual machines in the virtual machine group after accommodation is shorter than the current communication response time; determine Whether the physical machine on which each virtual machine in the virtual machine group runs belongs to the determined target physical machine set; when the physical machine on which the virtual machine runs does not belong to the target physical machine set, The virtual machine is migrated to the target physical machine set.
其中,处理器801可以是中央处理器(central processing unit,CPU)、专用集成电路(application-specific integrated circuit,ASIC)等。其中,本实施例中的资源管理服务器可以包括总线804。处理器801、存储器802以及通信接口803之间可通过总线804连接并通信。其中,存储器802可以包括:随机存取存储器(random access memory,RAM),只读存储器(read-onlymemory,ROM),磁盘等具有存储功能的实体;Wherein, the processor 801 may be a central processing unit (central processing unit, CPU), an application-specific integrated circuit (application-specific integrated circuit, ASIC) or the like. Wherein, the resource management server in this embodiment may include a bus 804 . The processor 801 , the memory 802 and the communication interface 803 can be connected and communicate with each other through the bus 804 . Wherein, the memory 802 may include: entities with storage functions such as random access memory (random access memory, RAM), read-only memory (read-only memory, ROM), and disk;
处理器801还可以用于执行方法实施例中图1到图4描述的各步骤,本发明实施例在此不再详述。The processor 801 may also be configured to execute the steps described in FIG. 1 to FIG. 4 in the method embodiment, which will not be described in detail in this embodiment of the present invention.
以上对本发明所提供的一种进行了详细介绍,本文中应用了具体个例对本发明的原理及实施方式进行了阐述,以上实施例的说明只是用于帮助理解本发明的方法及其核心思想;同时,对于本领域的一般技术人员,依据本发明的思想,在具体实施方式及应用范围上均会有改变之处,综上所述,本说明书内容不应理解为对本发明的限制。The above provides a detailed introduction to the one provided by the present invention. In this paper, specific examples are used to illustrate the principle and implementation of the present invention. The description of the above embodiments is only used to help understand the method and core idea of the present invention; At the same time, for those of ordinary skill in the art, according to the idea of the present invention, there will be changes in the specific implementation and application scope. In summary, the content of this specification should not be construed as limiting the present invention.
Claims (12)
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| PCT/CN2012/083057 WO2014059612A1 (en) | 2012-10-17 | 2012-10-17 | Method and device for realizing virtual machine migration |
Publications (2)
| Publication Number | Publication Date |
|---|---|
| CN103891243A CN103891243A (en) | 2014-06-25 |
| CN103891243B true CN103891243B (en) | 2017-04-12 |
Family
ID=50487434
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| CN201280001470.9A Active CN103891243B (en) | 2012-10-17 | 2012-10-17 | Method and device for realizing virtual machine migration |
Country Status (2)
| Country | Link |
|---|---|
| CN (1) | CN103891243B (en) |
| WO (1) | WO2014059612A1 (en) |
Families Citing this family (1)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN109445908B (en) * | 2018-10-30 | 2021-04-27 | 杭州炎魂网络科技有限公司 | Virtual machine backup method and system |
Citations (4)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN101631110A (en) * | 2008-07-15 | 2010-01-20 | 国际商业机器公司 | Device and method for dynamically determining connection building mechanism based on relative position |
| US20100257269A1 (en) * | 2009-04-01 | 2010-10-07 | Vmware, Inc. | Method and System for Migrating Processes Between Virtual Machines |
| CN102446115A (en) * | 2012-01-09 | 2012-05-09 | 浙江大学 | Dynamic deployment method of virtual machine |
| CN102694672A (en) * | 2011-03-24 | 2012-09-26 | 华为技术有限公司 | Method for parameter migration of virtual machine, equipment and virtual machine server |
Family Cites Families (3)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US8359374B2 (en) * | 2009-09-09 | 2013-01-22 | Vmware, Inc. | Fast determination of compatibility of virtual machines and hosts |
| CN102591443A (en) * | 2011-12-29 | 2012-07-18 | 华为技术有限公司 | Method, device and system for integrating virtual clusters |
| CN102724277B (en) * | 2012-05-04 | 2016-01-06 | 华为技术有限公司 | The method of live migration of virtual machine and deployment, server and group system |
-
2012
- 2012-10-17 CN CN201280001470.9A patent/CN103891243B/en active Active
- 2012-10-17 WO PCT/CN2012/083057 patent/WO2014059612A1/en active Application Filing
Patent Citations (4)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN101631110A (en) * | 2008-07-15 | 2010-01-20 | 国际商业机器公司 | Device and method for dynamically determining connection building mechanism based on relative position |
| US20100257269A1 (en) * | 2009-04-01 | 2010-10-07 | Vmware, Inc. | Method and System for Migrating Processes Between Virtual Machines |
| CN102694672A (en) * | 2011-03-24 | 2012-09-26 | 华为技术有限公司 | Method for parameter migration of virtual machine, equipment and virtual machine server |
| CN102446115A (en) * | 2012-01-09 | 2012-05-09 | 浙江大学 | Dynamic deployment method of virtual machine |
Also Published As
| Publication number | Publication date |
|---|---|
| CN103891243A (en) | 2014-06-25 |
| WO2014059612A1 (en) | 2014-04-24 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| US11704144B2 (en) | Creating virtual machine groups based on request | |
| CN113181658B (en) | Edge computing node scheduling method, device, equipment and medium | |
| US11463511B2 (en) | Model-based load balancing for network data plane | |
| CN108924268B (en) | A container cloud service system and pod creation method and device | |
| CN111617487B (en) | Account access method and device in game application, storage medium and electronic equipment | |
| KR20110021931A (en) | How to determine the routing path | |
| CN114911602B (en) | A server cluster load balancing method, device, equipment and storage medium | |
| CN109522090B (en) | Resource scheduling method and device | |
| CN108132827B (en) | Network slice resource mapping method, related equipment and system | |
| CN109995552B (en) | VNF service instantiation method and device | |
| US20190079791A1 (en) | Data Storage Method and Apparatus | |
| CN112468589B (en) | Data distribution method, device, computer equipment and storage medium | |
| CN109302302B (en) | Method, system and computer readable storage medium for scaling service network element | |
| CN103891243B (en) | Method and device for realizing virtual machine migration | |
| CN115733743A (en) | Network service deployment method, NFVO and NFV system | |
| CN108347465B (en) | Method and device for selecting network data center | |
| US11465045B1 (en) | Maintaining session state using redundant servers | |
| CN103002038A (en) | Processing method and device for elastic load balancing | |
| CN116510312A (en) | Cloud game multi-opening implementation method, device, equipment and storage medium | |
| WO2018014351A1 (en) | Method and apparatus for resource configuration | |
| JP6388717B2 (en) | Terminal management method and network device | |
| Castaneda et al. | Easing the Deployment and Management of Cloud Federated Networks Across Virtualised Clusters. | |
| CN114125038B (en) | A service scheduling method, device and storage medium | |
| HK40041371A (en) | Data distribution method, device, computer equipment and storage medium | |
| CN119011386A (en) | Communication method, device, equipment, system and readable 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 | ||
| GR01 | Patent grant | ||
| GR01 | Patent grant |