A virtual machine migration method, device, equipment and computer readable storage medium
By receiving and updating the flow table entries in the virtual machine migration request, the problem of the controller not being able to detect the migration in a timely manner and the complex message interaction is solved, thus enabling the virtual machine to work normally and migrate efficiently in the target server.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- CHINA MOBILE (SUZHOU) SOFTWARE TECH CO LTD
- Filing Date
- 2021-07-27
- Publication Date
- 2026-06-09
AI Technical Summary
When SDN is combined with cloud computing, virtual machine migration requires shutdown or restart, the controller cannot detect the migration in time, message interaction is complex and user data flow tables need to be rebuilt.
By receiving migration requests, obtaining initial flow table entries, updating flow table entries based on the target server identifier and the new virtual machine identifier, generating flow table update messages, and sending them to the target server to update the flow table, the tenant identifier remains unchanged, and message interaction is simplified.
It enables timely detection of migration events during virtual machine migration, simplifies message interaction, maintains the mapping relationship between tenants and virtual machines, and improves migration efficiency.
Smart Images

Figure CN115686730B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of Internet technology, and includes, but is not limited to, a virtual machine migration method, apparatus, device, and computer-readable storage medium. Background Technology
[0002] Software-defined networking (SDN) possesses characteristics such as centralized control, open interfaces, and network virtualization. Centralized control facilitates unified management of data centers by administrators. Cloud computing's virtualization, elasticity, and on-demand provisioning characteristics are very similar to these features of SDN. Both aim to provide manageable and efficient resources. Their combination will inevitably drive the development of cloud computing, enabling network, computing, and storage resources to be delivered to users as a unified service. Therefore, the integration of SDN and cloud computing has become a popular area of exploration.
[0003] In related technologies, when SDN and cloud computing are combined, when virtual machines in the network migrate, they either need to be shut down or restarted, or a short-term shutdown may occur. During migration, there are often problems such as the controller not being able to detect the migration in time, complex message interaction, and the need to rebuild user data flow tables. Summary of the Invention
[0004] In view of this, embodiments of this application provide a virtual machine migration method, apparatus, device, and computer-readable storage medium.
[0005] The technical solution of this application embodiment is implemented as follows:
[0006] This application provides a virtual machine migration method, including:
[0007] Receive a migration request sent by the target server, wherein the migration request includes the target server identifier, the original identifier and the new identifier of the virtual machine to be migrated, and the tenant identifier corresponding to the virtual machine to be migrated;
[0008] Based on the tenant identifier and the original identifier of the virtual machine to be migrated, obtain the target flow table entry in the initial flow table;
[0009] Based on the target server identifier and the new identifier of the virtual machine to be migrated, the target flow table entry is updated to obtain the updated target flow table entry. The updated target flow table entry and the tenant identifier in the target flow table entry remain unchanged.
[0010] A first flow table update message is generated based on the updated target flow table entry, and the first flow table update message is sent to the target server, so that the target server updates its own flow table based on the first flow table update message.
[0011] This application embodiment provides a virtual machine migration apparatus, the apparatus comprising:
[0012] The receiving module is used to receive a migration request sent by the target server, wherein the migration request includes the target server identifier, the original identifier and the new identifier of the virtual machine to be migrated, and the tenant identifier corresponding to the virtual machine to be migrated;
[0013] The acquisition module is used to acquire the target flow table entry in the initial flow table based on the tenant identifier and the original identifier of the virtual machine to be migrated;
[0014] The update module is used to update the target flow table entry based on the target server identifier and the new identifier of the virtual machine to be migrated, so as to obtain the updated target flow table entry. The updated target flow table entry and the tenant identifier in the target flow table entry remain unchanged.
[0015] The generation module is used to generate a first flow table update message based on the updated target flow table entry, and send the first flow table update message to the target server, so that the target server updates its own flow table based on the first flow table update message.
[0016] This application embodiment provides a virtual machine migration device, the virtual machine migration device comprising:
[0017] Processor; and
[0018] Memory for storing computer programs that can run on the processor;
[0019] The computer program, when executed by the processor, implements the virtual machine migration method described above.
[0020] This application provides a computer-readable storage medium storing computer-executable instructions configured to execute the virtual machine migration method described above.
[0021] This application provides a virtual machine migration method, apparatus, device, and computer-readable storage medium. First, a migration request is received from a target server. The migration request includes a target server identifier, the original identifier of the virtual machine to be migrated, a new identifier of the virtual machine to be migrated, and a tenant identifier corresponding to the virtual machine to be migrated. Next, a target flow table entry is obtained from the initial flow table using the tenant identifier and the original identifier of the virtual machine to be migrated. Then, the target flow table entry is updated based on the target server identifier and the new identifier of the virtual machine to be migrated, resulting in an updated target flow table entry. The tenant identifier in the updated target flow table entry is consistent with the tenant identifier in the original target flow table entry; that is, the updated target flow table entry and the tenant identifier in the original target flow table entry remain unchanged. Finally, a first flow table update message is generated based on the updated target flow table entry and sent to the target server. This allows the target server to update its own flow table based on the first flow table update message, thereby completing the creation of a new flow table entry for the migrated virtual machine and enabling the migrated virtual machine to function normally on the target server. The virtual machine migration device can detect migration events in a timely manner through migration requests. In addition, since the target server and the virtual machine migration device only exchange messages once during the migration process, the message interaction is greatly simplified. Furthermore, the tenant identifier is not changed during the migration process, thus maintaining the mapping relationship between the tenant and the virtual machine. Therefore, there is no need to rebuild the mapping relationship between the tenant and the virtual machine, thereby improving the efficiency of virtual machine migration. Attached Figure Description
[0022] In the accompanying drawings (which are not necessarily drawn to scale), similar reference numerals may describe similar parts in different views. The drawings illustrate, by way of example and not limitation, the various embodiments discussed herein.
[0023] Figure 1 This is a schematic diagram illustrating an implementation process of the virtual machine migration method provided in an embodiment of this application;
[0024] Figure 2 A schematic diagram illustrating another implementation flow of the virtual machine migration method provided in this application embodiment;
[0025] Figure 3 This is a schematic diagram illustrating an implementation process of a method for obtaining target flow table entries provided in an embodiment of this application;
[0026] Figure 4 This is a schematic diagram illustrating an implementation process of the method for updating target flow table entries provided in an embodiment of this application;
[0027] Figure 5 A schematic diagram illustrating another implementation of the virtual machine migration method provided in this application embodiment;
[0028] Figure 6This is a schematic diagram illustrating an implementation process of a virtual machine migration method in a cloud network provided in an embodiment of this application;
[0029] Figure 7 A schematic diagram of a cloud computing network system architecture provided in an embodiment of this application;
[0030] Figure 8 This is a schematic diagram illustrating another implementation flow of the virtual machine migration method provided in the embodiments of this application;
[0031] Figure 9 This is a schematic diagram of the composition structure of the virtual machine migration device provided in the embodiments of this application;
[0032] Figure 10 This is a schematic diagram of the composition structure of a virtual machine migration device provided in an embodiment of this application. Detailed Implementation
[0033] To make the objectives, technical solutions, and advantages of this application clearer, the application will be further described in detail below with reference to the accompanying drawings. The described embodiments should not be regarded as limitations on this application. All other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0034] In the following description, references are made to “some embodiments,” which describe a subset of all possible embodiments. However, it is understood that “some embodiments” may be the same subset or different subsets of all possible embodiments and may be combined with each other without conflict.
[0035] In the following description, the terms "first, second, third" are used merely to distinguish similar objects and do not represent a specific ordering of objects. It is understood that "first, second, third" may be interchanged in a specific order or sequence where permitted, so that the embodiments of this application described herein can be implemented in an order other than that illustrated or described herein.
[0036] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs. The terminology used herein is for the purpose of describing embodiments of this application only and is not intended to limit this application.
[0037] Before providing a further detailed description of the embodiments of this application, the nouns and terms involved in the embodiments of this application will be explained, and the nouns and terms involved in the embodiments of this application shall be interpreted as follows.
[0038] 1) SDN is a new type of innovative network architecture that can define and control the network through software programming. Its features of separating the control plane and forwarding plane and open programmability are considered a revolution in the network field. It provides a new experimental approach for the research of new Internet architecture and has greatly promoted the development of the next generation Internet.
[0039] The traditional network world is horizontally standardized and open, allowing each network element to seamlessly interconnect with surrounding network elements. In the world of computers, not only is the horizontal direction standardized and open, but the vertical direction is also standardized and open. From bottom to top, there are hardware, drivers, operating systems, programming platforms, application software, and so on, allowing programmers to easily create various applications. From a certain perspective, compared to computers, networks are "relatively closed" and "unframeworked" in the vertical direction, making application creation and service deployment relatively difficult. However, SDN makes the entire network (not just network elements) open, standardized, and programmable in the vertical direction, making it easier and more efficient for people to use network resources. Therefore, SDN technology can effectively reduce device load, assist network operators in better controlling infrastructure, and reduce overall operating costs, making it one of the most promising network technologies.
[0040] 2) Clustering: A cluster communication system is a mobile communication system used for group dispatch and command communication, mainly applied in the field of professional mobile communication. This system has available channels that can be shared by all users of the system, and it has an automatic channel selection function. It is a multi-purpose, high-performance wireless dispatch communication system that shares resources, costs, and channel equipment and services.
[0041] 3) A virtual machine (VM) is a complete computer system simulated by software, possessing full hardware system functionality and running in a completely isolated environment. Any task that can be performed on a physical computer can also be performed in a VM. When creating a VM, a portion of the physical machine's hard drive and memory capacity is used as the VM's hard drive and memory capacity. Each VM has its own independent Complementary Metal Oxide Semiconductor (CMOS), hard drive, and operating system, allowing it to be operated just like a physical machine.
[0042] To address the problems existing in related technologies, this application provides a virtual machine migration method. This method can be implemented by a computer program, which, when executed, completes each step of the virtual machine migration method provided in this application. In some embodiments, the computer program can be executed on the processor of a virtual machine migration device. Figure 1 This is a schematic diagram illustrating an implementation flow of the virtual machine migration method provided in an embodiment of this application, such as...Figure 1 As shown, the method includes:
[0043] Step S101: Receive the migration request sent by the target server.
[0044] Here, the target server can be the server where the virtual machine to be migrated will reside after migration. In actual implementation, the migration request can be sensed by the target switch corresponding to the target server, and the migration request can be sent. The migration request includes the target server identifier, the original identifier and the new identifier of the virtual machine to be migrated, and the tenant identifier corresponding to the virtual machine to be migrated. The target server identifier can be the target server's Internet Protocol Address (IP), Media Access Control Address (MAC), or a custom identifier associated with an IP address or MAC address. This migration request is used to promptly notify the virtual machine migration device of the migration event of the virtual machine to be migrated, where the virtual machine migration device can be the controller in SDN.
[0045] In this embodiment, the virtual machine migration device can establish a communication connection with the target server via a port and receive migration requests based on the established port. To facilitate subsequent reading of the required identifiers, the identifiers in the migration request are arranged in a certain order. For example, these identifiers can be ordered in the following order: target server identifier, original identifier of the virtual machine to be migrated, new identifier of the virtual machine to be migrated, and tenant identifier corresponding to the virtual machine to be migrated.
[0046] Step S102: Based on the tenant identifier and the original identifier of the virtual machine to be migrated, obtain the target flow table entry in the initial flow table.
[0047] Here, the virtual machine migration device stores the initial flow table corresponding to each server in the cluster. The initial flow table includes multiple flow table entries corresponding to each server before migration. Each flow table entry stores the mapping relationship between the virtual machine, its corresponding tenant, and the server. Since each server corresponds to multiple virtual machines, each initial flow table includes multiple flow table entries. The mapping relationship between virtual machines and tenants in the initial flow table is one-to-one; that is, one virtual machine corresponds to one tenant, where the tenant can be an individual, company, organization, etc.
[0048] In this embodiment, the migration request also includes a source server identifier, where the source server is the server where the virtual machine to be migrated was located before migration. Therefore, based on this source server identifier, the initial flow table corresponding to the source server can be determined from multiple initial flow tables. Further, based on the tenant identifier and the original identifier of the virtual machine to be migrated, a target flow table entry is determined from the initial flow table corresponding to the source server. This target flow table entry stores the mapping relationship between the source server, the tenant, and the virtual machine to be migrated.
[0049] Step S103: Based on the target server identifier and the new identifier of the virtual machine to be migrated, update the target flow table entry to obtain the updated target flow table entry.
[0050] Here, the updated target flow table entry and the tenant identifier in the target flow table entry remain unchanged.
[0051] In step S103, the source server identifier in the target flow table entry can be replaced with the target server identifier, and the original identifier of the virtual machine to be migrated in the target flow table can be replaced with the new identifier of the virtual machine to be migrated. Furthermore, the tenant identifier in the target flow table entry remains unchanged, thus obtaining an updated target flow table entry, which represents the mapping relationship between the target server, the virtual machine to be migrated, and the tenant after the virtual machine to be migrated is migrated. In this updated target flow table entry, the mapping relationship between the target server, the virtual machine to be migrated, and the tenant is established through the target server identifier, the new identifier of the virtual machine to be migrated, and the tenant identifier.
[0052] Step S104: Generate a first flow table update message based on the updated target flow table entry, and send the first flow table update message to the target server.
[0053] Here, the target server can update its own flow table based on the first flow table update message. That is, by receiving the first flow table update message, the target server will add the updated target flow table entry to its own flow table, thereby updating its own flow table.
[0054] In this embodiment, on one hand, a first flow table update message carrying the updated target flow table entry can be generated based on the updated target flow table entry. In implementation, the first flow table update message can be an add notification message, that is, the first flow table update message is a message that adds the updated target flow table entry.
[0055] On the other hand, a second target flow table can be determined from multiple initial flow tables based on the target server identifier; the updated flow table entry is added to the second target flow table to obtain the updated second target flow table; and a first flow table update message carrying the updated second target flow table is generated. That is, firstly, a flow table including the target server identifier is determined from multiple initial flow tables based on the target server identifier, and the flow table including the target server identifier is determined as the second target flow table; then, the updated target flow table entry is added to the second target flow table to obtain the updated second target flow table; finally, the updated second target flow table is placed into the first flow table update message.
[0056] This application provides a virtual machine migration method, apparatus, device, and computer-readable storage medium. First, a migration request is received from a target server. The migration request includes a target server identifier, the original identifier of the virtual machine to be migrated, a new identifier of the virtual machine to be migrated, and a tenant identifier corresponding to the virtual machine to be migrated. Next, a target flow table entry is obtained from the initial flow table using the tenant identifier and the original identifier of the virtual machine to be migrated. Then, the target flow table entry is updated based on the target server identifier and the new identifier of the virtual machine to be migrated, resulting in an updated target flow table entry. The tenant identifier in the updated target flow table entry is consistent with the tenant identifier in the original target flow table entry; that is, the updated target flow table entry and the tenant identifier in the original target flow table entry remain unchanged. Finally, a first flow table update message is generated based on the updated target flow table entry and sent to the target server. This allows the target server to update its own flow table based on the first flow table update message, thereby completing the creation of a new flow table entry for the migrated virtual machine and enabling the migrated virtual machine to function normally on the target server. The virtual machine migration device can detect migration events in a timely manner through migration requests. In addition, since the target server and the virtual machine migration device only exchange messages once during the migration process, the message interaction is greatly simplified. Furthermore, the tenant identifier is not changed during the migration process, thus maintaining the mapping relationship between the tenant and the virtual machine. Therefore, there is no need to rebuild the mapping relationship between the tenant and the virtual machine, thereby improving the efficiency of virtual machine migration.
[0057] In some embodiments, before step S101, such as Figure 2 As shown, the following steps S201 to S203 can also be performed:
[0058] Step S201: Obtain the attribute information of the server, the attribute information of the virtual machine, and the attribute information of the tenant.
[0059] Here, the cluster includes multiple servers, including the source server. Each server contains multiple virtual machines, and each virtual machine corresponds to a tenant. Attribute information includes vendor, name, IP address, MAC address, memory, etc.
[0060] Step S202: Based on the attribute information of the server, the attribute information of the virtual machine, and the attribute information of the tenant, determine the identifier of each server, the identifier of each virtual machine, and the identifier of each tenant.
[0061] Here, the IP address from each server's attribute information can be directly used as the server identifier, or the MAC address from each server's attribute information can be directly used as the server identifier, or the IP address and MAC address from each server's attribute information can be combined to determine the server identifier. In addition, custom information can be added to the IP address or MAC address of each server to determine the server identifier.
[0062] The methods for determining the identifiers of each virtual machine and each tenant can refer to the methods for determining the identifiers of each server mentioned above.
[0063] Step S203: Based on the server identifier, virtual machine identifier and tenant identifier, establish the initial flow table corresponding to each server.
[0064] Here, the initial flow table includes the mapping relationship between servers, virtual machines, and tenants. When establishing the initial flow table, a mapping table of tenants, virtual machines, and servers is created using the tenant identifier, the virtual machine identifier corresponding to the tenant, and the server identifier where the virtual machine resides. This mapping table serves as a flow table entry. Each tenant or virtual machine corresponds to one flow table entry. Since each server includes multiple virtual machines, each server includes multiple flow table entries. The multiple flow table entries included in a server constitute the initial flow table corresponding to that server. Obviously, one initial flow table corresponds to one server. Therefore, multiple servers in the cluster correspond to multiple initial flow tables.
[0065] Through steps S201 to S203 above, the attribute information of servers, virtual machines, and tenants in the cluster is first obtained. Then, based on the attribute information of servers, virtual machines, and tenants, the identifiers of each server, virtual machine, and tenant are determined. Finally, flow table entries that include the mapping relationship between servers, virtual machines, and tenants are established through the identifiers, and then the initial flow table corresponding to each server is established. Thus, the mapping relationship between servers, virtual machines, and tenants is maintained in the form of flow tables. When a virtual machine is migrated, only the mapping relationship needs to be changed, thereby simplifying the migration operation during virtual machine migration.
[0066] In some embodiments, the migration request also includes a source server identifier, such as... Figure 3 As shown, step S102 can be achieved through the following steps S1021 and S1022:
[0067] Step S1021: Based on the source server identifier, determine the first target flow table from multiple initial flow tables.
[0068] Here, the source server identifier is first obtained from the migration request, and then the flow table containing the source server identifier is determined from multiple initial flow tables, and the flow table containing the source server identifier is determined as the first target flow table.
[0069] Step S1022: Based on the tenant identifier and the original identifier of the virtual machine to be migrated, determine the target flow table entry from the first target flow table.
[0070] Here, the tenant identifier and the original identifier of the virtual machine to be migrated are first obtained from the migration request. Then, the flow table entry containing the tenant identifier and the original identifier of the virtual machine to be migrated is determined from the first target flow table, and this flow table entry is determined as the target flow table entry.
[0071] Through steps S1021 and S1022 above, the first target flow table is first determined from multiple initial flow tables using the source server identifier; then, the target flow table entry is determined from the first target flow table using the tenant identifier and the original identifier of the virtual machine to be migrated. This allows for the rapid determination of the target flow table entry from the flow tables.
[0072] In some embodiments, such as Figure 4 As shown, step S103 can be achieved through the following steps S1031 to S1033:
[0073] Step S1031: Replace the source server identifier in the target flow table entry with the target server identifier.
[0074] Here, the source server identifier in the target flow table entry can be replaced with the target server identifier using instructions. For example, a rewrite instruction can be used to change the source server identifier in the target flow table entry to the target server identifier. Alternatively, a replacement instruction can be used to first delete the source server identifier and then write the target server identifier in the position where the source server identifier was.
[0075] Step S1032: Replace the original identifier of the virtual machine to be migrated in the target flow table entry with the new identifier of the virtual machine to be migrated.
[0076] The implementation steps of step S1032 are similar to those of step S1031. Therefore, the implementation steps of step S1032 can refer to the implementation steps of step S1031 described above.
[0077] Step S1033: Keep the tenant identifier in the target flow table entry unchanged to obtain the updated target flow table entry.
[0078] Here, the target flow table entry includes the source server identifier, the original identifier of the virtual machine to be migrated, and the tenant identifier. Through the above steps S1031 and S1032, the source server identifier and the original identifier of the virtual machine to be migrated in the target flow table have been replaced. When executing step S1033, the tenant identifier remains unchanged. Even if the identifier of the virtual machine to be migrated changes from the original identifier to the new identifier, only the identifier changes, while its memory, cache, and storage content remain unchanged. This is equivalent to maintaining the mapping relationship between the virtual machine to be migrated and the tenant.
[0079] Through the above steps S1031 to S1033, the source server identifier in the target flow table entry is replaced with the target server identifier, and the original identifier of the virtual machine to be migrated in the target flow table entry is replaced with the new identifier of the virtual machine to be migrated, while keeping the tenant identifier unchanged. Thus, the updated target flow table entry corresponding to the virtual machine to be migrated after migration is obtained. The process of obtaining the updated target flow table entry is simple and convenient, and maintains the mapping relationship between the virtual machine and the tenant.
[0080] In some embodiments, after performing step S104, as Figure 5 As shown, the following steps S501 and S504 can also be performed:
[0081] Step S501: Generate a second flow table update message based on the target flow table entry.
[0082] In this embodiment, on one hand, a second flow table update message carrying the target flow table entry can be generated based on the target flow table entry. In implementation, this second flow table update message can be a deletion notification message, that is, a message that deletes the target flow table entry.
[0083] Alternatively, the target flow table entry in the first target flow table can be deleted to obtain an updated first target flow table; a second flow table update message carrying the updated first target flow table can then be generated. That is, the target flow table entry in the first target flow table is deleted to obtain an updated first target flow table that does not contain the target flow table entry; finally, the updated first target flow table is placed into the second flow table update message.
[0084] Step S502: Based on the source server identifier, send the second flow table update message to the source server.
[0085] Here, when a virtual machine to be migrated is being migrated, in order to notify the source server to update its own flow table in a timely and synchronous manner, the virtual machine migration device will send a second flow table update message to the source server so that the source server can delete the target flow table entry in a timely manner.
[0086] Step S503: Store the updated first target flow table and the updated second target flow table.
[0087] Here, in order to keep its own flow table consistent with the actual situation after the virtual machine is migrated, the virtual machine migration device will store the updated first target flow table and the updated second target flow table after the virtual machine to be migrated is migrated.
[0088] Step S504: Delete the first target flow table and the second target flow table.
[0089] Here, since the virtual machine to be migrated has already been migrated, that is, the virtual machine to be migrated is no longer in the source server, the virtual machine migration device will also delete the first target flow table and the second target flow table before the migration.
[0090] Through steps S501 to S504 above, a second flow table update message carrying the target flow table entry can be generated; alternatively, the updated first target flow table can be obtained by deleting the target flow table entry in the first target flow table, thereby generating a second flow table update message carrying the updated first target flow table. Next, the updated first and second target flow tables are stored, and the first and second target flow tables before the migration of the virtual machine to be migrated are deleted. Thus, the second flow table update message informs the source server to update its own flow table, simplifying the message interaction process. Simultaneously, the updated flow table is stored promptly, and the corresponding flow table before migration is deleted, thereby quickly completing the migration of the virtual machine to be migrated.
[0091] Based on the above embodiments, this application provides a virtual machine migration method applied to a cloud network system. The cloud network system includes a controller, servers, switches corresponding to the servers, virtual machines, and tenants corresponding to the virtual machines. The server where the virtual machine to be migrated resides before migration is the source server, the switch corresponding to the source server is the source switch, and the server where the virtual machine resides after migration is the target server, and the switch corresponding to the target server is the target switch. Based on the virtual machine migration method provided in this application, as follows... Figure 6 As shown, steps S601 to S612 can be performed:
[0092] Step S601: Based on the attribute information of the server, virtual machine, and the corresponding tenant of the virtual machine, the controller determines the identifier of the server, virtual machine, and the corresponding tenant of the virtual machine in the cloud network system.
[0093] In step S602, the controller establishes an initial flow table for each server based on the server, virtual machine, and the tenant identifier corresponding to the virtual machine.
[0094] Here, the initial flow table stores the mapping relationship between the server, the virtual machine, and the corresponding tenant of the virtual machine before the migration of the virtual machine to be migrated.
[0095] In step S603, when the target switch senses that the virtual machine to be migrated has migrated, it obtains migration-related information.
[0096] Here, when a virtual machine to be migrated is moved to the target server, the target server can detect the migration; simultaneously, the target switch corresponding to the target server also detects the migration. Next, the target server obtains migration-related information, which may include the target server identifier, source server identifier, the original identifier of the virtual machine to be migrated, the new identifier of the virtual machine to be migrated, and the tenant identifier corresponding to the virtual machine.
[0097] In step S604, the target switch sends a migration request to the controller.
[0098] Here, the migration request includes the target server identifier, the source server identifier, the original identifier of the virtual machine to be migrated, the new identifier of the virtual machine to be migrated, and the tenant identifier corresponding to the virtual machine.
[0099] In step S605, the controller determines the first target flow table corresponding to the source server from the initial flow table based on the source server identifier in the received migration request.
[0100] In step S606, the controller determines the target flow table entry from the first target flow table based on the tenant identifier corresponding to the virtual machine in the migration request and the original identifier of the virtual machine to be migrated.
[0101] In step S607, the controller replaces the source server identifier in the target flow table entry with the target server identifier, replaces the original identifier of the virtual machine to be migrated with the new identifier of the virtual machine to be migrated, keeps the tenant identifier corresponding to the virtual machine to be migrated, and generates the updated target flow table entry.
[0102] In step S608, the controller generates a first flow table update message carrying the updated target flow table entry, and generates a second flow table update message carrying the target flow table entry.
[0103] In step S609, the controller sends the first flow table update message to the target switch.
[0104] In step S610, the controller sends the second flow table update message to the source switch.
[0105] Step S611: The target switch updates its own flow table based on the received first flow table update message.
[0106] Here, the target switch adds the updated target flow table entry to its own flow table based on the first flow table update message, thereby updating its own flow table.
[0107] In step S612, the source switch updates its own flow table based on the received second flow table update message.
[0108] Here, the source switch deletes the target flow table entry based on the second flow table update message in order to update its own flow table.
[0109] Through steps S601 to S612 above, the controller pre-determines the identifiers of servers, virtual machines, and the corresponding tenants of virtual machines. Then, based on the identifiers, it establishes a flow table including the mapping relationship between servers, virtual machines, and the corresponding tenants of virtual machines. When a virtual machine to be migrated is migrated, the target flow table is first determined based on the received migration request. Then, the target flow table entry is determined. Then, the source server identifier in the target flow table entry is replaced with the target server identifier, the original identifier of the virtual machine to be migrated is replaced with the new identifier of the virtual machine to be migrated, and the tenant identifier of the virtual machine to be migrated is kept. An updated target flow table entry is generated. Next, on the one hand, a first flow table update message is generated based on the updated target flow table entry and sent to the target switch so that the target switch updates its own flow table. On the other hand, a second flow table update message is generated based on the target flow table entry and sent to the source switch so that the source switch updates its own flow table. This enables the flow table update in the cloud network system to be completed quickly and conveniently, ensuring that the updated flow table is consistent with the actual mapping relationship after the migration of the virtual machine to be migrated, thus improving communication efficiency.
[0110] Based on the above embodiments, this application further provides a virtual machine migration method. This application aims to solve the problems that when a virtual machine migration occurs, the controller cannot detect the migration in a timely manner, the user data flow table needs to be reconstructed, and multiple message interactions are required. This application is applicable to situations such as... Figure 7 The SDN-based cloud computing network system shown is in Figure 7 The network system consists of three physical servers: Physical Server 1, Physical Server 2, and Physical Server 3. Each physical server has a corresponding switch, and a controller manages all the switches on the physical servers. That is, the controller issues corresponding flow tables to each switch for packet forwarding. Each physical server contains multiple virtual machines assigned to corresponding tenants.
[0111] The physical server where the virtual machine resided before migration is designated as the source physical server, and the physical server where the virtual machine resides after migration is designated as the target physical server. When the migrated virtual machine corresponding to the migrated tenant on the source physical server is migrated to the target physical server, the migration method provided in this application embodiment is used, as follows: Figure 8 As shown, the steps include S801 to S809 as follows:
[0112] Step S801: The controller configures the identification information of physical servers, virtual machines, and corresponding tenants of virtual machines in the system.
[0113] Here, the cloud network cluster includes multiple physical servers, virtual machines, and their corresponding tenants. The controller configures identification information for each physical server, each virtual machine, and each tenant. Furthermore, the identification information can be IP address, MAC address, etc. Note that the virtual machine identifier is not a port identifier.
[0114] In this embodiment of the application, the identifier of the physical server can be recorded as SID, the identifier of the virtual machine can be recorded as VMID, and the identifier of each tenant can be recorded as ID.
[0115] In step S802, the controller creates flow tables on each switch.
[0116] Here, each switch has a corresponding flow table, which consists of multiple flow table entries. Each flow table entry contains a mapping relationship between the physical server's SID identifier, the virtual machine's VMID identifier, and the user identifier ID of the tenant corresponding to the virtual machine.
[0117] In step S803, the target physical server detects the migration event and sends a migration request to the controller.
[0118] Before executing step S803, in a large cluster comprising hundreds or thousands of physical servers, the underlying operating system uses a cluster load balancing mechanism to control the migration of virtual machines from heavily loaded physical servers to lightly loaded ones, and allocates corresponding regions to the migrated virtual machines. After the migration, the underlying operating system also assigns a new identifier to the migrated virtual machine. For example, if a virtual machine is migrated from source physical server A to target physical server B, its identifier before the migration is A-1. After the migration, a new identifier can be assigned to the migrated virtual machine, which could be B-1.
[0119] When a virtual machine is migrated to a target physical server, the target physical server can detect the migration and generate a migration request. This request includes: the identification information of the target physical server B, the identification information of the source physical server A, the tenant identifier ID1 corresponding to the migrated virtual machine, the original identifier A-1 of the migrated virtual machine, and the newly assigned identifier B-1 of the migrated virtual machine. Furthermore, the migration request also includes the correspondence between the source physical server, the tenant corresponding to the migrated virtual machine, and the migrated virtual machines. Finally, the migration request is sent to the controller.
[0120] In step S804, the controller receives the migration request, obtains the corresponding flow table entry, and replaces the content in the flow table entry to obtain the modified flow table entry.
[0121] Here, after receiving the migration request, the controller queries the corresponding flow table information based on the tenant identifier ID1 and the original identifier A-1 of the migrated virtual machine, and obtains the corresponding flow table entry. Then, it replaces part of the content in the corresponding flow table entry. Essentially, it replaces the virtual machine identifier with the newly assigned identifier VMID-B after migration, and the physical server identifier with the identifier of the migrated physical server B, while the tenant information corresponding to the virtual machine remains unchanged. That is, it establishes a mapping relationship between tenant ID1, the target physical server B, and the new identifier B-1 of the migrated virtual machine, obtains the modified flow table entry corresponding to the target server B, and stores it in the corresponding flow table. Furthermore, the controller deletes the flow table entry information corresponding to tenant ID1, the source physical server A, and the original identifier A-1 of the migrated virtual machine, obtains the modified flow table entry corresponding to the source server A, and stores it in the corresponding flow table.
[0122] In step S805, the controller packages the replaced flow table entry and carries it in an update notification message, which is then sent to the switch on the target physical server.
[0123] In step S806, the controller sends a notification message to the switch on the source physical server regarding the deletion of flow table entries related to the virtual machine's pre-migration identifier, the correspondence between physical server A and the virtual machine's corresponding tenant ID.
[0124] Here, by sending a deletion notification message to the source switch, the source switch is able to delete the corresponding associated flow table entry in the flow table in a timely manner.
[0125] In step S807, the switch on the target physical server receives the corresponding update notification message and updates its local flow table.
[0126] Here, the switch on the target physical server obtains the corresponding flow table entry from the update notification message and performs a local update based on the corresponding flow table entry.
[0127] In step S808, the switch on the source physical server receives the corresponding deletion notification information and deletes the corresponding flow table entry in the local flow table.
[0128] Here, the switch on the source physical server determines the flow table entry to be deleted from the deletion notification message, then determines the flow table entry to be deleted from the local flow table, and finally deletes the flow table entry to be deleted.
[0129] Step S809: Complete the migration of the virtual machine.
[0130] Through steps S801 to S809 above, the controller configures identification information for physical servers, virtual machines, and their corresponding tenants in the system, and establishes a correspondence between system devices based on the identification information. This ensures that communication messages such as migration requests, update notification messages, and deletion notification messages all carry the identification correspondence between physical servers, virtual machines, and their corresponding tenants. When a virtual machine migration occurs, the target switch directly and promptly sends a migration request to the controller, enabling the controller to directly and promptly modify the corresponding flow table information items and issue corresponding notification messages. The flow table established by the controller based on the migration request includes the correspondence. Furthermore, because of the established correspondence between physical servers, virtual machines, and their corresponding tenants, after the target switch in this embodiment senses the migration of the virtual machine, it only needs to keep the migration tenant identification of the migrated virtual machine unchanged. This ensures that the communication interaction of tenant-related data is not affected during the virtual machine migration process, and tenant data communication can be processed in a timely manner without the need to subsequently rebuild the flow table of user data, thus ensuring that the tenant is unaware of the virtual machine migration. Next, the controller constructs new flow table entries and deleted flow table entries respectively. That is, it creates a new mapping between the new virtual machine identifier and the tenant identifier after migration, and deletes the old mapping between the old virtual machine identifier and the tenant identifier. Then, the new flow table entries and deleted flow table entries are sent to the target switch and the source switch respectively, so that the target switch and the source switch can complete the flow table update without the source switch having to perform message transmission again. This simplifies message interaction and eliminates the need for multiple message interactions in related methods. The controller can directly send the new flow table entries and deleted flow table entries to the target switch and the source switch respectively, thereby improving communication efficiency.
[0131] Based on the foregoing embodiments, this application provides a virtual machine migration device. The various modules and units included in the device can be implemented by a processor in a computer device; of course, they can also be implemented by specific logic circuits. In the implementation process, the processor can be a central processing unit (CPU), a microprocessor unit (MPU), a digital signal processor (DSP), or a field programmable gate array (FPGA), etc.
[0132] This application embodiment further provides a virtual machine migration device. Figure 9 This is a schematic diagram of the composition structure of the virtual machine migration device provided in the embodiments of this application, as shown below. Figure 9 As shown, the virtual machine migration device 900 includes:
[0133] The receiving module 901 is used to receive a migration request sent by the target server, wherein the migration request includes the target server identifier, the original identifier and the new identifier of the virtual machine to be migrated, and the tenant identifier corresponding to the virtual machine to be migrated.
[0134] The acquisition module 902 is used to acquire the target flow table entry in the initial flow table based on the tenant identifier and the original identifier of the virtual machine to be migrated;
[0135] Update module 903 is used to update the target flow table entry based on the target server identifier and the new identifier of the virtual machine to be migrated, to obtain the updated target flow table entry, wherein the updated target flow table entry and the tenant identifier in the target flow table entry remain unchanged;
[0136] The generation module 904 is used to generate a first flow table update message based on the updated target flow table entry, and send the first flow table update message to the target server, so that the target server updates its own flow table based on the first flow table update message.
[0137] In some embodiments, the target flow table entry includes a source server identifier, and the generation module 904 is further configured to generate a second flow table update message based on the target flow table entry; the virtual machine migration device 900 further includes:
[0138] The sending module is used to send the second flow table update message to the source server based on the source server identifier, so as to notify the source server to update its own flow table.
[0139] In some embodiments, the acquisition module 902 is further configured to acquire attribute information of the server, attribute information of the virtual machine, and attribute information of the tenant; the virtual machine migration device 900 further includes:
[0140] The determination module is used to determine the identifiers of each server, each virtual machine, and each tenant based on the attribute information of the server, the attribute information of the virtual machine, and the attribute information of the tenant.
[0141] The module is used to establish an initial flow table for each server based on the server identifier, virtual machine identifier, and tenant identifier. The initial flow table includes the mapping relationship between the server, virtual machine, and tenant.
[0142] In some embodiments, the migration request further includes a source server identifier, and the acquisition module 902 includes:
[0143] The first determining unit is configured to determine a first target flow table from multiple initial flow tables based on the source server identifier;
[0144] The second determining unit is used to determine the target flow table entry from the first target flow table based on the tenant identifier and the original identifier of the virtual machine to be migrated.
[0145] In some embodiments, the update module 903 includes:
[0146] The first replacement unit is used to replace the source server identifier in the target flow table entry with the target server identifier;
[0147] The second replacement unit is used to replace the original identifier of the virtual machine to be migrated in the target flow table entry with the new identifier of the virtual machine to be migrated;
[0148] The holding unit is used to keep the tenant identifier in the target flow table entry unchanged, so as to obtain the updated target flow table entry.
[0149] In some embodiments, the generation module 904 includes:
[0150] The first generation unit is configured to generate a first flow table update message carrying the updated target flow table entry based on the updated target flow table entry.
[0151] The second generation unit is configured to determine a second target flow table from multiple initial flow tables based on the target server identifier; add the updated target flow table entry to the second target flow table to obtain an updated second target flow table; and generate a first flow table update message carrying the updated second target flow table.
[0152] In some embodiments, the generation module 904 further includes:
[0153] The third generation unit is used to generate a second flow table update message carrying the target flow table entry based on the target flow table entry;
[0154] The fourth generation unit is used to delete the target flow table entry in the first target flow table to obtain the updated first target flow table; and to generate a second flow table update message carrying the updated first target flow table.
[0155] It should be noted that the description of the virtual machine migration apparatus in this application is similar to the description of the method embodiments described above, and has similar beneficial effects. For technical details not disclosed in this apparatus embodiment, please refer to the description of the method embodiments of this application for understanding.
[0156] It should be noted that, in the embodiments of this application, if the above-described virtual machine migration method is implemented as a software functional module and sold or used as an independent product, it can also be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the embodiments of this application, or the part that contributes to the related technology, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), magnetic disks, or optical disks. Thus, the embodiments of this application are not limited to any specific hardware and software combination.
[0157] Accordingly, this application provides a computer-readable storage medium storing a computer program thereon, characterized in that the computer program, when executed by a processor, implements the virtual machine migration method provided in the above embodiments.
[0158] This application provides a virtual machine migration device. Figure 10 This is a schematic diagram of the composition structure of the virtual machine migration device provided in the embodiments of this application, as shown below. Figure 10 As shown, the virtual machine migration device 1000 includes: a processor 1001, at least one communication bus 1002, a user interface 1003, at least one external communication interface 1004, and a memory 1005. The communication bus 1002 is configured to enable communication between these components. The user interface 1003 may include a display screen, and the external communication interface 1004 may include standard wired and wireless interfaces. The processor 1001 is configured to execute a program for a virtual machine migration method stored in the memory to implement the virtual machine migration method provided in the above embodiment.
[0159] The descriptions of the virtual machine migration devices and storage media embodiments above are similar to those of the method embodiments above, and have similar beneficial effects. For technical details not disclosed in the virtual machine migration devices and storage media embodiments of this application, please refer to the descriptions of the method embodiments of this application for understanding.
[0160] It should be understood that the phrase "one embodiment" or "an embodiment" throughout the specification means that a specific feature, structure, or characteristic related to the embodiment is included in at least one embodiment of this application. Therefore, "in one embodiment" or "in an embodiment" appearing throughout the specification does not necessarily refer to the same embodiment. Furthermore, these specific features, structures, or characteristics can be combined in any suitable manner in one or more embodiments. It should be understood that in the various embodiments of this application, the sequence numbers of the above-described processes do not imply a sequential order of execution; the execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of this application. The sequence numbers of the above-described embodiments are merely descriptive and do not represent the superiority or inferiority of the embodiments.
[0161] It should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element.
[0162] In the several embodiments provided in this application, it should be understood that the disclosed devices and methods can be implemented in other ways. The device embodiments described above are merely illustrative. For example, the division of units is only a logical functional division, and in actual implementation, there may be other division methods, such as: multiple units or components can be combined, or integrated into another system, or some features can be ignored or not executed. In addition, the coupling, direct coupling, or communication connection between the various components shown or discussed can be through some interfaces, and the indirect coupling or communication connection between devices or units can be electrical, mechanical, or other forms.
[0163] The units described above as separate components may or may not be physically separate. The components shown as units may or may not be physical units. They may be located in one place or distributed across multiple network units. Some or all of the units may be selected to achieve the purpose of the embodiments of this application, depending on actual needs.
[0164] In addition, each functional unit in the various embodiments of this application can be integrated into one processing unit, or each unit can be a separate unit, or two or more units can be integrated into one unit; the integrated unit can be implemented in hardware or in the form of hardware plus software functional units.
[0165] Those skilled in the art will understand that all or part of the steps of the above method embodiments can be implemented by hardware related to program instructions. The aforementioned program can be stored in a computer-readable storage medium. When the program is executed, it performs the steps of the above method embodiments. The aforementioned storage medium includes various media that can store program code, such as mobile storage devices, read-only memory (ROM), magnetic disks, or optical disks.
[0166] Alternatively, if the integrated units described above are implemented as software functional modules and sold or used as independent products, they can also be stored in a computer-readable storage medium. Based on this understanding, the technical solutions of the embodiments of this application, or the parts that contribute to related technologies, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause an AC to execute all or part of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as mobile storage devices, ROMs, magnetic disks, or optical disks.
[0167] The above description is merely an embodiment of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.
Claims
1. A virtual machine migration method, characterized in that, The method includes: Based on the attribute information of the server, the attribute information of the virtual machine, and the attribute information of the tenant, each server identifier, each virtual machine identifier, and each tenant identifier are determined, wherein the server includes at least the source server. Based on the server identifier, virtual machine identifier and tenant identifier, an initial flow table is established for each server. The initial flow table includes the mapping relationship between the server, virtual machine and tenant. Receive a migration request sent by the target server, wherein the migration request includes the target server identifier, the original identifier and the new identifier of the virtual machine to be migrated, and the tenant identifier corresponding to the virtual machine to be migrated; Based on the tenant identifier and the original identifier of the virtual machine to be migrated, obtain the target flow table entry in the initial flow table, wherein the target flow table entry includes the source server identifier; Based on the target server identifier and the new identifier of the virtual machine to be migrated, the target flow table entry is updated to obtain the updated target flow table entry. The updated target flow table entry and the tenant identifier in the target flow table entry remain unchanged. A first flow table update message is generated based on the updated target flow table entry, and the first flow table update message is sent to the target server, so that the target server updates its own flow table based on the first flow table update message. A second flow table update message is generated based on the target flow table entry; Based on the source server identifier, the second flow table update message is sent to the source server to notify the source server to update its own flow table.
2. The method according to claim 1, characterized in that, The migration request also includes the source server identifier. Obtaining the target flow table entry in the initial flow table based on the tenant identifier and the original identifier of the virtual machine to be migrated includes: Based on the source server identifier, a first target flow table is determined from a plurality of initial flow tables; Based on the tenant identifier and the original identifier of the virtual machine to be migrated, the target flow table entry is determined from the first target flow table.
3. The method according to any one of claims 1 to 2, characterized in that, The step of updating the target flow table entry based on the target server identifier and the new identifier of the virtual machine to be migrated, to obtain the updated target flow table entry, includes: Replace the source server identifier in the target flow table entry with the target server identifier; Replace the original identifier of the virtual machine to be migrated in the target flow table entry with the new identifier of the virtual machine to be migrated; Keeping the tenant identifier in the target flow table entry unchanged, the updated target flow table entry is obtained.
4. The method according to claim 2, characterized in that, The step of generating a first flow table update message based on the updated target flow table entry includes: Based on the updated target flow table entry, generate a first flow table update message carrying the updated target flow table entry; or, Based on the target server identifier, a second target flow table is determined from multiple initial flow tables; the updated target flow table entry is added to the second target flow table to obtain an updated second target flow table; and a first flow table update message carrying the updated second target flow table is generated.
5. The method according to claim 4, characterized in that, The step of generating a second flow table update message based on the target flow table entry includes: Based on the target flow table entry, generate a second flow table update message carrying the target flow table entry; or, Delete the target flow table entry in the first target flow table to obtain the updated first target flow table; generate a second flow table update message carrying the updated first target flow table.
6. A virtual machine migration device, characterized in that, The device includes: The determination module is used to determine each server identifier, each virtual machine identifier, and each tenant identifier based on the attribute information of the server, the attribute information of the virtual machine, and the attribute information of the tenant, wherein the server includes at least the source server; A module is established to create an initial flow table for each of the servers based on the server identifiers, virtual machine identifiers, and tenant identifiers. The initial flow table includes the mapping relationship between the servers, virtual machines, and tenants. The receiving module is used to receive a migration request sent by the target server, wherein the migration request includes the target server identifier, the original identifier and the new identifier of the virtual machine to be migrated, and the tenant identifier corresponding to the virtual machine to be migrated; The acquisition module is used to acquire the target flow table entry in the initial flow table based on the tenant identifier and the original identifier of the virtual machine to be migrated, wherein the target flow table entry includes the source server identifier; The update module is used to update the target flow table entry based on the target server identifier and the new identifier of the virtual machine to be migrated, so as to obtain the updated target flow table entry. The updated target flow table entry and the tenant identifier in the target flow table entry remain unchanged. The generation module is used to generate a first flow table update message based on the updated target flow table entry, and send the first flow table update message to the target server, so that the target server updates its own flow table based on the first flow table update message. The generation module is further configured to generate a second flow table update message based on the target flow table entry; The sending module is used to send the second flow table update message to the source server based on the source server identifier, so as to notify the source server to update its own flow table.
7. A virtual machine migration device, characterized in that, The virtual machine migration device includes: Processor; and Memory for storing computer programs that can run on the processor; When the computer program is executed by the processor, it implements the virtual machine migration method according to any one of claims 1 to 5.
8. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer-executable instructions configured to perform the virtual machine migration method according to any one of claims 1 to 5.