Virtual machine management methods, apparatus, media, devices and computer program products
By acquiring virtual machine topology information and grouping them into fault domains, and selecting candidate virtual machines from different groups as new master virtual machines, the cluster availability problem caused by virtual machine fault domain anomalies is solved, and the disaster recovery capability and service stability of virtual machine deployment are improved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-08-01
- Publication Date
- 2026-03-06
AI Technical Summary
Because the big data engine cannot perceive the underlying resource status of virtual machines, when a fault domain fails, multiple virtual machines may simultaneously malfunction, affecting the availability of the cluster.
By obtaining the topology information of the virtual machines, their corresponding fault domain information is determined, and the virtual machines are grouped based on this. Candidate virtual machines belonging to different groups are selected as new master virtual machines to avoid the updated master virtual machines being abnormal in the same fault domain.
The availability of the updated master virtual machine has been improved, ensuring high availability of the target service and disaster recovery capabilities for the virtual machine deployment.
Smart Images

Figure CN120950182B_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to the field of computer technology, and more specifically, to a virtual machine management method, apparatus, medium, device, and computer program product. Background Technology
[0002] With the rapid development of cloud computing and big data technologies, more and more big data platforms are migrating to the cloud. Big data engines typically employ multi-replica deployment to enhance fault tolerance. However, due to the deployment limitations of virtual machines, virtual machines exist as fault domains. A fault domain represents a location in a distributed system where a group of related hardware or software is concentrated; this location can be a region, availability zone, rack, host machine, etc. Within the same fault domain, the same resources, network connections, or other components are usually shared.
[0003] Since the big data engine itself cannot perceive the underlying resource status of virtual machine deployments, when a fault domain fails, multiple virtual machines in that fault domain may simultaneously malfunction, severely impacting the availability of the cluster. Summary of the Invention
[0004] This summary section is provided to briefly introduce the concepts, which will be described in detail in the detailed description section below. This summary section is not intended to identify key or essential features of the claimed technical solution, nor is it intended to limit the scope of the claimed technical solution.
[0005] In a first aspect, this disclosure provides a virtual machine management method, the method comprising:
[0006] Obtain topology information for multiple virtual machines;
[0007] Based on the topology information, the fault domain information corresponding to the virtual machine is determined;
[0008] Based on the fault domain information, the virtual machines are grouped to obtain multiple virtual machine groups, wherein virtual machines in the same virtual machine group correspond to the same fault domain information.
[0009] In response to determining that the main virtual machine corresponding to the target service is abnormal, a candidate virtual machine is determined from multiple virtual machines corresponding to the target service based on the virtual machine group to which the main virtual machine belongs, wherein the main virtual machine is one of the multiple virtual machines corresponding to the target service, and the candidate virtual machine and the main virtual machine belong to different virtual machine groups;
[0010] The updated master virtual machine corresponding to the target service is determined from the candidate virtual machines.
[0011] Secondly, this disclosure provides a virtual machine management device, the device comprising:
[0012] The acquisition module is used to obtain the topology information of multiple virtual machines;
[0013] The first determining module is used to determine the fault domain information corresponding to the virtual machine based on the topology information;
[0014] The grouping module is used to group the virtual machines based on the fault domain information to obtain multiple virtual machine groups, wherein virtual machines in the same virtual machine group correspond to the same fault domain information.
[0015] The second determining module is used to determine a candidate virtual machine from multiple virtual machines corresponding to the target service in response to an anomaly in the determination of the main virtual machine corresponding to the target service, based on the virtual machine group to which the main virtual machine belongs, wherein the main virtual machine is one of the multiple virtual machines corresponding to the target service, and the candidate virtual machine and the main virtual machine belong to different virtual machine groups;
[0016] The third determining module is used to determine the updated main virtual machine corresponding to the target service from the candidate virtual machines.
[0017] Thirdly, this disclosure provides a computer-readable medium having a computer program stored thereon, which, when executed by a processing device, implements the steps of the method described in the first aspect.
[0018] Fourthly, this disclosure provides an electronic device, comprising:
[0019] A storage device on which computer programs are stored;
[0020] A processing device for executing the computer program in the storage device to implement the steps of the method described in the first aspect.
[0021] Fifthly, this disclosure provides a computer program product, including a computer program that, when executed by a processor, implements the steps of the method described in the first aspect.
[0022] The above technical solution allows virtual machines to be grouped based on their topology information and fault domain information. This enables the selection of a new primary virtual machine from among those outside the primary virtual machine's group when the primary virtual machine fails. This avoids situations where the updated primary virtual machine is in the same fault domain as the previous one and also fails, thus improving the availability of the updated primary virtual machine to a certain extent. This ensures the high availability of the target service and enhances the disaster recovery capability of the virtual machine deployment for the target service.
[0023] Other features and advantages of this disclosure will be described in detail in the following detailed description section. Attached Figure Description
[0024] The above and other features, advantages, and aspects of the embodiments of this disclosure will become more apparent from the accompanying drawings and the following detailed description. Throughout the drawings, the same or similar reference numerals denote the same or similar elements. It should be understood that the drawings are schematic, and the originals and elements are not necessarily drawn to scale. In the drawings:
[0025] Figure 1 This is a flowchart of a virtual machine management method provided according to an embodiment of the present disclosure.
[0026] Figure 2 This is a virtual machine management system architecture diagram based on the embodiments of this disclosure.
[0027] Figure 3 This is a schematic diagram illustrating the state update of a virtual machine group based on an embodiment of the present disclosure.
[0028] Figure 4 This is a block diagram of a virtual machine management apparatus provided according to embodiments of the present disclosure.
[0029] Figure 5 A schematic diagram of the structure of an electronic device suitable for implementing embodiments of the present disclosure is shown. Detailed Implementation
[0030] Embodiments of this disclosure will now be described in more detail with reference to the accompanying drawings. While some embodiments of this disclosure are shown in the drawings, it should be understood that this disclosure can be implemented in various forms and should not be construed as limited to the embodiments set forth herein. Rather, these embodiments are provided to provide a more thorough and complete understanding of this disclosure. It should be understood that the accompanying drawings and embodiments of this disclosure are for illustrative purposes only and are not intended to limit the scope of protection of this disclosure.
[0031] It should be understood that the steps described in the method embodiments of this disclosure may be performed in different orders and / or in parallel. Furthermore, the method embodiments may include additional steps and / or omit the steps shown. The scope of this disclosure is not limited in this respect.
[0032] The term "comprising" and its variations as used herein are open-ended inclusions, meaning "including but not limited to". The term "based on" means "at least partially based on". The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one additional embodiment"; the term "some embodiments" means "at least some embodiments". Definitions of other terms will be given in the description below.
[0033] It should be noted that the concepts of "first" and "second" mentioned in this disclosure are used only to distinguish different devices, modules or units, and are not used to limit the order of functions performed by these devices, modules or units or their interdependencies.
[0034] It should be noted that the terms "a" and "a plurality of" used in this disclosure are illustrative rather than restrictive, and those skilled in the art should understand that, unless otherwise expressly indicated in the context, they should be understood as "one or more".
[0035] The names of messages or information exchanged between multiple devices in the embodiments of this disclosure are for illustrative purposes only and are not intended to limit the scope of such messages or information.
[0036] It is understood that before using the technical solutions disclosed in the various embodiments of this disclosure, users should be informed of the types, scope of use, and usage scenarios of the personal information involved in this disclosure in an appropriate manner in accordance with relevant laws and regulations, and user authorization should be obtained.
[0037] For example, upon receiving a user's active request, a prompt message is sent to the user to explicitly inform them that the requested operation will require the acquisition and use of the user's personal information. This allows the user to independently choose whether to provide personal information to the software or hardware, such as the electronic device, application, server, or storage medium performing the operations of this disclosed technical solution, based on the prompt message.
[0038] As an optional but non-limiting implementation, in response to a user's active request, sending a prompt message to the user can be done via a pop-up window, where the prompt message can be presented in text format. Furthermore, the pop-up window can also include a selection control allowing the user to choose "agree" or "disagree" to provide personal information to the electronic device.
[0039] It is understood that the above notification and user authorization process are merely illustrative and do not constitute a limitation on the implementation of this disclosure. Other methods that comply with relevant laws and regulations may also be applied to the implementation of this disclosure.
[0040] Meanwhile, it is understood that the data involved in this technical solution (including but not limited to the data itself, the acquisition or use of the data) shall comply with the requirements of relevant laws, regulations and related provisions.
[0041] Figure 1 The diagram shown is a flowchart of a virtual machine management method provided according to an embodiment of this disclosure. Figure 1 As shown, the method includes:
[0042] In step 11, the topology information of multiple virtual machines is obtained.
[0043] In a cloud-native environment, where the engine cannot perceive the fault domains of virtual machines, this embodiment can obtain the topology information of the virtual machines to determine the corresponding fault domain information. This topology information can be reported by each virtual machine at startup; to improve the availability of the topology information, the virtual machines can report it at preset intervals. As an example, this disclosed method can be applied to a virtual machine topology service, which can be deployed in Kubernetes (K8S).
[0044] In some embodiments, the topology information includes multi-level information about the virtual machine deployment, such as the node identifier (node_id), the node's Internet Protocol (IP) identifier, the host identifier (host_id), the rack identifier (rack_id), the availability zone identifier (az_id), and the region identifier (region_id) corresponding to the virtual machine. Based on this topology information, the location of the virtual machine deployment can be determined. As another example, the topology information may also include a health status (health_state) to indicate whether the virtual machine is available.
[0045] In some embodiments, a virtual machine agent is deployed on each virtual machine. The virtual machine agent is used to obtain the topology information of the virtual machine and report it to the distributed coordination service. The topology information is stored under the temporary node of the distributed coordination service.
[0046] like Figure 2 The diagram shown illustrates a virtual machine management system architecture based on an embodiment of this disclosure. This virtual machine management system may include virtual machine agents and a virtual machine topology service. The distributed coordination service may be ZooKeeper. A rack may contain one or more host machines, and a host machine may contain one or more virtual machines. Virtual machine agents deployed in virtual machines 1-n can obtain their topology information and report it to ZooKeeper to register the virtual machine when it starts up. As an example, the topology information may also include the identifier `vmta_id` of the virtual machine agent deployed in that virtual machine, whose value is the agent ID corresponding to the virtual machine agent. Clients can send service requests to the virtual machine topology service for scheduling and response.
[0047] The information structure stored in ZooKeeper is as follows: / faultArea is a persistent node, and / faultArea / node_id under it is an ephemeral node. Topology information can be stored in the ephemeral node so that when the ZooKeeper client session fails, the ephemeral node can be automatically destroyed, realizing the automatic update of the virtual machine's topology information.
[0048] For example, the storage of topology information is shown below:
[0049] / faultArea
[0050] / node_id
[0051] "vmta_id=XX1,ip=XX2,host_id=XX3,rack_id=XX4,az_id=XX5,region_id=XX6,health_state=XX7"
[0052] Accordingly, obtaining the topology information of multiple virtual machines may include:
[0053] The topology information is obtained from the distributed coordination service.
[0054] For example, topology information stored in the distributed coordination service can be obtained through communication between the virtual machine topology service and the distributed coordination service. Thus, the virtual machine's topology information can be automatically reported to the distributed coordination service via the virtual machine agent, and stored under the temporary nodes of the distributed coordination service. This allows the virtual machine's topology information to be automatically destroyed in the event of a virtual machine failure, thereby ensuring the accuracy and validity of the topology information obtained from the distributed coordination service, reducing the complexity of topology information management and storage, and providing accurate data support for subsequent virtual machine management.
[0055] As an example, regions, availability zones, racks, hosts, and virtual machine nodes can be predefined. For instance, the data structure of a region can include a region identifier, a list of availability zones under that region, and their health status; the data structure of an availability zone can include an availability zone identifier, the region identifier to which that availability zone belongs, a list of racks under that availability zone, and their health status; the data structure of a rack can include a rack identifier, the availability zone identifier to which that rack belongs, the region identifier to which that rack belongs, a list of hosts under that rack, and their health status; the data structure of a host can include a host identifier, the rack identifier to which that host belongs, the availability zone identifier to which that host belongs, the region identifier to which that host belongs, a list of virtual machines under that host, and their health status; and the data structure of a virtual machine can include a virtual machine identifier, the host identifier to which that virtual machine belongs, the rack identifier to which that virtual machine belongs, the availability zone identifier to which that virtual machine belongs, the region identifier to which that virtual machine belongs, and its health status.
[0056] In step 12, the fault domain information corresponding to the virtual machine is determined based on the topology information.
[0057] The topology information records the deployment location of the virtual machine, and its fault domain information can be determined based on this topology information.
[0058] In step 13, virtual machines are grouped based on fault domain information to obtain multiple virtual machine groups. Virtual machines in the same virtual machine group correspond to the same fault domain information, that is, virtual machines in the same virtual machine group are in the same fault domain.
[0059] One approach is to group virtual machines based on the identifier of their corresponding fault domain information. This allows virtual machines with the same fault domain information to be grouped into the same virtual machine group. For example, if the fault domain information is a rack identifier, virtual machines with the same rack identifier can be grouped into the same group. Similarly, if the fault domain information is a region identifier, virtual machines with the same region identifier can be grouped into the same group.
[0060] In step 14, in response to determining that the main virtual machine corresponding to the target service is abnormal, a candidate virtual machine is determined from multiple virtual machines corresponding to the target service based on the virtual machine group to which the main virtual machine belongs. The main virtual machine is one of the multiple virtual machines corresponding to the target service, and the candidate virtual machine and the main virtual machine belong to different virtual machine groups.
[0061] In step 15, the updated master virtual machine corresponding to the target service is determined from the candidate virtual machines.
[0062] To ensure high availability, big data engines (such as Hadoop, Kafka, and Zookeeper) typically consist of clusters of multiple virtual machines. A leader virtual machine centrally schedules resources (such as data sharding and task allocation) to prevent data inconsistencies caused by concurrent operations across multiple nodes. When the leader virtual machine fails (e.g., a malfunction occurs), the cluster automatically elects a new leader to ensure continued service availability.
[0063] The target service can be any service deployed on a virtual machine. When the primary virtual machine in the cluster of the target service is determined to be faulty, a new primary virtual machine is selected to provide the target service. As shown in the background art, when a fault domain fails, multiple virtual machines in that fault domain may simultaneously fail. In this embodiment, to ensure the normal service of the updated primary virtual machine, candidate virtual machines can be screened to select virtual machines belonging to different virtual machine groups than the primary virtual machine.
[0064] After the candidate virtual machines are determined, one can be randomly selected as the updated master virtual machine, or the selection can be made from the candidate virtual machines based on the election mechanism commonly used in the art. This disclosure does not limit this to either method.
[0065] Therefore, through the above technical solution, virtual machines can be grouped based on their topology information and fault domain information. This allows for the selection of a new primary virtual machine from among those outside the primary virtual machine group when the primary virtual machine of a service fails. This avoids situations where the updated primary virtual machine is in the same fault domain as the previous primary virtual machine and also fails, thereby improving the availability of the updated primary virtual machine to a certain extent. This ensures the high availability of the target service and enhances the disaster recovery capability of the virtual machine deployment for the target service.
[0066] In some possible embodiments, the topology information includes the identifier of the virtual machine in multiple fault domain ranges. As shown above, the topology information may include the host machine representation, rack identifier, availability zone identifier, region identifier, etc., corresponding to the virtual machine, with the corresponding fault domain ranges increasing sequentially.
[0067] Accordingly, determining the fault domain information corresponding to the virtual machine based on the topology information may include:
[0068] Obtain the target fault domain range, wherein the target fault domain range can be pre-configured based on the actual application scenario, and this disclosure does not limit it.
[0069] Then, the identifier in the topology information that corresponds to the target fault domain range is used as the fault domain information.
[0070] For example, if the host machine is used as the target fault domain, then the fault domain information of the virtual machine is the host machine identifier corresponding to that virtual machine. Similarly, if the rack is used as the target fault domain, then the fault domain information of the virtual machine is the rack identifier corresponding to that virtual machine. Likewise, if the availability zone is used as the target fault domain, then the fault domain information of the virtual machine is the availability zone identifier corresponding to that virtual machine. Finally, if the region is used as the target fault domain, then the fault domain information of the virtual machine is the region identifier corresponding to that virtual machine.
[0071] Therefore, by using the above technical solution, fault domain information can be determined by setting the fault domain range, thereby realizing the identification of the fault domain of the virtual machine and providing effective data support for selecting a new master virtual machine in the subsequent cluster.
[0072] In some possible embodiments, determining candidate virtual machines from multiple virtual machines corresponding to the target service based on the virtual machine group to which the primary virtual machine belongs may include:
[0073] Determine whether to select the candidate virtual machine based on fault domain information.
[0074] Specifically, it can determine whether to select candidate virtual machines based on fault domain information based on the user's configuration actions. For example, a switch control can be displayed in the configuration interface. If the user wants to select candidate virtual machines based on fault domain information, they can select "on"; if the user does not want to select candidate virtual machines based on fault domain information, they can select "off". Thus, it can be determined whether to select candidate virtual machines based on fault domain information based on configuration actions.
[0075] When the candidate virtual machines are determined based on fault domain information, the virtual machines other than the fault domain virtual machines corresponding to the main virtual machine among the multiple virtual machines corresponding to the target service are selected as the candidate virtual machines. The fault domain virtual machines corresponding to the main virtual machine are virtual machines that belong to the same virtual machine group as the main virtual machine.
[0076] As an example, the topology information of the primary virtual machine can be obtained, and its fault domain information can be determined from the target fault domain range to identify the virtual machine group to which it belongs. As another example, after identifying the virtual machine group, a fault domain label can be added to each virtual machine under the virtual machine group. This fault domain label represents the fault domain information corresponding to the virtual machine group. For example, based on Doris's Resource Group feature, the same fault domain label can be added to virtual machines under the same virtual machine group. In this embodiment, the fault domain label of the primary virtual machine can be directly obtained to determine its virtual machine group.
[0077] If the target service corresponds to multiple virtual machines including virtual machines V1-VN, the fault domain information corresponding to each of the N virtual machines can be determined. If the primary virtual machine is V1, its virtual machine group is G1, and V2-V4 also belong to the virtual machine group G1, then V5-VN can be used as candidate virtual machines to avoid selecting a new primary virtual machine from the virtual machine group G1.
[0078] If it is determined that the candidate virtual machines are not selected based on fault domain information, then the virtual machines in the target service other than the primary virtual machine are selected as candidate virtual machines. In this embodiment, if the primary virtual machine is V1, then V2-VN can be selected as candidate virtual machines.
[0079] Therefore, the above technical solution can introduce fault domain information during the update process of the master virtual machine in the cluster, so as to determine whether to select the master virtual machine based on the fault domain information according to the user's needs. In this way, virtual machines in the same virtual machine group as the current master virtual machine can be excluded during the selection of a new master virtual machine, ensuring the availability of candidate virtual machines and thus ensuring the stable operation of the target service.
[0080] In some possible embodiments, the method further includes:
[0081] Determine a fault score for each virtual machine group. The fault score indicates the likelihood of the virtual machine group exhibiting anomalies; a higher fault score indicates a greater likelihood of the virtual machine group exhibiting anomalies.
[0082] As an example, the type of fault score for a virtual machine group can be preset. For instance, when the fault domain information corresponding to the virtual machine is limited to the host machine, the fault score of the virtual machine group includes the virtual machine failure rate score under that virtual machine group.
[0083] As an example, a heartbeat detection algorithm can be used to determine if a virtual machine is abnormal. This can be achieved by sending heartbeat packets, which are small data packets or messages sent periodically over the connection to verify its liveness. If the virtual machine responds to the heartbeat, it is considered normal; if it does not respond, it is considered abnormal. The ratio of the number of abnormal virtual machines in a virtual machine group to the total number of virtual machines in that group can be used as the abnormality rate. If the abnormality rate is greater than a threshold, the abnormality rate score is 1; if it is not greater than the threshold, the score is 0.
[0084] As another example, when the scope of the fault domain information corresponding to the virtual machine is rack, availability zone or region, the fault score of the virtual machine group includes at least one of the virtual machine failure rate score under the virtual machine group, the gateway connectivity score of the virtual machine group and the switch port status score of the virtual machine group.
[0085] For example, the gateway connectivity of virtual machine packets can be determined using ICMP (Internet Control Message Protocol) detection. A retrieval count and timeout period can be set. If the virtual machine's IP address can be pinged once within the specified retrieval count and timeout period, the gateway connectivity is considered to be available, with a score of 0; otherwise, the gateway connectivity is considered to be unavailable, with a score of 1.
[0086] The status of a switch port can be determined using the Simple Network Management Protocol (SNMP). For example, by querying using the SNMP protocol, if the switch port is down, its corresponding score is 1; otherwise, the score is 0, thus obtaining the switch port status score of the virtual machine group.
[0087] If the fault score contains a single score, that score can be directly used as the fault score. If the fault score contains multiple scores, the multiple scores can be summed with weights to obtain the fault score. The weights of different scores can be preset based on the actual application scenario, and this disclosure does not impose any restrictions on this.
[0088] Subsequently, based on the current status information of the virtual machine group and the fault score, it is determined whether to update the status information of the virtual machine group, and the updated status information is determined when it is determined to update.
[0089] If it is determined that the status information of the virtual machine group needs to be updated, the operation of the virtual machines under the virtual machine group is controlled based on the update information corresponding to the status information of the virtual machine group.
[0090] As an example, when switching between different state information based on actual application scenarios, control operations can be performed on virtual machines under a virtual machine group, thereby achieving control over the virtual machines. Therefore, through the above technical solution, the state information of virtual machine groups can be switched, and control of virtual machines can be achieved based on the switched information, improving the accuracy of virtual machine management.
[0091] In some possible implementations, the presence of anomalies in the virtual machine group can be determined using current status information and fault scores.
[0092] As an example, determining whether to update the status information of the virtual machine group based on the current status information of the virtual machine group and the fault score may include:
[0093] If the current status information of the virtual machine group is normal and the fault score is greater than the first threshold, then it is determined to update the status information of the virtual machine group, and the updated status information is in a pending state.
[0094] like Figure 3 The above is a schematic diagram of the status update of a virtual machine group. As an example, the first threshold can be set based on the actual application scenario. For example, it can be set to 0.5. In the initial state, the current status information of the virtual machine group is in a normal state. If its fault score exceeds 0.5, it can be switched from the normal state to the pending state, as shown in L1.
[0095] If the current status information of the virtual machine group is normal and the fault score is greater than the second threshold, then it is determined that the status information of the virtual machine group should be updated, and the updated status information is abnormal, wherein the second threshold is greater than the first threshold.
[0096] The second threshold can be set based on the actual application scenario. For example, if the second threshold is set to 0.7, the current status information of the virtual machine group is in the normal state, and the fault score is greater than 0.7, that is, when the fault score is too large, it can be directly switched from the normal state to the abnormal state, as shown in L2.
[0097] If the current status information of the virtual machine group is the pending state, and the fault score is greater than the second threshold, then it is determined to update the status information of the virtual machine group, and the updated status information is an abnormal state.
[0098] Accordingly, when the current status information of the virtual machine group is the pending state, its fault score can be continuously detected. When its fault score is greater than 0.7, the abnormal condition is met, and it can be switched from the pending state to the abnormal state, as shown in L3.
[0099] Therefore, through the above technical solution, the status information of virtual machine groups can be automatically switched by detecting fault scores, thereby realizing automatic identification of fault domain anomalies and ensuring the accuracy of virtual machine management.
[0100] In some possible embodiments, controlling the operation of virtual machines under the virtual machine group based on the update information corresponding to the state information of the virtual machine group may include:
[0101] If the update information corresponding to the status information of the virtual machine group indicates that the status has been updated from the normal state to the pending state, then the virtual machines under the virtual machine group are controlled to stop writing operations.
[0102] like Figure 3 The status update information shown in L1 indicates that the virtual machine group is at risk of anomaly. At this time, the virtual machines under the virtual machine group can be controlled to stop write operations while retaining other operations to avoid affecting existing data.
[0103] If the update information corresponding to the status information of the virtual machine group indicates that the pending state has been updated to the abnormal state, then the virtual machines under the virtual machine group are controlled to stop reading operations and load balancing operations.
[0104] like Figure 3 The status update information shown in L3 indicates that the virtual machine group has been updated from the pending state to the abnormal state. This means that the virtual machine group is definitely abnormal. At this time, the virtual machines under the virtual machine group can be controlled to stop reading operations and load balancing operations. Since the virtual machines have been controlled to stop writing operations in the pending state, in this embodiment, the virtual machines under the virtual machine group are controlled not to provide services to avoid risks to the operation of the target service.
[0105] If the update information corresponding to the status information of the virtual machine group indicates that the status has been updated from the normal status to the abnormal status, then the virtual machines under the virtual machine group are controlled to stop write operations, read operations and load balancing operations.
[0106] like Figure 3 The status update information shown in L2 indicates that the virtual machine group has been updated from the normal state to the abnormal state. This means that the virtual machine group is determined to be abnormal. At this time, the virtual machines under the virtual machine group can be controlled to stop write operations, read operations and load balancing operations, that is, the virtual machines under the virtual machine group are controlled not to provide services, so as to avoid risks to the operation of the target service.
[0107] Therefore, by using the above technical solution, different controls can be applied to virtual machines under a virtual machine group based on the update information corresponding to the status information of the virtual machine group, thereby improving the accuracy and real-time performance of virtual machine control and ensuring the stable operation of the target service.
[0108] In some possible embodiments, it can be determined whether the virtual machine group has recovered from an abnormal or pending state to a normal state based on the current state information and the fault score. Accordingly, determining whether to update the state information of the virtual machine group based on its current state information and the fault score may further include:
[0109] If the current status information of the virtual machine group is the abnormal state, and the fault score is less than the first threshold, then it is determined to update the status information of the virtual machine group, and the updated status information is the pending state.
[0110] When the current status information of a virtual machine group is in an abnormal state, it can be determined whether the virtual machine group can recover its state by continuously detecting the fault score. For example, when the fault score is less than the first threshold, it indicates that the fault score has decreased, and the service provision status of the virtual machine group may have recovered. In this scenario, it can be determined to update the status information of the virtual machine group, and the updated status information is the pending state, that is, the status information of the virtual machine group is updated from the abnormal state to the pending state, as shown in L4.
[0111] If the current status information of the virtual machine group is the pending state, and the fault score is less than the first threshold and the duration of the virtual machine group in the pending state exceeds a preset duration, then it is determined to update the status information of the virtual machine group, and the updated status information is the normal state.
[0112] When the current status information of a virtual machine group is in a pending state, it can also be determined whether the virtual machine group can recover its state by continuously detecting the fault score. For example, if the fault score is less than the first threshold and the virtual machine group has been in the pending state for more than a preset time, it means that the fault score is less than the first threshold for a certain period of time, that is, the fault score remains stable and small. At this time, it can be considered that the virtual machine group can provide services normally. In this scenario, it can be determined to update the status information of the virtual machine group. The updated status information is the normal state, that is, the status information of the virtual machine group is updated from the pending state to the normal state, as shown in L5.
[0113] Therefore, by using the above technical solution, when a virtual machine group is not in a normal state, it is possible to determine whether to restore the status information of the virtual machine group by continuously detecting the fault score. This enables automatic recovery of virtual machine group anomalies, ensures effective management of virtual machines under the virtual machine group, provides more node support for the operation of the target service, and improves the high availability of the target service to a certain extent.
[0114] In some possible embodiments, controlling the operation of virtual machines under the virtual machine group based on the update information corresponding to the state information of the virtual machine group may include:
[0115] If the update information corresponding to the status information of the virtual machine group indicates that the abnormal state has been updated to the pending state, then the virtual machines under the virtual machine group are controlled to start a read operation.
[0116] like Figure 3 The status update information shown in L4 indicates that the abnormal state has been updated to the pending state, which means that the abnormality of the virtual machine group may have been recovered. At this time, the virtual machines under the virtual machine group can be controlled to start read operations to increase the number of virtual machines that can be scheduled under read operations, thereby improving the efficiency of read operations in the target service and ensuring the scheduling efficiency and response efficiency of the target service.
[0117] If the update information corresponding to the status information of the virtual machine group indicates that the pending state has been updated to the normal state, then the virtual machines under the virtual machine group are controlled to start write operations and load balancing operations.
[0118] like Figure 3 The status update information shown in L5 indicates that the virtual machine group is not abnormal at this time. At this time, the virtual machines under the virtual machine group can be controlled to start write operations and load balancing operations, that is, to control the virtual machines under the virtual machine group to provide services normally, so that the virtual machines under the virtual machine group can be called to respond to the target service.
[0119] Therefore, through the above technical solution, different controls can be applied to virtual machines under a virtual machine group based on the update information corresponding to the status information of the virtual machine group, so as to realize the automatic update of the status recovery of the virtual machine group, improve the accuracy and real-time performance of virtual machine control, and thus ensure the stable operation of the target service.
[0120] Based on the same inventive concept, this disclosure also provides a virtual machine management device, such as... Figure 4 As shown, the device 10 includes:
[0121] Module 100 is used to obtain the topology information of multiple virtual machines;
[0122] The first determining module 200 is used to determine the fault domain information corresponding to the virtual machine based on the topology information;
[0123] The grouping module 300 is used to group the virtual machines based on the fault domain information to obtain multiple virtual machine groups, wherein virtual machines in the same virtual machine group correspond to the same fault domain information.
[0124] The second determining module 400 is configured to, in response to an anomaly in the determination of the main virtual machine corresponding to the target service, determine a candidate virtual machine from multiple virtual machines corresponding to the target service based on the virtual machine group to which the main virtual machine belongs, wherein the main virtual machine is one of the multiple virtual machines corresponding to the target service, and the candidate virtual machine and the main virtual machine belong to different virtual machine groups;
[0125] The third determining module 500 is used to determine the updated main virtual machine corresponding to the target service from the candidate virtual machines.
[0126] Optionally, the topology information includes the identifier of the virtual machine in multiple fault domains;
[0127] The first determining module includes:
[0128] The acquisition submodule is used to acquire the target fault domain range;
[0129] The first determining submodule is used to take the identifier in the topology information that corresponds to the target fault domain range as the fault domain information.
[0130] Optionally, the second determining module includes:
[0131] The second determining submodule is used to determine whether to determine the candidate virtual machine based on fault domain information;
[0132] The third determining submodule is used to, when determining the candidate virtual machines based on fault domain information, select virtual machines other than the fault domain virtual machines corresponding to the main virtual machine from among the multiple virtual machines corresponding to the target service, wherein the fault domain virtual machines corresponding to the main virtual machine are virtual machines belonging to the same virtual machine group as the main virtual machine.
[0133] Optionally, the device further includes:
[0134] The fourth determining module is used to determine the fault score of each virtual machine group;
[0135] The fifth determining module is used to determine whether to update the status information of the virtual machine group based on the current status information of the virtual machine group and the fault score;
[0136] The control module is used to control the operation of virtual machines under the virtual machine group based on the update information corresponding to the status information of the virtual machine group when it is determined that the status information of the virtual machine group needs to be updated.
[0137] Optionally, when the range of the fault domain information corresponding to the virtual machine is the host machine, the fault score of the virtual machine group includes the virtual machine failure rate score under the virtual machine group;
[0138] When the fault domain information corresponding to the virtual machine is within a rack, availability zone, or region, the fault score of the virtual machine group includes at least one of the virtual machine failure rate score, the gateway connectivity score, and the switch port status score of the virtual machine group.
[0139] Optionally, the fifth determining module includes:
[0140] The fourth determining submodule is used to determine to update the status information of the virtual machine group if the current status information of the virtual machine group is in a normal state and the fault score is greater than the first threshold. The updated status information is then set to a pending state.
[0141] The fifth determining submodule is used to determine that if the current status information of the virtual machine group is in a normal state and the fault score is greater than the second threshold, the status information of the virtual machine group is updated and the updated status information is in an abnormal state, wherein the second threshold is greater than the first threshold.
[0142] The sixth determining submodule is used to determine to update the status information of the virtual machine group if the current status information of the virtual machine group is the pending state and the fault score is greater than the second threshold. The updated status information is an abnormal state.
[0143] Optionally, the control module includes:
[0144] The first control submodule is used to control the virtual machines under the virtual machine group to stop writing operations if the update information corresponding to the status information of the virtual machine group indicates that the status has been updated from the normal state to the pending state.
[0145] The second control submodule is used to control the virtual machines under the virtual machine group to stop reading operations and load balancing operations if the update information corresponding to the status information of the virtual machine group indicates that the status has been updated from the pending state to the abnormal state.
[0146] The third control submodule is used to control the virtual machines under the virtual machine group to stop write operations, read operations, and load balancing operations if the update information corresponding to the status information of the virtual machine group indicates that the status has been updated from the normal state to the abnormal state.
[0147] Optionally, the fifth determining module further includes:
[0148] The seventh determining submodule is used to determine to update the status information of the virtual machine group if the current status information of the virtual machine group is the abnormal state and the fault score is less than the first threshold, and the updated status information is the pending state.
[0149] The eighth determining submodule is used to determine to update the status information of the virtual machine group if the current status information of the virtual machine group is the pending state, the fault score is less than the first threshold, and the duration of the virtual machine group in the pending state exceeds a preset duration. The updated status information is the normal state.
[0150] Optionally, the control module includes:
[0151] The fourth control submodule is used to control the virtual machines under the virtual machine group to start a read operation if the update information corresponding to the status information of the virtual machine group indicates that the abnormal state has been updated to the pending state.
[0152] The fifth control submodule is used to control the virtual machines under the virtual machine group to start write operations and load balancing operations if the update information corresponding to the status information of the virtual machine group indicates that the status has been updated from the pending state to the normal state.
[0153] Optionally, a virtual machine agent is deployed on each of the virtual machines. The virtual machine agent is used to obtain the topology information of the virtual machine and report it to the distributed coordination service. The topology information is stored under the temporary node of the distributed coordination service.
[0154] The acquisition module is used for:
[0155] The topology information is obtained from the distributed coordination service.
[0156] The following is for reference. Figure 5 The diagram illustrates a structural schematic of an electronic device (e.g., a terminal device or a server) 600 suitable for implementing embodiments of the present disclosure. The terminal device in the embodiments of the present disclosure may include, but is not limited to, mobile terminals such as mobile phones, laptops, digital broadcast receivers, PDAs (personal digital assistants), PADs (tablet computers), PMPs (portable multimedia players), in-vehicle terminals (e.g., in-vehicle navigation terminals), and fixed terminals such as digital TVs and desktop computers. Figure 5 The electronic device shown is merely an example and should not be construed as limiting the functionality and scope of the embodiments disclosed herein.
[0157] like Figure 5 As shown, electronic device 600 may include a processing device (e.g., a central processing unit, a graphics processor, etc.) 601, which can perform various appropriate actions and processes according to a program stored in read-only memory (ROM) 602 or a program loaded from storage device 608 into random access memory (RAM) 603. RAM 603 also stores various programs and data required for the operation of electronic device 600. Processing device 601, ROM 602, and RAM 603 are interconnected via bus 604. Input / output (I / O) interface 605 is also connected to bus 604.
[0158] Typically, the following devices can be connected to I / O interface 605: input devices 606 including, for example, touchscreens, touchpads, keyboards, mice, cameras, microphones, accelerometers, gyroscopes, etc.; output devices 607 including, for example, liquid crystal displays (LCDs), speakers, vibrators, etc.; storage devices 608 including, for example, magnetic tapes, hard disks, etc.; and communication devices 609. Communication device 609 allows electronic device 600 to communicate wirelessly or wiredly with other devices to exchange data. Although Figure 5 An electronic device 600 with various devices is shown; however, it should be understood that it is not required to implement or possess all of the devices shown. More or fewer devices may be implemented or possessed alternatively.
[0159] In particular, according to embodiments of this disclosure, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments of this disclosure include a computer program product comprising a computer program carried on a non-transitory computer-readable medium, the computer program containing program code for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via a communication device 609, or installed from a storage device 608, or installed from a ROM 602. When the computer program is executed by the processing device 601, it performs the functions defined in the methods of embodiments of this disclosure.
[0160] It should be noted that the computer-readable medium described in this disclosure can be a computer-readable signal medium or a computer-readable storage medium, or any combination thereof. A computer-readable storage medium can be, for example,—but not limited to—an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of a computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination thereof. In this disclosure, a computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, apparatus, or device. In this disclosure, a computer-readable signal medium can include a data signal propagated in baseband or as part of a carrier wave, carrying computer-readable program code. Such propagated data signals can take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. A computer-readable signal medium can be any computer-readable medium other than a computer-readable storage medium, which can send, propagate, or transmit a program for use by or in connection with an instruction execution system, apparatus, or device. The program code contained on the computer-readable medium can be transmitted using any suitable medium, including but not limited to: wires, optical fibers, RF (radio frequency), etc., or any suitable combination thereof.
[0161] In some implementations, clients and servers can communicate using any currently known or future-developed network protocol such as HTTP (Hypertext Transfer Protocol) and can interconnect with digital data communication (e.g., communication networks) of any form or medium. Examples of communication networks include local area networks (“LANs”), wide area networks (“WANs”), the Internet (e.g., the Internet of Things), and peer-to-peer networks (e.g., ad hoc peer-to-peer networks), as well as any currently known or future-developed networks.
[0162] The aforementioned computer-readable medium may be included in the aforementioned electronic device; or it may exist independently and not assembled into the electronic device.
[0163] The aforementioned computer-readable medium carries one or more programs that, when executed by the electronic device, cause the electronic device to: acquire topology information of multiple virtual machines; determine fault domain information corresponding to the virtual machines based on the topology information; group the virtual machines based on the fault domain information to obtain multiple virtual machine groups, wherein virtual machines in the same virtual machine group correspond to the same fault domain information; in response to determining that the master virtual machine corresponding to the target service is abnormal, determine candidate virtual machines from the multiple virtual machines corresponding to the target service based on the virtual machine group to which the master virtual machine belongs, wherein the master virtual machine is one of the multiple virtual machines corresponding to the target service, and the candidate virtual machines and the master virtual machine belong to different virtual machine groups; and determine the updated master virtual machine corresponding to the target service from the candidate virtual machines.
[0164] Computer program code for performing the operations of this disclosure can be written in one or more programming languages or a combination thereof, including but not limited to object-oriented programming languages such as Java, Smalltalk, and C++, as well as conventional procedural programming languages such as the "C" language or similar programming languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving remote computers, the remote computer can be connected to the user's computer via any type of network—including a local area network (LAN) or a wide area network (WAN)—or can be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0165] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of this disclosure. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, can be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.
[0166] The modules described in the embodiments of this disclosure can be implemented in software or in hardware. The name of a module does not necessarily limit the module itself; for example, an acquisition module can also be described as "a module for acquiring the topology information of multiple virtual machines".
[0167] The functions described above in this document can be performed at least in part by one or more hardware logic components. For example, exemplary types of hardware logic components that can be used, without limitation, include: field-programmable gate arrays (FPGAs), application-specific integrated circuits (ASICs), application-specific standard products (ASSPs), system-on-a-chip (SoCs), complex programmable logic devices (CPLDs), and so on.
[0168] In the context of this disclosure, a machine-readable medium can be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, apparatus, or device. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can be, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.
[0169] According to one or more embodiments of this disclosure, Example 1 provides a virtual machine management method, the method comprising:
[0170] Obtain topology information for multiple virtual machines;
[0171] Based on the topology information, the fault domain information corresponding to the virtual machine is determined;
[0172] Based on the fault domain information, the virtual machines are grouped to obtain multiple virtual machine groups, wherein virtual machines in the same virtual machine group correspond to the same fault domain information.
[0173] In response to determining that the main virtual machine corresponding to the target service is abnormal, a candidate virtual machine is determined from multiple virtual machines corresponding to the target service based on the virtual machine group to which the main virtual machine belongs, wherein the main virtual machine is one of the multiple virtual machines corresponding to the target service, and the candidate virtual machine and the main virtual machine belong to different virtual machine groups;
[0174] The updated master virtual machine corresponding to the target service is determined from the candidate virtual machines.
[0175] According to one or more embodiments of this disclosure, Example 2 provides the method of Example 1, wherein the topology information includes the identifier of the virtual machine under multiple fault domain ranges;
[0176] The step of determining the fault domain information corresponding to the virtual machine based on the topology information includes:
[0177] Obtain the target fault domain range;
[0178] The identifier in the topology information that corresponds to the target fault domain range is used as the fault domain information.
[0179] According to one or more embodiments of this disclosure, Example 3 provides the method of Example 1, wherein determining candidate virtual machines from a plurality of virtual machines corresponding to the target service based on the virtual machine group to which the main virtual machine belongs includes:
[0180] Determine whether to select the candidate virtual machine based on fault domain information;
[0181] When the candidate virtual machines are determined based on fault domain information, the virtual machines other than the fault domain virtual machines corresponding to the main virtual machine among the multiple virtual machines corresponding to the target service are selected as the candidate virtual machines. The fault domain virtual machines corresponding to the main virtual machine are virtual machines that belong to the same virtual machine group as the main virtual machine.
[0182] According to one or more embodiments of this disclosure, Example 4 provides the method of Example 1, the method further comprising:
[0183] Determine the fault score for each virtual machine group;
[0184] Based on the current status information of the virtual machine group and the fault score, determine whether to update the status information of the virtual machine group;
[0185] If it is determined that the status information of the virtual machine group needs to be updated, the operation of the virtual machines under the virtual machine group is controlled based on the update information corresponding to the status information of the virtual machine group.
[0186] According to one or more embodiments of this disclosure, Example 5 provides the method of Example 4, wherein when the range of the fault domain information corresponding to the virtual machine is the host machine, the fault score of the virtual machine group includes the virtual machine failure rate score under the virtual machine group;
[0187] When the fault domain information corresponding to the virtual machine is within a rack, availability zone, or region, the fault score of the virtual machine group includes at least one of the virtual machine failure rate score, the gateway connectivity score, and the switch port status score of the virtual machine group.
[0188] According to one or more embodiments of this disclosure, Example 6 provides the method of Example 4, wherein determining whether to update the status information of the virtual machine group based on the current status information of the virtual machine group and the fault score includes:
[0189] If the current status information of the virtual machine group is normal and the fault score is greater than the first threshold, then it is determined to update the status information of the virtual machine group, and the updated status information is in a pending state.
[0190] If the current status information of the virtual machine group is normal and the fault score is greater than the second threshold, then it is determined that the status information of the virtual machine group should be updated, and the updated status information is abnormal, wherein the second threshold is greater than the first threshold.
[0191] If the current status information of the virtual machine group is the pending state, and the fault score is greater than the second threshold, then it is determined to update the status information of the virtual machine group, and the updated status information is an abnormal state.
[0192] According to one or more embodiments of this disclosure, Example 7 provides the method of Example 6, wherein controlling the operation of virtual machines under the virtual machine group based on update information corresponding to the state information of the virtual machine group includes:
[0193] If the update information corresponding to the status information of the virtual machine group indicates that the status has been updated from the normal state to the pending state, then the virtual machines under the virtual machine group are controlled to stop writing operations;
[0194] If the update information corresponding to the status information of the virtual machine group indicates that the pending state has been updated to the abnormal state, then the virtual machines under the virtual machine group are controlled to stop reading operations and load balancing operations.
[0195] If the update information corresponding to the status information of the virtual machine group indicates that the status has been updated from the normal status to the abnormal status, then the virtual machines under the virtual machine group are controlled to stop write operations, read operations and load balancing operations.
[0196] According to one or more embodiments of this disclosure, Example 8 provides the method of Example 6, wherein determining whether to update the status information of the virtual machine group based on the current status information of the virtual machine group and the fault score further includes:
[0197] If the current status information of the virtual machine group is the abnormal state, and the fault score is less than the first threshold, then it is determined to update the status information of the virtual machine group, and the updated status information is the pending state.
[0198] If the current status information of the virtual machine group is the pending state, and the fault score is less than the first threshold and the duration of the virtual machine group in the pending state exceeds a preset duration, then it is determined to update the status information of the virtual machine group, and the updated status information is the normal state.
[0199] According to one or more embodiments of this disclosure, Example 9 provides the method of Example 8, wherein controlling the operation of virtual machines under the virtual machine group based on update information corresponding to the state information of the virtual machine group includes:
[0200] If the update information corresponding to the status information of the virtual machine group indicates that the abnormal state has been updated to the pending state, then the virtual machines under the virtual machine group are controlled to start a read operation.
[0201] If the update information corresponding to the status information of the virtual machine group indicates that the pending state has been updated to the normal state, then the virtual machines under the virtual machine group are controlled to start write operations and load balancing operations.
[0202] According to one or more embodiments of this disclosure, Example 10 provides a method of any of Examples 1-9, wherein a virtual machine agent is deployed on each virtual machine, the virtual machine agent is used to obtain the topology information of the virtual machine and report it to a distributed coordination service, the topology information being stored under an ephemeral node of the distributed coordination service;
[0203] The process of obtaining the topology information of multiple virtual machines includes:
[0204] The topology information is obtained from the distributed coordination service.
[0205] According to one or more embodiments of this disclosure, Example 11 provides a virtual machine management apparatus, the apparatus comprising:
[0206] The acquisition module is used to obtain the topology information of multiple virtual machines;
[0207] The first determining module is used to determine the fault domain information corresponding to the virtual machine based on the topology information;
[0208] The grouping module is used to group the virtual machines based on the fault domain information to obtain multiple virtual machine groups, wherein virtual machines in the same virtual machine group correspond to the same fault domain information.
[0209] The second determining module is used to determine a candidate virtual machine from multiple virtual machines corresponding to the target service in response to an anomaly in the determination of the main virtual machine corresponding to the target service, based on the virtual machine group to which the main virtual machine belongs, wherein the main virtual machine is one of the multiple virtual machines corresponding to the target service, and the candidate virtual machine and the main virtual machine belong to different virtual machine groups;
[0210] The third determining module is used to determine the updated main virtual machine corresponding to the target service from the candidate virtual machines.
[0211] According to one or more embodiments of the present disclosure, Example 12 provides a computer-readable medium having a computer program stored thereon that, when executed by a processing device, implements the steps of the method described in any one of Examples 1-10.
[0212] According to one or more embodiments of this disclosure, Example 13 provides an electronic device comprising:
[0213] A storage device on which computer programs are stored;
[0214] A processing device for executing the computer program in the storage device to implement the steps of any one of the methods in Examples 1-10.
[0215] According to one or more embodiments of the present disclosure, Example 14 provides a computer program product including a computer program that, when executed by a processor, implements the steps of the method described in any one of Examples 1-10.
[0216] The above description is merely a preferred embodiment of this disclosure and an explanation of the technical principles employed. Those skilled in the art should understand that the scope of this disclosure is not limited to technical solutions formed by specific combinations of the above-described technical features, but should also cover other technical solutions formed by arbitrary combinations of the above-described technical features or their equivalents without departing from the above-described concept. For example, technical solutions formed by substituting the above features with (but not limited to) technical features disclosed in this disclosure that have similar functions.
[0217] Furthermore, while the operations are described in a specific order, this should not be construed as requiring these operations to be performed in the specific order shown or in a sequential order. In certain environments, multitasking and parallel processing may be advantageous. Similarly, while several specific implementation details are included in the above discussion, these should not be construed as limiting the scope of this disclosure. Certain features described in the context of individual embodiments may also be implemented in combination in a single embodiment. Conversely, various features described in the context of a single embodiment may also be implemented individually or in any suitable sub-combination in multiple embodiments.
[0218] Although the subject matter has been described using language specific to structural features and / or methodological logic, it should be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or actions described above. Rather, the specific features and actions described above are merely illustrative forms of implementing the claims. Regarding the apparatus in the above embodiments, the specific manner in which the various modules perform their operations has been described in detail in the embodiments relating to the method, and will not be elaborated upon here.
Claims
1. A virtual machine management method characterized by comprising: The method comprises: obtaining topology information of a plurality of virtual machines; determining fault domain information corresponding to the virtual machines based on the topology information; grouping the virtual machines based on the fault domain information to obtain a plurality of virtual machine groups, wherein the virtual machines under a same virtual machine group correspond to same fault domain information; in response to determining that a main virtual machine corresponding to a target service is abnormal, determining a candidate virtual machine from a plurality of virtual machines corresponding to the target service based on a virtual machine group to which the main virtual machine belongs, wherein the main virtual machine is one of the plurality of virtual machines corresponding to the target service, and the candidate virtual machine and the main virtual machine belong to different virtual machine groups; determining an updated main virtual machine corresponding to the target service from the candidate virtual machine.
2. The method of claim 1, wherein, The topology information comprises identifiers of the virtual machines in a plurality of fault domain ranges; The determining of the fault domain information corresponding to the virtual machines based on the topology information comprises: obtaining a target fault domain range; taking an identifier corresponding to the target fault domain range in the topology information as the fault domain information.
3. The method of claim 1, wherein, The determining of the candidate virtual machine from the plurality of virtual machines corresponding to the target service based on the virtual machine group to which the main virtual machine belongs comprises: determining whether to determine the candidate virtual machine based on fault domain information; in a case where it is determined to determine the candidate virtual machine based on fault domain information, taking, as the candidate virtual machine, a virtual machine other than a fault domain virtual machine corresponding to the main virtual machine from the plurality of virtual machines corresponding to the target service, wherein the fault domain virtual machine corresponding to the main virtual machine is a virtual machine belonging to a same virtual machine group as the main virtual machine.
4. The method of claim 1, wherein, The method further comprises: determining a fault score of each virtual machine group; determining whether to update state information of the virtual machine group based on current state information of the virtual machine group and the fault score; in a case where it is determined to update the state information of the virtual machine group, controlling an operation of a virtual machine under the virtual machine group based on update information corresponding to the state information of the virtual machine group.
5. The method of claim 4, wherein, When the fault domain information corresponding to the virtual machine ranges over a host computer, the fault score of the virtual machine group comprises an abnormality rate score of a virtual machine under the virtual machine group; When the fault domain information corresponding to the virtual machine ranges over a rack, an availability zone, or an area, the fault score of the virtual machine group comprises at least one of an abnormality rate score of a virtual machine under the virtual machine group, a gateway connectivity score of the virtual machine group, and a switch port state score of the virtual machine group.
6. The method of claim 4, wherein, The determining of whether to update the state information of the virtual machine group based on the current state information of the virtual machine group and the fault score comprises: if the current state information of the virtual machine group is a normal state and the fault score is greater than a first threshold, determining to update the state information of the virtual machine group, and the updated state information is a pending state. If the current state information of the virtual machine group is the normal state and the failure score is greater than a second threshold, it is determined to update the state information of the virtual machine group, and the updated state information is the abnormal state, wherein the second threshold is greater than the first threshold; If the current state information of the virtual machine group is the pending state and the failure score is greater than a second threshold, it is determined to update the state information of the virtual machine group, and the updated state information is the abnormal state.
7. The method of claim 6, wherein, The operation of the virtual machine under the virtual machine group is controlled based on the update information corresponding to the state information of the virtual machine group, including: If the update information corresponding to the state information of the virtual machine group indicates that the normal state is updated to the pending state, the write operation of the virtual machine under the virtual machine group is stopped; If the update information corresponding to the state information of the virtual machine group indicates that the pending state is updated to the abnormal state, the read operation and the load balancing operation of the virtual machine under the virtual machine group are stopped; If the update information corresponding to the state information of the virtual machine group indicates that the normal state is updated to the abnormal state, the write operation, the read operation and the load balancing operation of the virtual machine under the virtual machine group are stopped.
8. The method of claim 6, wherein, The determination of whether to update the state information of the virtual machine group based on the current state information of the virtual machine group and the failure score further includes: If the current state information of the virtual machine group is the abnormal state and the failure score is less than the first threshold, it is determined to update the state information of the virtual machine group, and the updated state information is the pending state; If the current state information of the virtual machine group is the pending state, the failure score is less than the first threshold, and the time length of the virtual machine group in the pending state exceeds a preset time length, it is determined to update the state information of the virtual machine group, and the updated state information is the normal state.
9. The method of claim 8, wherein, The operation of the virtual machine under the virtual machine group is controlled based on the update information corresponding to the state information of the virtual machine group, including: If the update information corresponding to the state information of the virtual machine group indicates that the abnormal state is updated to the pending state, the read operation of the virtual machine under the virtual machine group is started; If the update information corresponding to the state information of the virtual machine group indicates that the pending state is updated to the normal state, the write operation and the load balancing operation of the virtual machine under the virtual machine group are started.
10. The method according to any one of claims 1-9, characterized in that, A virtual machine agent is deployed on each virtual machine, and the virtual machine agent is used to obtain topology information of the virtual machine and report the topology information to a distributed coordination service, wherein the topology information is stored under a temporary node of the distributed coordination service; The topology information of the plurality of virtual machines is obtained, including: The topology information is obtained from the distributed coordination service.
11. A virtual machine management apparatus characterized by comprising: The apparatus includes: An obtaining module, configured to obtain topology information of a plurality of virtual machines; A first determining module, configured to determine failure domain information corresponding to the virtual machine based on the topology information; grouping the virtual machines based on the fault domain information to obtain a plurality of virtual machine groups, wherein the virtual machines in a same virtual machine group correspond to a same fault domain information; a second determining module, configured to, in response to determining that a host virtual machine corresponding to a target service is abnormal, determine a candidate virtual machine from a plurality of virtual machines corresponding to the target service based on a virtual machine group to which the host virtual machine belongs, wherein the host virtual machine is one of the plurality of virtual machines corresponding to the target service, and the candidate virtual machine and the host virtual machine belong to different virtual machine groups; a third determining module, configured to determine an updated host virtual machine corresponding to the target service from the candidate virtual machine.
12. A computer readable medium having stored thereon a computer program, characterized in that, The computer program is executed by a processing device to implement the steps of the method in any one of claims 1-10.
13. An electronic device, comprising: comprising: a storage device having a computer program stored thereon; a processing device configured to execute the computer program in the storage device to implement the steps of the method in any one of claims 1-10.
14. A computer program product comprising a computer program, characterized in that, The computer program is executed by a processing device to implement the steps of the method in any one of claims 1-10.
Citation Information
Patent Citations
Virtual network function VNF deployment method and device
CN110661641A
Virtual machine scheduling method and device, electronic equipment and storage medium
CN115080204A