Storage space migration method and device of virtual machine, storage medium and electronic device

By identifying the virtual machine with the highest load and migrating its storage space, and migrating the storage space of other virtual machines online, the problem of low efficiency in virtual machine storage space migration is solved, achieving efficient storage space migration and business stability.

CN116360919BActive Publication Date: 2026-06-26INSPUR SUZHOU INTELLIGENT TECH CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
INSPUR SUZHOU INTELLIGENT TECH CO LTD
Filing Date
2023-02-17
Publication Date
2026-06-26

AI Technical Summary

Technical Problem

Existing technologies have low efficiency in migrating virtual machine storage space, especially when migrating within an Oracle RAC database cluster. This requires setting up a new storage environment and performing data migration operations, resulting in complex operations and long database downtime, making it impossible to achieve online migration of virtual machine storage.

Method used

In the first group of virtual machines, identify the virtual machine with the highest current operating load, transfer the services of other virtual machines to this virtual machine, and change the shared storage permissions to non-shared. After completing the storage space migration of this virtual machine, migrate the storage space of other virtual machines. Improve efficiency through online migration technology.

Benefits of technology

It enables efficient online migration of virtual machine storage space, reduces database downtime, improves migration efficiency and business operation stability, and avoids data errors.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116360919B_ABST
    Figure CN116360919B_ABST
Patent Text Reader

Abstract

Embodiments of the present application provide a virtual machine storage space migration method and device, a storage medium and an electronic device, wherein the virtual machine storage space migration method comprises: in the case that each virtual machine in a first group of virtual machines has the same shared storage space, obtaining a first virtual machine in the first group of virtual machines that currently has the largest running load; transferring services on each virtual machine in a second group of virtual machines to the first virtual machine, modifying the shared permission of the first group of shared storage spaces to be prohibited from being shared by the first group of virtual machines, obtaining a first group of non-shared storage spaces, and migrating the first non-shared storage space of the first virtual machine and the first group of non-shared storage spaces; in the case that the migration of the first non-shared storage space and the first group of non-shared storage spaces is completed, migrating the non-shared storage space of each virtual machine in the second group of virtual machines.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computers, and more specifically, to a method and apparatus for migrating the storage space of a virtual machine, a storage medium, and an electronic device. Background Technology

[0002] With the development of internet technology, virtual machines have become increasingly widely used. For example, more and more Oracle databases are running on virtualization platforms, benefiting from the advantages of centralized management, reduced hardware and maintenance costs. Oracle RAC (Real Application Clusters) database clusters often include multiple virtual machines. When migrating virtual machines using shared disks, the migration is often performed at the database level. For instance, a new Oracle RAC environment is built on a new storage environment, and Oracle's DataGuard, GoldenGate, Data Pump, etc., are used to migrate the RAC database data from the original storage environment to the new storage environment. This method requires building a new storage environment and performing data migration operations, demanding high-level database skills from the operators, and resulting in significant database downtime. It also cannot achieve online migration of virtual machine storage.

[0003] There is still no effective solution to the technical problem of low storage space migration efficiency of virtual machines in related technologies. Summary of the Invention

[0004] This application provides a method and apparatus for migrating the storage space of a virtual machine, as well as a storage medium and electronic device, to at least solve the problem of low efficiency in migrating the storage space of virtual machines in related technologies.

[0005] According to one embodiment of this application, a method for migrating the storage space of virtual machines is provided, comprising: when all virtual machines in a first group of virtual machines have the same shared storage space, obtaining the first virtual machine with the highest current running load in the first group of virtual machines, wherein the shared storage space of each virtual machine in the first group of virtual machines is the first group of shared storage space; transferring the services on each virtual machine in a second group of virtual machines to run on the first virtual machine, modifying the sharing permission of the first group of shared storage space to prohibit it from being shared by the first group of virtual machines, obtaining a first group of non-shared storage space, and migrating the first non-shared storage space of the first virtual machine and the first group of non-shared storage space, wherein the second group of virtual machines includes virtual machines in the first group of virtual machines other than the first virtual machine; after the migration of the first non-shared storage space and the first group of non-shared storage space is completed, migrating the non-shared storage space of each virtual machine in the second group of virtual machines.

[0006] In an exemplary embodiment, migrating the first non-shared storage space and the first group of non-shared storage spaces of the first virtual machine includes: migrating the first non-shared storage space and the first group of non-shared storage spaces of the first virtual machine to the first storage space.

[0007] In one exemplary embodiment, after transferring the services on each virtual machine in the second group of virtual machines to run on the first virtual machine, the method further includes: setting each virtual machine in the second group of virtual machines to unshare the first group of shared storage space.

[0008] In one exemplary embodiment, the method further includes: after migrating the first non-shared storage space and the first group of non-shared storage spaces is completed, modifying the sharing permissions of the first group of non-shared storage spaces to allow them to be shared by the first group of virtual machines, thereby obtaining a second group of shared storage spaces.

[0009] In one exemplary embodiment, migrating the non-shared storage space of each virtual machine in the second group of virtual machines includes: migrating the non-shared storage space of each virtual machine in the second group of virtual machines to a second storage space; and, after completing the migration of the non-shared storage space of each virtual machine in the second group of virtual machines to the second storage space, setting each virtual machine in the second group of virtual machines to allow sharing the second group of shared storage space.

[0010] In an exemplary embodiment, before obtaining the first virtual machine with the highest current running load in the first group of virtual machines, the method further includes: obtaining shared storage information of each virtual machine in the first group of virtual machines to obtain N sets of shared storage information, wherein the first group of virtual machines includes N virtual machines, N is a positive integer greater than or equal to 2, and each set of shared storage information in the N sets includes the number of shared storage spaces corresponding to a virtual machine in the first group of virtual machines, the storage location identifier of the shared storage space, the storage path of the shared storage space, and the data name of the data stored in the shared storage space; and determining whether each virtual machine in the first group of virtual machines has the same shared storage space based on the N sets of shared storage information.

[0011] In an exemplary embodiment, determining whether each virtual machine in the first group of virtual machines has the same shared storage space based on the N sets of shared storage information includes: for the i-th virtual machine and the j-th virtual machine among the N virtual machines, determining whether the i-th virtual machine and the j-th virtual machine have the same shared storage space by performing the following operations, where i is a positive integer greater than or equal to 1 and less than or equal to N, and j is a positive integer greater than or equal to 1 and less than or equal to N: obtaining the number of shared storage spaces in the i-th group of shared storage spaces possessed by the i-th virtual machine from the N sets of shared storage information, obtaining the i-th number; obtaining the storage location identifier of each shared storage space in the i-th group of shared storage spaces from the N sets of shared storage information, obtaining the i-th group of storage location identifiers; obtaining the storage path of each virtual storage space in the i-th group of shared storage spaces from the N sets of shared storage information, obtaining the i-th group of storage paths; obtaining the storage path of each virtual storage space in the i-th group of shared storage spaces from the N sets of shared storage information. The data name of the stored data is used to obtain the i-th group of data names; the number of shared storage spaces in the j-th group of shared storage space possessed by the j-th virtual machine is obtained from the N groups of shared storage information to obtain the j-th quantity; the storage location identifier of each shared storage space in the j-th group of shared storage space is obtained from the N groups of shared storage information to obtain the j-th group of storage location identifiers; the storage path of each virtual storage space in the j-th group of shared storage space is obtained from the N groups of shared storage information to obtain the j-th group of storage paths; the data name of the data stored in each shared storage space in the j-th group of shared storage space is obtained from the N groups of shared storage information to obtain the j-th group of data names; if the i-th quantity is the same as the j-th quantity, the i-th group of storage location identifier is the same as the j-th group of storage location identifier, the i-th group of storage path is the same as the j-th group of storage path, and the i-th group of data names is the same as the j-th group of data names, it is determined that the i-th virtual machine and the j-th virtual machine have the same shared storage space.

[0012] In an exemplary embodiment, after migrating the non-shared storage space of each virtual machine in the second group of virtual machines, the method further includes: obtaining updated storage information of the shared storage space of each virtual machine in the second group of virtual machines, wherein the updated storage information includes a first group storage name of the shared storage space of each virtual machine in the second group of virtual machines, a first group storage identifier of the shared storage space of each virtual machine in the second group of virtual machines, and an updated storage space set identifier of the updated storage space set corresponding to the shared storage space of each virtual machine in the second group of virtual machines, wherein the first group storage identifier is used to represent the storage identifier of the shared storage space of each virtual machine in the second group of virtual machines in the updated storage space set; comparing the updated storage information with the initial storage information, wherein the initial storage information includes the information of the shared storage space of each virtual machine in the second group of virtual machines in the updated storage space set. Before migrating the non-shared storage space of each virtual machine in the second group of virtual machines to the second storage space, the second group storage name, the second group storage identifier of the shared storage space of each virtual machine in the second group of virtual machines, and the initial storage space set identifier of the initial storage space set corresponding to the shared storage space of each virtual machine in the second group of virtual machines are specified. The second group storage identifier is used to represent the storage identifier of the shared storage space of each virtual machine in the second group of virtual machines in the initial storage space set. If the first group storage name is different from the second group storage name, or the first group storage identifier is different from the second group storage identifier, or the initial storage space set identifier and the updated storage space set identifier are different, the updated storage information is adjusted.

[0013] In an exemplary embodiment, adjusting the updated storage information includes: determining a third group of virtual machines in the second group of virtual machines when the first group of storage names is different from the second group of storage names, wherein the storage name corresponding to the third group of virtual machines in the first group of storage names is different from the storage name corresponding to the second group of storage names; obtaining the storage identifier of the shared storage space of each virtual machine in the third group of virtual machines from the initial storage information to obtain a third group of storage identifiers, wherein the third group of storage identifiers is used to represent the storage identifier of the shared storage space of each virtual machine in the third group of virtual machines in the storage space set corresponding to the shared storage space of each virtual machine in the third group of virtual machines; running a target configuration file in each virtual machine in the third group of virtual machines to obtain a set of storage names, wherein the target configuration file is used to generate the storage name corresponding to the storage identifier of the virtual machine; and using the set of storage names to update the storage name corresponding to the storage identifier of the shared storage space of each virtual machine in the third group of virtual machines in the initial storage information.

[0014] According to another embodiment of this application, a virtual machine migration apparatus is provided, comprising: a first acquisition module, configured to acquire, when all virtual machines in a first group of virtual machines have the same shared storage space, the first virtual machine currently running with the highest load in the first group of virtual machines, wherein the shared storage space of each virtual machine in the first group of virtual machines is the first group of shared storage space; a processing module, configured to transfer the services on each virtual machine in a second group of virtual machines to run on the first virtual machine, modify the sharing permission of the first group of shared storage space to prohibit it from being shared by the first group of virtual machines, obtain a first group of non-shared storage space, and migrate the first non-shared storage space and the first group of non-shared storage space of the first virtual machine, wherein the second group of virtual machines includes virtual machines in the first group of virtual machines other than the first virtual machine; and a migration module, configured to migrate the non-shared storage space of each virtual machine in the second group of virtual machines after the migration of the first non-shared storage space and the first group of non-shared storage space is completed.

[0015] According to yet another embodiment of this application, a computer-readable storage medium is also provided, wherein a computer program is stored therein, and the computer program is configured to perform the steps in any of the above method embodiments when it is run.

[0016] According to yet another embodiment of this application, an electronic device is also provided, including a memory and a processor, wherein the memory stores a computer program and the processor is configured to run the computer program to perform the steps in any of the above method embodiments.

[0017] Through the embodiments of this application, when it is necessary to migrate the storage space of multiple virtual machines sharing the same storage space, the local storage space of the virtual machine with the highest current operating load and the shared storage space after modifying the sharing permissions can be migrated online while all services in the virtual machine with the highest current operating load are running. After the migration of the local storage space and the shared storage space after modifying the sharing permissions is completed, the local storage space of the other virtual machines in the multiple virtual machines other than the virtual machine with the highest current operating load is migrated. Therefore, the problem of low migration efficiency of virtual machine storage space can be solved, and the effect of improving the migration efficiency of virtual machine storage space can be achieved. Attached Figure Description

[0018] Figure 1 This is a hardware structure block diagram of a mobile terminal for a virtual machine storage space migration method according to an embodiment of this application.

[0019] Figure 2This is a flowchart of a virtual machine storage space migration method according to an embodiment of this application;

[0020] Figure 3 This is a schematic diagram illustrating an application scenario of a virtual machine storage space migration method according to an embodiment of this application;

[0021] Figure 4 This is a schematic diagram of a virtual machine storage space migration process according to an embodiment of this application;

[0022] Figure 5 This is a schematic diagram illustrating a method for determining whether virtual machines have the same shared storage space according to an embodiment of this application;

[0023] Figure 6 This is a schematic diagram of a virtual machine storage space migration method according to an embodiment of this application;

[0024] Figure 7 This is a schematic diagram illustrating an embodiment of obtaining initial storage information according to an embodiment of this application;

[0025] Figure 8 This is a structural block diagram of a virtual machine storage space migration device according to an embodiment of this application. Detailed Implementation

[0026] The embodiments of this application will be described in detail below with reference to the accompanying drawings and examples.

[0027] It should be noted that the terms "first," "second," etc., in the specification, claims, and drawings of the embodiments of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence.

[0028] The methods and embodiments provided in this application can be executed on a mobile terminal, a computer terminal, or a similar computing device. Taking running on a mobile terminal as an example, Figure 1 This is a hardware structure block diagram of a mobile terminal for a virtual machine storage space migration method according to an embodiment of this application. For example... Figure 1 As shown, a mobile terminal may include one or more ( Figure 1 Only one is shown in the diagram. A processor 102 (which may include, but is not limited to, a microprocessor MCU or a programmable logic device FPGA, etc.) and a memory 104 for storing data are also shown. The mobile terminal may further include a transmission device 106 for communication functions and an input / output device 108. Those skilled in the art will understand that... Figure 1 The structure shown is for illustrative purposes only and does not limit the structure of the mobile terminal described above. For example, the mobile terminal may also include components that are more... Figure 1 The more or fewer components shown, or having the same Figure 1The different configurations shown.

[0029] The memory 104 can be used to store computer programs, such as application software programs and modules, like the computer program corresponding to the virtual machine storage space migration method in this embodiment. The processor 102 executes various functional applications and data processing by running the computer program stored in the memory 104, thus implementing the above-described method. The memory 104 may include high-speed random access memory and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 104 may further include memory remotely located relative to the processor 102, and these remote memories can be connected to the mobile terminal via a network. Examples of such networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof.

[0030] The transmission device 106 is used to receive or send data via a network. Specific examples of the network described above may include a wireless network provided by the mobile terminal's communication provider. In one example, the transmission device 106 includes a Network Interface Controller (NIC), which can connect to other network devices via a base station to communicate with the Internet. In another example, the transmission device 106 may be a Radio Frequency (RF) module used for wireless communication with the Internet.

[0031] This embodiment provides a method for migrating the storage space of a virtual machine running on the aforementioned mobile terminal. Figure 2 This is a flowchart of a virtual machine storage space migration method according to an embodiment of this application, such as... Figure 2 As shown, the process includes the following steps:

[0032] Step S202: When all virtual machines in the first group of virtual machines have the same shared storage space, obtain the first virtual machine with the highest current running load in the first group of virtual machines, wherein the shared storage space of each virtual machine in the first group of virtual machines is the first group of shared storage space.

[0033] Step S204: Transfer the services on each virtual machine in the second group of virtual machines to the first virtual machine for operation, modify the sharing permission of the first group of shared storage space to prohibit it from being shared by the first group of virtual machines, obtain the first group of non-shared storage space, and migrate the first non-shared storage space of the first virtual machine and the first group of non-shared storage space. The second group of virtual machines includes the virtual machines in the first group of virtual machines other than the first virtual machine.

[0034] Step S206: After migrating the first non-shared storage space and the first group of non-shared storage spaces is completed, migrate the non-shared storage space of each virtual machine in the second group of virtual machines.

[0035] Through the above steps, when it is necessary to migrate the storage space of multiple virtual machines sharing the same storage space, the local storage space of the virtual machine with the highest current operating load and the shared storage space after modifying the sharing permissions can be migrated online while all services of the virtual machines are running in the virtual machine with the highest current operating load. After the migration of the local storage space and the shared storage space after modifying the sharing permissions is completed, the local storage space of the other virtual machines other than the virtual machine with the highest current operating load can be migrated. Therefore, the problem of low migration efficiency of virtual machine storage space can be solved, and the effect of improving the migration efficiency of virtual machine storage space can be achieved.

[0036] The entity performing the above steps can be a terminal, but is not limited to this.

[0037] The execution order of steps S202 and S204 can be interchanged; that is, step S204 can be executed first, and then step S202 can be executed.

[0038] Figure 3 This is a schematic diagram illustrating an application scenario of a virtual machine storage space migration method according to an embodiment of this application, such as... Figure 3 As shown, the first group of virtual machines may include, but is not limited to, virtual machine 102, virtual machine 104, and virtual machine 106. Service 1 runs in virtual machine 102, which includes non-shared storage space 102-2. Service 2 runs in virtual machine 104, which includes non-shared storage space 104-1. Service 3 runs in virtual machine 106, which includes non-shared storage space 106-1. Virtual machines 102, 104, and 106 share the first group of shared storage space 108. The first group of shared storage space 108 may include, but is not limited to, shared storage space 108-1, shared storage space 108-2, and shared storage space 108-3.

[0039] Figure 4 This is a schematic diagram of a virtual machine storage space migration process according to an embodiment of this application, as shown below. Figure 4As shown, when it is necessary to migrate the storage space of virtual machines 102, 104, and 106, it is possible, but not limited to, first transferring service 2 running in virtual machine 104 and service 3 running in virtual machine 106 to virtual machine 102 (i.e., the first virtual machine) with the highest current operating load. That is, services 1, 2, and 3 run in virtual machine 102. Then, the sharing permissions of shared storage spaces 108-1, 108-2, and 108-3 included in the first group of shared storage space 108 are modified to prohibit sharing by virtual machines 102, 104, and 106, resulting in the first group of non-shared storage space 110. The non-shared storage space 102-2 (i.e., the first non-shared storage space) of virtual machine 102 and the first group of non-shared storage space 110 are then migrated to the first storage space 112. After the migration of non-shared storage space 102-2 and the first group of non-shared storage space 110 is completed, the non-shared storage space 104-1 in virtual machine 104 and the non-shared storage space 106-1 in virtual machine 106 are migrated to the second storage space 114.

[0040] In the technical solution provided in step S202 above, each virtual machine in a group of virtual machines may, but is not limited to, have its own non-shared storage space, and each virtual machine in a group of virtual machines may, but is not limited to, have one or more shared storage spaces. When each virtual machine in a group of virtual machines has the same shared storage space, the first virtual machine with the largest current running load is obtained from each virtual machine in the group of virtual machines.

[0041] Optionally, in this embodiment, the shared storage space of each virtual machine in the first group of virtual machines is the first group of shared storage space. This means that each virtual machine in the first group of virtual machines can read the data stored in each shared storage space in the first group of shared storage space, each virtual machine in the first group of virtual machines can write data to each shared storage space in the first group of shared storage space, and each virtual machine in the first group of virtual machines can share the data stored in each shared storage space in the first group of shared storage space.

[0042] In one exemplary embodiment, it can be determined, but is not limited to, that each virtual machine in the first group of virtual machines has the same shared storage space by: obtaining the shared storage information of each virtual machine in the first group of virtual machines to obtain N sets of shared storage information, wherein the first group of virtual machines includes N virtual machines, where N is a positive integer greater than or equal to 2, and each set of shared storage information in the N sets includes the number of shared storage spaces corresponding to a virtual machine in the first group of virtual machines, the storage location identifier of the shared storage space, the storage path of the shared storage space, and the data name of the data stored in the shared storage space; and determining whether each virtual machine in the first group of virtual machines has the same shared storage space based on the N sets of shared storage information.

[0043] In an exemplary embodiment, for the i-th virtual machine and the j-th virtual machine among the N virtual machines, the following operations can be performed to determine whether the i-th virtual machine and the j-th virtual machine have the same shared storage space, where i is a positive integer greater than or equal to 1 and less than or equal to N, and j is a positive integer greater than or equal to 1 and less than or equal to N: obtaining the number of shared storage spaces in the i-th shared storage space of the i-th virtual machine from the N sets of shared storage information, to obtain the i-th quantity; obtaining the storage location identifier of each shared storage space in the i-th shared storage space from the N sets of shared storage information, to obtain the i-th set of storage location identifiers; obtaining the storage path of each virtual storage space in the i-th shared storage space from the N sets of shared storage information, to obtain the i-th set of storage paths; obtaining the data name of the data stored in each shared storage space in the i-th shared storage space from the N sets of shared storage information, to obtain the i-th set of data names; The following steps are performed to obtain the following data: First, obtain the number of shared storage spaces in the j-th group of shared storage space possessed by the j-th virtual machine from the N groups of shared storage information, thus obtaining the j-th quantity. Second, obtain the storage location identifier of each shared storage space in the j-th group of shared storage space from the N groups of shared storage information, thus obtaining the j-th group storage location identifier. Third, obtain the storage path of each virtual storage space in the j-th group of shared storage space from the N groups of shared storage information, thus obtaining the j-th group storage path. Fourth, obtain the data name of the data stored in each shared storage space in the j-th group of shared storage space from the N groups of shared storage information, thus obtaining the j-th group data name. Finally, if the i-th quantity is the same as the j-th quantity, the i-th group storage location identifier is the same as the j-th group storage location identifier, the i-th group storage path is the same as the j-th group storage path, and the i-th group data name is the same as the j-th group data name, then determine that the i-th virtual machine and the j-th virtual machine have the same shared storage space.

[0044] Optionally, in this embodiment, if each virtual machine in the first group of virtual machines has the same shared storage space, the virtual machines are migrated. Figure 5 This is a schematic diagram illustrating how to determine whether virtual machines have the same shared storage space according to an embodiment of this application. Figure 5 As shown, the method for migrating the storage space of virtual machines in this application embodiment can be explained and illustrated using virtual machines A and B (i.e., N equals 2) deployed in the same ORACLE RAC cluster based on the VMware platform as an example, and can be applied to the embodiments of this application, but is not limited to.

[0045] Step S502: Read the list of shared disks of virtual machine A and read the list of shared disks of virtual machine B.

[0046] When you need to change the storage of virtual machines using shared disks (i.e., the first group of shared storage spaces) in the VMware platform, in the VMware virtualization management interface, you need to select all virtual machines in the Oracle RAC cluster (i.e., the group of virtual machines), and select "Migrate and Change Storage" from the menu. At this time, the system will prompt whether you need to execute a script using vmtool. If you need to select a pre-prepared script, the script will be executed in virtual machines A and B (i.e., each virtual machine in the first group of virtual machines). The system reads the number of shared disks (i.e., the shared storage spaces mentioned above) that virtual machines A and B have, the disk files (i.e., the storage location identifiers mentioned above), the paths (i.e., the storage paths mentioned above), and the file names (i.e., the data names mentioned above) that the shared disks of virtual machines A and B point to.

[0047] Step S504: Compare whether the two sets of disks are consistent.

[0048] It can determine, but is not limited to, whether the number of shared disks (i.e., the amount of shared storage space) of virtual machine A and virtual machine B are the same, whether the shared disks of virtual machine A and virtual machine B point to the same disk file (i.e., the storage location identifier mentioned above), and whether the path (i.e., the storage path mentioned above) and file name (i.e., the data name mentioned above) are the same.

[0049] It is possible, but not limited to, first comparing each shared disk in virtual machine A with the shared disk in virtual machine B, and then comparing each shared disk in virtual machine B with the shared disk in virtual machine A. The comparison of shared disks in virtual machines A and B can be achieved using, but is not limited to, the following script:

[0050] Array A = All shared disks of virtual machine A (including paths and disk names)

[0051] Array B = All shared disks of virtual machine B (including paths and disk names)

[0052] isAllSame = true

[0053] --Compare each shared disk in virtual machine A with the shared disks in virtual machine B.

[0054] --Compare each shared disk in virtual machine B with the shared disks in virtual machine A.

[0055]

[0056] --If there are different hard drives

[0057]

[0058] Step S506: If the two sets of disks are identical, continue with the subsequent migration operations.

[0059] If virtual machine A and virtual machine B have the same number of shared disks (i.e., the amount of shared storage space), the shared disks of the two virtual machines point to the same disk files (i.e., the storage location identifiers mentioned above), and the paths (i.e., the storage paths mentioned above) and file names (i.e., the data names mentioned above) are also the same, that is, virtual machine A and virtual machine B have the same number of shared disks (i.e., the amount of shared storage space) and they are mutually inclusive, meaning that each shared disk is used by both virtual machines, then the subsequent migration operation can continue; otherwise, the comparison should be stopped and the entire migration process should be exited.

[0060] In the technical solution provided in step S204 above, when each virtual machine in the first group of virtual machines has the same shared storage space, the services running in each virtual machine in the first group of virtual machines are concentrated in the virtual machine with the highest current operating load (i.e., the first virtual machine). In this way, virtual machines can be migrated online while ensuring the operation of services in the virtual machines, thereby improving the stability of service operation in the virtual machines.

[0061] Optionally, in this embodiment, the sharing permissions of the first group of shared storage space are modified to prohibit sharing by the first group of virtual machines, resulting in a first group of non-shared storage space. Under these circumstances, the migration of the first non-shared storage space and the first group of non-shared storage space within the first virtual machine begins. This method avoids the possibility that each virtual machine will convert its shared storage space into local storage space during the migration process, which could lead to data errors and improves the accuracy of virtual machine storage space migration.

[0062] In one exemplary embodiment, the first non-shared storage space and the first group of non-shared storage spaces of the first virtual machine may be migrated to the first storage space, but not limited to the following manner: the first non-shared storage space and the first group of non-shared storage spaces of the first virtual machine are migrated to the first storage space.

[0063] Optionally, in this embodiment, the first non-shared storage space and the first group of non-shared storage spaces of the first virtual machine may be migrated to the same or different storage spaces, etc.

[0064] In one exemplary embodiment, the sharing of the first group of shared storage space by other virtual machines in a group of virtual machines, excluding the first virtual machine, can be configured by setting each virtual machine in the second group of virtual machines to unshare the first group of shared storage space.

[0065] Optionally, in this embodiment, after transferring the services on each virtual machine in the second group of virtual machines to the first virtual machine with the highest current operating load, each virtual machine in the second group of virtual machines is set to cancel sharing the first group of shared storage space. For example, the connection between each virtual machine in the second group of virtual machines and the first group of shared storage space is disconnected. In this case, the first group of shared storage space still exists, but each virtual machine in the second group of virtual machines cannot share the first group of shared storage space.

[0066] In one exemplary embodiment, the sharing permissions of the first group of non-shared storage spaces can be modified, but not limited to, by modifying the sharing permissions of the first group of non-shared storage spaces to allow them to be shared by the first group of virtual machines, thereby obtaining the second group of shared storage spaces.

[0067] Optionally, in this embodiment, after the migration of the first non-shared storage space and the first group of non-shared storage spaces is completed, the sharing permission of the first group of non-shared storage spaces is modified to allow it to be shared by the first group of virtual machines.

[0068] In the technical solution provided in step S206 above, after the migration of the first non-shared storage space and the first group of non-shared storage space of the first virtual machine is completed, each virtual machine in the second group of virtual machines has been set to cancel sharing the first group of shared storage space, and the non-shared storage space of each virtual machine in the second group of virtual machines can be directly migrated, avoiding errors in the storage space of the virtual machines during the migration process.

[0069] In one exemplary embodiment, the non-shared storage space of each virtual machine in the second group of virtual machines can be migrated, but is not limited to, by migrating the non-shared storage space of each virtual machine in the second group of virtual machines to the second storage space; and, after completing the migration of the non-shared storage space of each virtual machine in the second group of virtual machines to the second storage space, configuring each virtual machine in the second group of virtual machines to allow sharing the second group of shared storage space.

[0070] Optionally, in this embodiment, the non-shared storage space of each virtual machine in the second group of virtual machines may be migrated to a second storage space that is different from the first storage space, or the non-shared storage space of each virtual machine in the second group of virtual machines may be migrated to the first storage space (i.e., the first storage space and the second storage space are the same storage space).

[0071] Figure 6 This is a schematic diagram of a virtual machine storage space migration method according to an embodiment of this application, combined with... Figure 4 , Figure 6 As shown, after migrating non-shared storage space 102-2 (i.e., the first non-shared storage space) and the first group of non-shared storage spaces 110, the sharing permissions of the first group of non-shared storage spaces 110 are modified to allow sharing by virtual machines 102, 104, and 106, resulting in the second group of shared storage spaces 116. After migrating non-shared storage space 104-1 of virtual machine 104 and non-shared storage space 106-1 of virtual machine 106 to the second storage space 114, virtual machines 104 and 106 are set to allow sharing of the second group of shared storage spaces 116.

[0072] In detail, in a group of virtual machines including virtual machine 102, virtual machine 104, and virtual machine 106, the migration process requires shutting down two of the virtual machines (i.e., the second group of virtual machines), ensuring that only one virtual machine (i.e., the first virtual machine) is powered on and running. To minimize the impact of virtual machine shutdown on business system connections, the system chooses to shut down virtual machines 104 and 106 (i.e., the second group of virtual machines) which have relatively lower load. Before shutting down, all client connections and sessions on virtual machines 104 and 106 are transferred to another node, virtual machine 102 (i.e., the first virtual machine mentioned above). The databases in virtual machines 104 and 106 no longer respond to new database connections initiated by businesses or users, but instead redirect new database connections to the other node, virtual machine 102. When virtual machines 104 and 106 no longer have business sessions or connections, the system shuts down the database instances and cluster services on virtual machines 104 and 106, and modifies the database cluster service to not start with the operating system. The system then shuts down the operating systems of virtual machines 104 and 106. Next, in the configuration of virtual machines 104 and 106, the system deletes all shared disks on them (i.e., sets each virtual machine in the second group to unshare the first group's shared storage space), retaining only the non-shared disks on virtual machines 104 and 106 (i.e., the non-shared storage spaces of each virtual machine in the second group). At this point, since the database system is running normally on another virtual machine 102, the business system is unaffected. In the configuration of virtual machine 102, the system changes the sharing mode of all shared disks to non-shared (i.e., modifies the sharing permissions of the first group's shared storage space to prohibit sharing by the first group of virtual machines). After this modification, the original shared disks become non-shared disks. The system begins by migrating the first non-shared storage space and the first group of non-shared storage spaces of virtual machine 102 online to the first storage space 112. During the migration process, the database and business system operate normally and are unaffected. After virtual machine 102 has been completely migrated to the first storage space 112, the system will change the shared mode of the hard drives in virtual machine 102 that were modified to non-shared disks (i.e., the first group of non-shared storage spaces) back to shared mode (that is, change the sharing permissions of the first group of non-shared storage spaces to allow them to be shared by the first group of virtual machines).

[0073] After the migration of the first non-shared storage space and the first group of non-shared storage spaces in virtual machine 102 is completed, the migration of non-shared storage space 104-1 in virtual machine 104 and non-shared storage space 106-1 in virtual machine 106 to the second storage space 114 begins. After the migration to the new storage (i.e., the second storage space 114) is completed, the system adds all shared disks in virtual machine 102 to virtual machine 102 and virtual machine 104 in the order of shared disks in virtual machine 102 by adding existing disks (that is, setting each virtual machine in the second group of virtual machines to be allowed to share the second group of shared storage space).

[0074] In an exemplary embodiment, the consistency between the disk head information after migration and the disk head information before migration can be determined by, but is not limited to, the following methods: obtaining the updated storage information of the shared storage space of each virtual machine in the second group of virtual machines, wherein the updated storage information includes the first group storage name of the shared storage space of each virtual machine in the second group of virtual machines, the first group storage identifier of the shared storage space of each virtual machine in the second group of virtual machines, and the updated storage space set identifier of the updated storage space set corresponding to the shared storage space of each virtual machine in the second group of virtual machines, wherein the first group storage identifier is used to represent the storage identifier of the shared storage space of each virtual machine in the second group of virtual machines in the updated storage space set; comparing the updated storage information with the initial storage information, wherein the initial storage information includes the... Before migrating the non-shared storage space of each virtual machine in the second group to the second storage space, the second group storage name, the second group storage identifier of the shared storage space of each virtual machine in the second group, and the initial storage space set identifier of the initial storage space set corresponding to the shared storage space of each virtual machine in the second group are specified. The second group storage identifier is used to represent the storage identifier of the shared storage space of each virtual machine in the second group in the initial storage space set. If the first group storage name is different from the second group storage name, or the first group storage identifier is different from the second group storage identifier, or the initial storage space set identifier and the updated storage space set identifier are different, the updated storage information is adjusted.

[0075] Optionally, in this embodiment, the updated storage information can be adjusted, but is not limited to, if the initial storage information and the updated storage information are inconsistent, to ensure the accuracy of the data stored in the shared storage space of the virtual machine before and after the migration.

[0076] Optionally, in this embodiment, Figure 7This is a schematic diagram illustrating an embodiment of obtaining initial storage information according to this application, such as... Figure 7 As shown, initial storage information can be obtained by performing, but is not limited to, the following steps:

[0077] Step S701: Read the shared disks of each virtual machine one by one;

[0078] Step S702: Read the disk header information of the shared disk of each virtual machine;

[0079] Step S703: Analyze the order book information;

[0080] Step S704 may include, but is not limited to, obtaining the device name (i.e., the second group storage name), the ASM disk name (i.e., the second group storage identifier), and the corresponding ASM disk group name (i.e., the initial storage space set identifier), etc.

[0081] Step S705: Record the data in the output SML file;

[0082] Step S706: Determine whether the disk has been processed. If it has been processed, proceed to step S707. If it has been processed, proceed to step S701.

[0083] Step S707: Return the result file;

[0084] Step S708: Determine whether the virtual machine has finished processing. If it has finished processing, proceed to step S709. If it has not finished processing, proceed to step S701.

[0085] Step S709: Integrate the results from different virtual machines;

[0086] Step S710: Record the integrated results.

[0087] The integrated results may be, but are not limited to, those shown in Table 1:

[0088] Table 1

[0089]

[0090] As shown in Table 1, the two virtual machines (Virtual Machine A and Virtual Machine B) have two disk groups for Oracle ASM: DATA and OCR. The DATA disk group contains two disks, / dev / asm-disk1 and / dev / asm-disk2, while the OCR disk group contains three disks: / dev / asm-disk3, / dev / asm-disk4, and / dev / asm-disk5. Furthermore, each disk with the name / dev / asm-disk* has the same name on both nodes. These names are obtained by binding the shared disk's UUID to the UUID using the scsi_id command. The purpose of reading the disk header here is to save disk information before migration. To prevent ASM issues caused by inconsistent device names or UUID changes in the shared disks between the two virtual machines after migration, if the same ASM device has different device names on the two nodes after migration, the name can be changed using, but is not limited to, the UDEV binding method.

[0091] In one exemplary embodiment, the storage information can be adjusted and updated in the following manner, but not limited to: when the first group of storage names is different from the second group of storage names, a third group of virtual machines is determined in the second group of virtual machines, wherein the storage name corresponding to the third group of virtual machines in the first group of storage names is different from the storage name corresponding to the second group of storage names; the storage identifier of the shared storage space of each virtual machine in the third group of virtual machines is obtained from the initial storage information to obtain a third group of storage identifiers, wherein the third group of storage identifiers is used to represent the storage identifier of the shared storage space of each virtual machine in the third group of virtual machines in the storage space set corresponding to the shared storage space of each virtual machine in the third group of virtual machines; a target configuration file is run in each virtual machine in the third group of virtual machines to obtain a set of storage names, wherein the target configuration file is used to generate the storage name corresponding to the storage identifier of the virtual machine; the storage name corresponding to the storage identifier of the shared storage space of each virtual machine in the third group of virtual machines in the initial storage information is updated using the set of storage names.

[0092] Optionally, in this embodiment, if the first set of storage names is different from the second set of storage names, it can indicate that the storage name with a one-to-one correspondence with the UUID (Universally Unique Identifier) ​​has changed after migration. For example, if the UUID of the virtual machine is obtained by executing the scsi_id command on the virtual machine using vmtool, the UUID of the hard drive corresponding to asm-disk1 in the virtual machine is 11112222, and its ASM disk name is data_0000. After migration, its UUID becomes 11113333. However, since the ASM disk name at the disk header is data_0000, it can be determined that 11113333 is the original 11112222. It can be bound to / dev / asm-disk1 by executing the ASM binding command, but is not limited to this. In this case, the storage name can be updated by executing the following script:

[0093] Shared disk array = all shared disks of the virtual machine (including path and disk name)

[0094] for disk-name in shared disk array

[0095]

[0096] Run the above script to regenerate the 99-oracle-asmdevices.rules file based on the UUID of each shared disk:

[0097] KERNEL=="sd*",SUBSYSTEM=="block",PROGRAM==" / usr / lib / udev / scsi_id-gud / dev / $name",RESULT=="11113333",SYMLINK+="asm-disk1",OWNER="grid",GROUP="asmadmin",MODE="0660"

[0098] KERNEL=="sd*",SUBSYSTEM=="block",PROGRAM==" / usr / lib / udev / scsi_id-gud / dev / $name",RESULT=="11113334",SYMLINK+="asm-disk2",OWNER="grid",GROUP="asmadmin",MODE="0660"

[0099] KERNEL=="sd*",SUBSYSTEM=="block",PROGRAM==" / usr / lib / udev / scsi_id-gud / dev / $name",RESULT=="11113335",SYMLINK+="asm-disk3",OWNER="grid",GROUP="asmadmin",MODE="0660"

[0100] KERNEL=="sd*",SUBSYSTEM=="block",PROGRAM==" / usr / lib / udev / scsi_id-gud / dev / $name",RESULT=="11113336",SYMLINK+="asm-disk4",OWNER="grid",GROUP="asmadmin",MODE="0660"

[0101] KERNEL=="sd*",SUBSYSTEM=="block",PROGRAM==" / usr / lib / udev / scsi_id-gud / dev / $name",RESULT=="11113337",SYMLINK+="asm-disk5",OWNER="grid",GROUP="asmadmin",MODE="0660"

[0102] The system restarts the UDEV service to make the new 99-oracle-asmdevices.rules configuration file (i.e., the target configuration file mentioned above) effective. Then the system starts the database cluster service, and the database instances will start automatically. Once they start normally, it means that the configuration file is correct. Change the cluster service to start randomly. At this point, the database instances on the second group of virtual machines begin to receive application connections.

[0103] The first virtual machine has not been restarted, and the configuration file 99-oracle-asmdevices.rules has not been reused in the first virtual machine. Therefore, the ASM disk name and hard disk device correspondence on the first virtual machine will not change. However, after restarting, it will be unable to bind the ASM device name properly because the UUID has changed. Therefore, 99-oracle-asmdevices.rules will be regenerated in the first virtual machine. This way, when the first virtual machine B restarts next time, it will automatically use the new configuration file to generate and bind the device.

[0104] Optionally, in this embodiment, the functionality of calling scripts and obtaining return information via vmtool can be added, but is not limited to. A function page can be added to VCENTER to define which operations on the virtual machine require the execution of custom scripts, such as migration and shutdown. This page can specify the specific scripts required for a particular function, and these scripts can be stored in the / etc / scripts directory of vCenter. Then, the specific script to be executed can be selected on the function page.

[0105] When a specific operation needs to be performed on a virtual machine in vCenter, such as migration or shutdown, vCenter selects the script name to be executed based on the previously defined operation and specific script mapping. The vCenter management interface retrieves the script from the vCenter virtual machine's ` / etc / scripts` directory and sends it to the virtual machine's ` / etc / vmware-tools` directory via `vmtool`, then instructs `vmtool` to invoke and execute the script. This allows for customized operations on the virtual machine as needed.

[0106] For scripts that return or output results, after the script finishes execution, a file with the same name as the script and an .xml extension is generated in / etc / vmware-tools. After the script executes, vmtool instructs vCenter to retrieve the result file back to the / tmp directory on the vCenter host using the following method for later use.

[0107] The generated result content is similar to the following standard XML format:

[0108] <? xml version="1.0" encoding="UTF-8"? >

[0109] <vmtool_return>

[0110] <attribute>

[0111] <asmname> DATA_0000< / asmname>

[0112] <path> / dev / asm-disk1< / path>

[0113] <grpname> DATA< / grpname>

[0114] < / attribute>

[0115] <attribute>

[0116] <asmname> DATA_0001< / asmname>

[0117] <path> / dev / asm-disk2< / path>

[0118] <grpname> DATA< / grpname>

[0119] < / attribute>

[0120] < / vmtool_return>

[0121] Through the embodiments of this application, online migration of storage for virtual machines using virtual shared disks can be achieved without much human intervention, saving migration time, reducing the technical requirements for operators, and ensuring the continuous and uninterrupted operation of business systems through online migration, thereby improving system availability and enhancing the virtualization system's ability to migrate virtual machines.

[0122] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods according to the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solutions of the embodiments of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk), and includes several instructions to cause a terminal device (which may be a mobile phone, computer, server, or network device, etc.) to execute the methods described in the various embodiments of this application.

[0123] This embodiment also provides a virtual machine storage space migration device, which is used to implement the above embodiments and preferred embodiments, and will not be repeated as described above. As used below, the term "module" can be a combination of software and / or hardware that implements a predetermined function. Although the device described in the following embodiments is preferably implemented in software, hardware implementation, or a combination of software and hardware, is also possible and contemplated.

[0124] Figure 8 This is a structural block diagram of a virtual machine storage space migration device according to an embodiment of this application, such as... Figure 8 As shown, the device includes:

[0125] The first acquisition module 802 is used to acquire the first virtual machine with the highest current running load in the first group of virtual machines when all virtual machines in the first group of virtual machines have the same shared storage space, wherein the shared storage space of each virtual machine in the first group of virtual machines is the first group of shared storage space.

[0126] The processing module 804 is used to transfer the services on each virtual machine in the second group of virtual machines to the first virtual machine for operation, modify the sharing permission of the first group of shared storage space to prohibit it from being shared by the first group of virtual machines, obtain the first group of non-shared storage space, and migrate the first non-shared storage space of the first virtual machine and the first group of non-shared storage space, wherein the second group of virtual machines includes virtual machines in the first group of virtual machines other than the first virtual machine;

[0127] The migration module 806 is used to migrate the non-shared storage space of each virtual machine in the second group of virtual machines after the migration of the first non-shared storage space and the first group of non-shared storage space has been completed.

[0128] Through the embodiments of this application, when it is necessary to migrate the storage space of multiple virtual machines sharing the same storage space, the local storage space of the virtual machine with the highest current operating load and the shared storage space after modifying the sharing permissions can be migrated online while all services in the virtual machine with the highest current operating load are running. After the migration of the local storage space and the shared storage space after modifying the sharing permissions is completed, the local storage space of the other virtual machines in the multiple virtual machines other than the virtual machine with the highest current operating load is migrated. Therefore, the problem of low migration efficiency of virtual machine storage space can be solved, and the effect of improving the migration efficiency of virtual machine storage space can be achieved.

[0129] In one exemplary embodiment, the processing module includes:

[0130] The first migration unit is used to migrate the first non-shared storage space and the first group of non-shared storage spaces of the first virtual machine to the first storage space.

[0131] In one exemplary embodiment, the device further includes:

[0132] The configuration module is used to set each virtual machine in the second group of virtual machines to unshare the first group of shared storage space after the services on each virtual machine in the second group of virtual machines are transferred to the first virtual machine.

[0133] In one exemplary embodiment, the device further includes:

[0134] The modification module is used to modify the sharing permissions of the first group of non-shared storage space to allow it to be shared by the first group of virtual machines after the migration of the first non-shared storage space and the first group of non-shared storage space is completed, so as to obtain the second group of shared storage space.

[0135] In one exemplary embodiment, the migration module includes:

[0136] The second migration unit is used to migrate the non-shared storage space of each virtual machine in the second group of virtual machines to the second storage space;

[0137] The configuration unit is used to configure each virtual machine in the second group of virtual machines to be allowed to share the second group of shared storage space after the non-shared storage space of each virtual machine in the second group of virtual machines has been migrated to the second storage space.

[0138] In one exemplary embodiment, the device further includes:

[0139] The second acquisition module is used to acquire shared storage information of each virtual machine in the first group of virtual machines before acquiring the first virtual machine with the highest current running load in the first group of virtual machines, to obtain N sets of shared storage information, wherein the first group of virtual machines includes N virtual machines, N is a positive integer greater than or equal to 2, and each set of shared storage information in the N sets includes the number of shared storage spaces of a corresponding virtual machine in the first group of virtual machines, the storage location identifier of the shared storage space, the storage path of the shared storage space, and the data name of the data stored in the shared storage space;

[0140] The determining module is used to determine, based on the N sets of shared storage information, whether each virtual machine in the first group of virtual machines has the same shared storage space.

[0141] In an exemplary embodiment, the determining module is configured to determine, for the i-th virtual machine and the j-th virtual machine among the N virtual machines, whether the i-th virtual machine and the j-th virtual machine have the same shared storage space by performing the following operations: where i is a positive integer greater than or equal to 1 and less than or equal to N, and j is a positive integer greater than or equal to 1 and less than or equal to N.

[0142] The number of shared storage spaces in the i-th shared storage space of the i-th virtual machine is obtained from the N sets of shared storage information, thus obtaining the i-th quantity; the storage location identifier of each shared storage space in the i-th shared storage space is obtained from the N sets of shared storage information, thus obtaining the i-th group of storage location identifiers; the storage path of each virtual storage space in the i-th shared storage space is obtained from the N sets of shared storage information, thus obtaining the i-th group of storage paths; the data name of the data stored in each shared storage space in the i-th shared storage space is obtained from the N sets of shared storage information, thus obtaining the i-th group of data names;

[0143] The number of shared storage spaces in the j-th shared storage space of the j-th virtual machine is obtained from the N sets of shared storage information, thus obtaining the j-th quantity; the storage location identifier of each shared storage space in the j-th shared storage space is obtained from the N sets of shared storage information, thus obtaining the j-th group of storage location identifiers; the storage path of each virtual storage space in the j-th shared storage space is obtained from the N sets of shared storage information, thus obtaining the j-th group of storage paths; the data name of the data stored in each shared storage space in the j-th shared storage space is obtained from the N sets of shared storage information, thus obtaining the j-th group of data names;

[0144] If the i-th quantity is the same as the j-th quantity, the i-th group storage location identifier is the same as the j-th group storage location identifier, the i-th group storage path is the same as the j-th group storage path, and the i-th group data name is the same as the j-th group data name, then the i-th virtual machine and the j-th virtual machine are determined to have the same shared storage space.

[0145] In one exemplary embodiment, the device further includes:

[0146] The third acquisition module is used to acquire updated storage information of the shared storage space of each virtual machine in the second group of virtual machines after migrating the non-shared storage space of each virtual machine in the second group of virtual machines. The updated storage information includes the first group storage name of the shared storage space of each virtual machine in the second group of virtual machines, the first group storage identifier of the shared storage space of each virtual machine in the second group of virtual machines, and the updated storage space set identifier of the updated storage space set corresponding to the shared storage space of each virtual machine in the second group of virtual machines. The first group storage identifier is used to represent the storage identifier of the shared storage space of each virtual machine in the second group of virtual machines in the updated storage space set.

[0147] The comparison module is used to compare the updated storage information and the initial storage information. The initial storage information includes, before migrating the non-shared storage space of each virtual machine in the second group of virtual machines to the second storage space, the second group storage name of the shared storage space of each virtual machine in the second group of virtual machines, the second group storage identifier of the shared storage space of each virtual machine in the second group of virtual machines, and the initial storage space set identifier of the initial storage space set corresponding to the shared storage space of each virtual machine in the second group of virtual machines. The second group storage identifier is used to indicate the storage identifier of the shared storage space of each virtual machine in the second group of virtual machines in the initial storage space set.

[0148] The adjustment module is used to adjust the updated storage information when the first group storage name is different from the second group storage name, or the first group storage identifier is different from the second group storage identifier, or the initial storage space set identifier and the updated storage space set identifier are different.

[0149] In one exemplary embodiment, the adjustment module includes:

[0150] The determining unit is configured to determine a third group of virtual machines in the second group of virtual machines when the first group of storage names is different from the second group of storage names, wherein the storage name corresponding to the third group of virtual machines in the first group of storage names is different from the storage name corresponding to the second group of storage names;

[0151] The acquisition unit is used to acquire the storage identifier of the shared storage space of each virtual machine in the third group of virtual machines from the initial storage information to obtain the third group of storage identifiers, wherein the third group of storage identifiers is used to represent the storage identifier of the shared storage space of each virtual machine in the third group of virtual machines in the storage space set corresponding to the shared storage space of each virtual machine in the third group of virtual machines.

[0152] The running unit is used to run the target configuration file in each of the virtual machines in the third group of virtual machines to obtain a set of storage names, wherein the target configuration file is used to generate the storage name corresponding to the storage identifier of the virtual machine;

[0153] The update unit is used to update the storage name corresponding to the storage identifier of the shared storage space of each virtual machine in the third group of virtual machines in the initial storage information using the set of storage names.

[0154] It should be noted that the above modules can be implemented by software or hardware. For the latter, they can be implemented in the following ways, but are not limited to: all the above modules are located in the same processor; or, the above modules are located in different processors in any combination.

[0155] Embodiments of this application also provide a computer-readable storage medium storing a computer program, wherein the computer program is configured to execute the steps in any of the above method embodiments when run.

[0156] In one exemplary embodiment, the aforementioned computer-readable storage medium may include, but is not limited to, various media capable of storing computer programs, such as a USB flash drive, read-only memory (ROM), random access memory (RAM), portable hard disk, magnetic disk, or optical disk.

[0157] Embodiments of this application also provide an electronic device including a memory and a processor, wherein the memory stores a computer program and the processor is configured to run the computer program to perform the steps in any of the above method embodiments.

[0158] In one exemplary embodiment, the electronic device may further include a transmission device and an input / output device, wherein the transmission device is connected to the processor and the input / output device is connected to the processor.

[0159] Specific examples in this embodiment can be found in the examples described in the above embodiments and exemplary implementations, and will not be repeated here.

[0160] Obviously, those skilled in the art should understand that the modules or steps of the embodiments of this application described above can be implemented using general-purpose computing devices. They can be centralized on a single computing device or distributed across a network of multiple computing devices. They can be implemented using computer-executable program code, and thus can be stored in a storage device for execution by a computing device. In some cases, the steps shown or described can be performed in a different order than those presented here, or they can be fabricated as separate integrated circuit modules, or multiple modules or steps can be fabricated as a single integrated circuit module. Thus, the embodiments of this application are not limited to any particular combination of hardware and software.

[0161] The above description is merely a preferred embodiment of this application and is not intended to limit the embodiments of this application. Various modifications and variations can be made to this application by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the principles of the embodiments of this application should be included within the protection scope of the embodiments of this application.

Claims

1. A method for migrating the storage space of a virtual machine, characterized in that, include: Given that all virtual machines in the first group of virtual machines have the same shared storage space, the virtual machine with the highest current running load in the first group of virtual machines is obtained, wherein the shared storage space of all virtual machines in the first group of virtual machines is the shared storage space of the first group. The services on each virtual machine in the second group of virtual machines are transferred to the first virtual machine for operation. The sharing permissions of the first group of shared storage space are modified to prohibit sharing by the first group of virtual machines, resulting in the first group of non-shared storage space. The first non-shared storage space of the first virtual machine and the first group of non-shared storage space are then migrated. The second group of virtual machines includes the virtual machines in the first group of virtual machines other than the first virtual machine. After migrating the first non-shared storage space and the first group of non-shared storage spaces is completed, migrate the non-shared storage space of each virtual machine in the second group of virtual machines; The migration of the first non-shared storage space and the first group of non-shared storage spaces of the first virtual machine includes: migrating the first non-shared storage space and the first group of non-shared storage spaces of the first virtual machine to the first storage space; The method further includes, after transferring the services on each virtual machine in the second group of virtual machines to the first virtual machine for operation, setting each virtual machine in the second group of virtual machines to cancel sharing the first group of shared storage space; The method further includes: after the migration of the first non-shared storage space and the first group of non-shared storage spaces is completed, modifying the sharing permission of the first group of non-shared storage spaces to allow sharing by the first group of virtual machines, thereby obtaining the second group of shared storage spaces; The migration of the non-shared storage space of each virtual machine in the second group of virtual machines includes: migrating the non-shared storage space of each virtual machine in the second group of virtual machines to the second storage space; and after completing the migration of the non-shared storage space of each virtual machine in the second group of virtual machines to the second storage space, setting each virtual machine in the second group of virtual machines to allow sharing the second group of shared storage space.

2. The method according to claim 1, characterized in that, Before obtaining the first virtual machine with the highest current running load in the first group of virtual machines, the method further includes: Obtain the shared storage information of each virtual machine in the first group of virtual machines to obtain N sets of shared storage information. The first group of virtual machines includes N virtual machines, where N is a positive integer greater than or equal to 2. Each set of shared storage information in the N sets includes the number of shared storage spaces of a corresponding virtual machine in the first group of virtual machines, the storage location identifier of the shared storage space, the storage path of the shared storage space, and the data name of the data stored in the shared storage space. Based on the N sets of shared storage information, determine whether each virtual machine in the first group of virtual machines has the same shared storage space.

3. The method according to claim 2, characterized in that, The step of determining whether each virtual machine in the first group of virtual machines has the same shared storage space based on the N sets of shared storage information includes: For the i-th virtual machine and the j-th virtual machine among the N virtual machines, determine whether the i-th virtual machine and the j-th virtual machine have the same shared storage space by performing the following operations, where i is a positive integer greater than or equal to 1 and less than or equal to N, and j is a positive integer greater than or equal to 1 and less than or equal to N: The number of shared storage spaces in the i-th shared storage space of the i-th virtual machine is obtained from the N sets of shared storage information, thus obtaining the i-th quantity; the storage location identifier of each shared storage space in the i-th shared storage space is obtained from the N sets of shared storage information, thus obtaining the i-th group of storage location identifiers; the storage path of each virtual storage space in the i-th shared storage space is obtained from the N sets of shared storage information, thus obtaining the i-th group of storage paths; the data name of the data stored in each shared storage space in the i-th shared storage space is obtained from the N sets of shared storage information, thus obtaining the i-th group of data names; The number of shared storage spaces in the j-th shared storage space of the j-th virtual machine is obtained from the N sets of shared storage information, thus obtaining the j-th quantity; the storage location identifier of each shared storage space in the j-th shared storage space is obtained from the N sets of shared storage information, thus obtaining the j-th group of storage location identifiers; the storage path of each virtual storage space in the j-th shared storage space is obtained from the N sets of shared storage information, thus obtaining the j-th group of storage paths; the data name of the data stored in each shared storage space in the j-th shared storage space is obtained from the N sets of shared storage information, thus obtaining the j-th group of data names; If the i-th quantity is the same as the j-th quantity, the i-th group storage location identifier is the same as the j-th group storage location identifier, the i-th group storage path is the same as the j-th group storage path, and the i-th group data name is the same as the j-th group data name, then the i-th virtual machine and the j-th virtual machine are determined to have the same shared storage space.

4. The method according to claim 1, characterized in that, After migrating the non-shared storage space of each virtual machine in the second group of virtual machines, the method further includes: Obtain updated storage information of the shared storage space of each virtual machine in the second group of virtual machines, wherein the updated storage information includes the first group storage name of the shared storage space of each virtual machine in the second group of virtual machines, the first group storage identifier of the shared storage space of each virtual machine in the second group of virtual machines, and the updated storage space set identifier of the updated storage space set corresponding to the shared storage space of each virtual machine in the second group of virtual machines, wherein the first group storage identifier is used to represent the storage identifier of the shared storage space of each virtual machine in the second group of virtual machines in the updated storage space set; The updated storage information and the initial storage information are compared. The initial storage information includes, before migrating the non-shared storage space of each virtual machine in the second group of virtual machines to the second storage space, the second group storage name of the shared storage space of each virtual machine in the second group of virtual machines, the second group storage identifier of the shared storage space of each virtual machine in the second group of virtual machines, and the initial storage space set identifier of the initial storage space set corresponding to the shared storage space of each virtual machine in the second group of virtual machines. The second group storage identifier is used to represent the storage identifier of the shared storage space of each virtual machine in the second group of virtual machines in the initial storage space set. If the first group of storage names is different from the second group of storage names, or the first group of storage identifiers is different from the second group of storage identifiers, or the initial storage space set identifier and the updated storage space set identifier are different, the updated storage information is adjusted.

5. The method according to claim 4, characterized in that, The adjustment of the updated storage information includes: If the first group of storage names is different from the second group of storage names, a third group of virtual machines is determined from the second group of virtual machines, wherein the storage name corresponding to the third group of virtual machines in the first group of storage names is different from the storage name corresponding to the second group of storage names; The storage identifier of the shared storage space of each virtual machine in the third group of virtual machines is obtained from the initial storage information to obtain the third group of storage identifiers. The third group of storage identifiers is used to represent the storage identifier of the shared storage space of each virtual machine in the third group of virtual machines in the storage space set corresponding to the shared storage space of each virtual machine in the third group of virtual machines. The target configuration file is run in each virtual machine in the third group of virtual machines to obtain a set of storage names, wherein the target configuration file is used to generate the storage name corresponding to the storage identifier of the virtual machine; Update the storage name corresponding to the storage identifier of the shared storage space of each virtual machine in the third group of virtual machines in the initial storage information using the aforementioned set of storage names.

6. A virtual machine migration device, characterized in that, The virtual machine migration apparatus is used to perform the steps of the method according to any one of claims 1 to 5, wherein the virtual machine migration apparatus comprises: The first acquisition module is used to acquire the first virtual machine with the highest current running load in the first group of virtual machines when all virtual machines in the first group of virtual machines have the same shared storage space, wherein the shared storage space of each virtual machine in the first group of virtual machines is the first group of shared storage space. The processing module is used to transfer the services on each virtual machine in the second group of virtual machines to the first virtual machine for operation, modify the sharing permission of the first group of shared storage space to prohibit it from being shared by the first group of virtual machines, obtain the first group of non-shared storage space, and migrate the first non-shared storage space of the first virtual machine and the first group of non-shared storage space. The second group of virtual machines includes virtual machines in the first group of virtual machines other than the first virtual machine. The migration module is used to migrate the non-shared storage space of each virtual machine in the second group of virtual machines after the migration of the first non-shared storage space and the first group of non-shared storage spaces has been completed.

7. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program, wherein the computer program, when executed by a processor, implements the steps of the method described in any one of claims 1 to 5.

8. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the steps of the method described in any one of claims 1 to 5.