A virtual machine scheduling method and device, electronic equipment and storage medium
By determining the target business domain and available fault domain in virtual machine scheduling, a balanced distribution of virtual machines across fault domains is achieved, solving the problem of business interruption within the fault domain in traditional scheduling schemes and improving the fault tolerance and availability of the cloud computing platform.
Patent Information
- Application Number
- CN202210522487.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-05-13
- Publication Date
- 2025-10-21
- Estimated Expiration
- 2042-05-13
AI Technical Summary
Traditional virtual machine scheduling solutions cause virtual machines of the same type of business to be distributed within a fault domain, resulting in business interruption and long recovery time when a fault occurs. It is also difficult to predict the scope of the fault's impact on the virtualization cluster.
By obtaining the virtual machines to be scheduled, determining the target business domain and available fault domain to which they belong, and evenly scheduling the virtual machines within the available fault domains based on the distribution information and scheduling weight values, virtual machines within the same business domain are prevented from being concentrated in the same fault domain, thus achieving balanced distribution across fault domains.
It solves the problem of virtual machine migration affecting business continuity, improves the fault tolerance and availability of virtualization clusters, and reduces the impact of failures on business.
Smart Images

Figure CN115080204B_ABST
Abstract
Description
Technical Field
[0001] Embodiments of the present invention relate to the field of cloud computing technology, and in particular to a virtual machine scheduling method, device, electronic device, and storage medium. Background Art
[0002] Virtual machine scheduling is one of the core technologies in cloud computing platforms, and is usually implemented through the core component of cloud computing platforms - the scheduler.
[0003] The scheduler in the current mainstream cloud computing platform mainly includes host node condition filters, host node weight calculators and host node real-time information libraries, which are used to select suitable hosts for many virtual machines and achieve balanced scheduling among all hosts in the entire virtualization cluster.
[0004] During the implementation of this invention, the inventors discovered that traditional virtualization scheduling schemes have the following drawbacks: Because balanced scheduling is implemented across all host machines in the entire virtualization cluster, virtual machines for the same type of service are inevitably distributed within a single fault domain. Consequently, when this fault domain becomes faulty, all or most of the virtual machines corresponding to that service are rescheduled, causing a complete service interruption and requiring a long recovery time, potentially impacting business continuity. Furthermore, when a fault occurs, it is difficult to predict the extent of the fault's impact on the virtualization cluster, increasing operational complexity. Summary of the Invention
[0005] The embodiments of the present invention provide a virtual machine scheduling method, device, electronic device and storage medium, which can solve the problem of business continuity affected by virtual machine migration and the problem of the scope of influence of unpredictable failures on virtualization clusters.
[0006] According to one aspect of the present invention, a virtual machine scheduling method is provided, comprising:
[0007] Get the virtual machine to be scheduled;
[0008] Determine an available fault domain set based on the available host set in the virtualization cluster, determine the target business domain to which the virtual machine to be scheduled belongs based on the business attributes, and determine the target available fault domain based on the distribution information of the virtual machines corresponding to the target business domain in the available fault domain set;
[0009] Determine a scheduling weight value of each host machine in the target available fault domain, determine a target host machine according to the scheduling weight value, and schedule the virtual machine to be scheduled to the target host machine.
[0010] Optionally, determining the available fault domain set according to the available host machine set in the virtualization cluster, determining the target business domain to which the virtual machine to be scheduled belongs according to business attributes, and determining the target available fault domain according to distribution information of the virtual machines corresponding to the target business domain in the available fault domain set includes:
[0011] Determine the available fault domain set based on the available host set in the virtualization cluster;
[0012] Determine the target service domain to which the virtual machine to be scheduled belongs according to service attributes;
[0013] querying a virtual machine scheduling table according to each available fault domain in the available fault domain set and the target business domain to obtain a quantity distribution of virtual machines corresponding to the target business domain in each of the available fault domains, wherein the virtual machine scheduling table is used to reflect a mapping relationship between fault domains, business domains, and virtual machines in the virtualization cluster;
[0014] A target available fault domain in the set of available fault domains is determined based on the quantity distribution. The quantity distribution of virtual machines of the target business domain across the available fault domains is determined by querying a virtual machine scheduling table. The target available fault domain is determined based on the quantity distribution to tend to evenly schedule virtual machines in the same business domain to the various fault domains.
[0015] Optionally, before querying a virtual machine scheduling table according to each available fault domain in the available fault domain set and the target service domain to obtain the quantity distribution of virtual machines corresponding to the target service domain in each of the available fault domains, the method further includes:
[0016] Obtaining service attributes of all virtual machines in the virtualization cluster, and determining a first correspondence between each service domain and the virtual machine according to the service attributes;
[0017] Determine a second correspondence between each fault domain and the virtual machine based on the fault domain to which each host machine belongs and the virtual machine on each host machine;
[0018] Determine the quantity distribution of virtual machines of all business domains in each fault domain according to the first corresponding relationship and the second corresponding relationship;
[0019] A virtual machine scheduling table is generated based on the distribution of the number of virtual machines in each fault domain across all business domains. After the virtual machines to be scheduled are dispatched to the target host, the table is updated based on the number of virtual machines to be scheduled. This virtual machine scheduling table enables balanced scheduling based on fault domains, preventing the time-consuming migration of virtual machines within the same business domain that falls into the same fault domain, which can affect business continuity. This improves the fault tolerance and availability of virtual machine clusters in large-scale cloud computing platforms.
[0020] Optionally, determining the target service domain to which the virtual machine to be scheduled belongs according to service attributes includes:
[0021] The target service domain to which the virtual machine to be scheduled belongs is determined according to the service domain field in the service attribute of the virtual machine to be scheduled. A service domain field is added to the original virtual machine data structure to identify the service domain to which the virtual machine belongs.
[0022] Optionally, determining the available fault domain set according to the available host set in the virtualization cluster includes:
[0023] Obtaining a fault domain identifier of each available host machine in the set of available host machines in the virtualization cluster, and dividing the set of host machines according to the fault domain identifier;
[0024] Generate available fault domains based on the fault domain identifier and the host subset, and generate available fault domain sets based on the available fault domains. Add the fault domain identifier to the original host data structure to identify the fault domain to which the host belongs, and then determine the available fault domain set.
[0025] Optionally, generating an available fault domain set according to the available fault domains includes:
[0026] Obtaining a scheduling scope parameter, wherein the scheduling scope parameter is used to configure a fault domain participating in virtual machine scheduling in a virtualization cluster;
[0027] The available fault domain set is generated based on the scheduling range parameter and the available fault domains. The available fault domains are filtered by the scheduling range parameter to generate the available fault domain set, thereby achieving the effect of dynamically configuring the available fault domain range based on different scheduling scenarios.
[0028] Optionally, after obtaining the virtual machine to be scheduled, the method further includes:
[0029] Get process selection parameters;
[0030] When the process selection parameter is a first set value, performing the step of determining an available fault domain set according to an available host set in the virtualization cluster;
[0031] When the process selection parameter is the second set data, the steps of calculating a scheduling weight value based on the available resources of the virtual machines of each host in the set of available hosts and determining a target host based on the scheduling weight value are performed. The process selection parameter is used to instruct the scheduler to execute either a traditional scheduling process or a cross-fault domain scheduling process, thereby enabling dynamic, on-demand selection of the traditional scheduling process or the cross-fault domain scheduling process, thereby expanding the scope of application of the scheduler.
[0032] According to another aspect of the present invention, a virtual machine scheduling device is provided, comprising:
[0033] An acquisition module, used to execute and acquire a virtual machine to be scheduled;
[0034] A determination module is configured to determine an available fault domain set based on an available host set in a virtualization cluster, determine a target business domain to which the virtual machine to be scheduled belongs based on business attributes, and determine a target available fault domain based on distribution information of virtual machines corresponding to the target business domain in the available fault domain set;
[0035] The scheduling module is used to determine the scheduling weight value of each host machine in the target available fault domain, determine the target host machine according to the scheduling weight value, and schedule the virtual machine to be scheduled to the target host machine.
[0036] Optionally, the module is specifically configured to execute:
[0037] Determine the available fault domain set based on the available host set in the virtualization cluster;
[0038] Determine the target service domain to which the virtual machine to be scheduled belongs according to service attributes;
[0039] querying a virtual machine scheduling table according to each available fault domain in the available fault domain set and the target business domain to obtain a quantity distribution of virtual machines corresponding to the target business domain in each of the available fault domains, wherein the virtual machine scheduling table is used to reflect a mapping relationship between fault domains, business domains, and virtual machines in the virtualization cluster;
[0040] A target available fault domain in the set of available fault domains is determined according to the quantity distribution.
[0041] Optionally, the device further comprises:
[0042] a scheduling table generating module, configured to obtain service attributes of all virtual machines in the virtualization cluster before querying a virtual machine scheduling table based on each available fault domain in the available fault domain set and the target business domain to obtain a quantity distribution of virtual machines corresponding to the target business domain in each of the available fault domains, and determining a first correspondence between each business domain and the virtual machine based on the service attributes;
[0043] Determine a second correspondence between each fault domain and the virtual machine based on the fault domain to which each host machine belongs and the virtual machine on each host machine;
[0044] Determine the quantity distribution of virtual machines of all business domains in each fault domain according to the first corresponding relationship and the second corresponding relationship;
[0045] A virtual machine scheduling table is generated according to the quantity distribution of virtual machines of all business domains in each fault domain, and after the virtual machines to be scheduled are scheduled to the target host machine, the virtual machine scheduling table is updated according to the quantity of the virtual machines to be scheduled.
[0046] Optionally, the determination module is further configured to execute:
[0047] The target service domain to which the virtual machine to be scheduled belongs is determined according to the service domain field in the service attribute of the virtual machine to be scheduled.
[0048] Optionally, the determination module is further configured to execute:
[0049] Obtaining a fault domain identifier of each available host machine in the set of available host machines in the virtualization cluster, and dividing the set of host machines according to the fault domain identifier;
[0050] An available fault domain is generated according to the fault domain identifier and the host subset, and an available fault domain set is generated according to the available fault domain.
[0051] Optionally, the determination module is further configured to execute:
[0052] Obtaining a scheduling scope parameter, wherein the scheduling scope parameter is used to configure a fault domain participating in virtual machine scheduling in a virtualization cluster;
[0053] An available fault domain set is generated according to the scheduling range parameter and the available fault domains.
[0054] Optionally, the device further comprises:
[0055] A process selection module is used to obtain process selection parameters after obtaining the virtual machine to be scheduled;
[0056] When the process selection parameter is a first set value, performing the step of determining an available fault domain set according to an available host set in the virtualization cluster;
[0057] When the process selection parameter is the second setting data, the steps of calculating a scheduling weight value according to the available resources of the virtual machines of each host machine in the available host machine set and determining a target host machine according to the scheduling weight value are executed.
[0058] According to another aspect of the present invention, an electronic device is provided, comprising:
[0059] at least one processor; and
[0060] a memory communicatively connected to the at least one processor; wherein,
[0061] The memory stores a computer program that can be executed by the at least one processor. The computer program is executed by the at least one processor so that the at least one processor can execute the virtual machine scheduling method described in any embodiment of the present invention.
[0062] According to another aspect of the present invention, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the virtual machine scheduling method described in any embodiment of the present invention when executed.
[0063] The technical solution of the embodiment of the present invention is to achieve the effect of long-term balanced distribution of virtual machines across fault domains in the same business domain by giving priority to balancing scheduling of all virtual machines under the same business domain within the set of available fault domains, and then balancing scheduling of the virtual machines among the host machines in the target available fault domain. This solves the problem of business continuity affected by virtual machine migration, and also solves the problem of the scope of influence of unpredictable failures on the virtualization cluster.
[0064] It should be understood that the content described in this section is not intended to identify the key or important features of the embodiments of the present invention, nor is it intended to limit the scope of the present invention. Other features of the present invention will become readily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0065] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0066] Figure 1 A flowchart of a virtual machine scheduling method is provided for an embodiment of the present invention;
[0067] Figure 2 A schematic diagram of a virtual machine scheduling structure provided by an embodiment of the present invention;
[0068] Figure 3 A flowchart of another virtual machine scheduling method provided by an embodiment of the present invention;
[0069] Figure 4 A flowchart of another virtual machine scheduling method provided by an embodiment of the present invention;
[0070] Figure 5 A flowchart of another virtual machine scheduling method provided by an embodiment of the present invention;
[0071] Figure 6A schematic diagram of the structure of a virtual machine scheduling device provided by an embodiment of the present invention;
[0072] Figure 7 A schematic structural diagram of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0073] In order to enable those skilled in the art to better understand the solutions of the present invention, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the embodiments described are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative efforts should fall within the scope of protection of the present invention.
[0074] It should be noted that the terms "first," "second," and the like in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects and are not necessarily used to describe a specific order or precedence. It should be understood that the numbers used in this manner are interchangeable where appropriate so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "comprises" and "comprising" and any variations thereof are intended to cover non-exclusive inclusions. For example, a process, method, system, product, or apparatus comprising a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units that are not explicitly listed or that are inherent to these processes, methods, products, or apparatus.
[0075] Figure 1 A flowchart of a virtual machine scheduling method is provided for an embodiment of the present invention. This embodiment is applicable to virtualization scheduling scenarios within a cloud computing platform. The method can be executed by a virtual machine scheduling device, which can be implemented in the form of hardware and / or software. The virtual machine scheduling device can be configured in an electronic device. The electronic device is configured with cloud computing platform software. Figure 1 As shown, the method includes:
[0076] S110: Obtain a virtual machine to be scheduled.
[0077] A virtual machine is a software computer that uses virtualization technology to isolate physical resources and possesses all or most of the characteristics of a real physical machine. Embodiments of the present invention extend the virtual machine data structure in traditional cloud computing platforms, establishing associations between virtual machines, tenants, and business domains. For example, a virtual machine data structure may include a virtual machine identifier, its business domain, and its tenant. The business domain is optional; that is, the virtual machine data structure may not contain a value for the attribute corresponding to the business domain.
[0078] Exemplarily, it is detected that a virtual machine scheduling scenario is met and a virtual machine to be scheduled is obtained. Specifically, the virtual machine scheduling scenarios include: initial placement scheduling, fault evacuation scheduling, active maintenance scheduling, and designated migration scheduling.
[0079] Among them, initial placement scheduling is the process in which the scheduler determines a suitable host machine for the newly created virtual machine when a new virtual machine is created. In this scenario, the newly created virtual machine is the virtual machine to be scheduled. Fault evacuation scheduling is the process in which the scheduler evacuates all virtual machines in a fault domain to other fault domains in a balanced manner according to the business domain when a fault domain becomes a fault state. In this scenario, all virtual machines in the fault domain are virtual machines to be scheduled. Active maintenance scheduling is the process in which the scheduler evacuates virtual machines to other fault domains or the current fault domain in a balanced manner according to the business domain when the host is actively maintained within the plan based on the scheduling range parameters. In this scenario, all virtual machines on the actively maintained host are virtual machines to be scheduled. Designated migration scheduling is the process in which the scheduler migrates all virtual machines in a fault domain to a manually specified target host when a fault domain becomes a fault state. In this scenario, all virtual machines in the fault domain are virtual machines to be scheduled.
[0080] S120. Determine an available fault domain set based on an available host set in the virtualization cluster, determine a target business domain to which the virtual machine to be scheduled belongs based on business attributes, and determine a target available fault domain based on distribution information of virtual machines corresponding to the target business domain in the available fault domain set.
[0081] Among them, the virtualization cluster is composed of a group of host machines. The virtual machines in the cluster can and can only be scheduled and migrated on each host machine in the cluster. That is, the virtualization cluster is the boundary for the scheduling and migration of virtual machines on it.
[0082] A host, also known as a physical host, compute host, or compute node, is a real-world computer that can run multiple virtual machines. The available host set is the set of hosts in the current virtualization cluster that can be used for virtual machine scheduling. Embodiments of the present invention extend the host data structure in traditional cloud computing platforms to establish an association between hosts and fault domains. For example, the host data structure can include a host identifier and the fault domain to which it belongs.
[0083] The set of available fault domains is the set of fault domains to which available hosts belong. Fault domains are used to group hosts related to the same fault. For example, the data structure of a fault domain includes a fault domain identifier and a set of hosts. After being configured by the administrator, fault domains are associated with hosts as needed. The fault domain entities are stored in a database and used by the scheduler when scheduling virtual machines.
[0084] It should be noted that in actual computer room deployments, fault domains of varying granularity can be constructed based on the scale of different cloud computing platforms. Specifically, fault domains can be constructed at the following granularities: host, host group, blade chassis, cabinet, cabinet group, performance optimization data center (pod), and computer room.
[0085] The business attributes are used to identify the business implemented by the virtual machine. Specifically, the business attributes include a business domain field. In one case, the business domain to which the virtual machine belongs can be determined based on the business domain field in the business attributes of the virtual machine. In an embodiment of the present invention, the target business domain is the business domain to which the virtual machine to be scheduled belongs. The business domain is used to organize the business virtual machines of the tenants, which is usually a group of business virtual machines with the same functional level and similar functions, such as web-layer virtual machines. When creating a virtual machine, its associated business domain is set, and the business domain is formed according to the virtual machine identifier, the virtual machine set and the tenant to which it belongs. For example, the data structure of the business domain includes the business identifier, the virtual machine set and the tenant to which it belongs. The business domain entity is stored in the database and is used by the scheduler when scheduling the virtual machine.
[0086] Distribution information is the real-time scheduling information for virtual machines corresponding to the target business domain across available fault domains. Specifically, a virtual machine scheduling table can be used to store the mapping between fault domains, business domains, and virtual machines in the virtualization cluster. The virtual machine scheduling table is generated during scheduler initialization and dynamically updated as the virtual machine scheduling process progresses.
[0087] Table 1 is a virtual machine scheduling table.
[0088] Fault Domain Business Domain Number of virtual machines Fault Domain A Business Domain 1 Number of virtual machines X …… …… …… Fault Domain M Business Domain N Number of virtual machines Y
[0089] The virtual machine scheduling table is queried based on each available fault domain in the available fault domain set and the target business domain to obtain the distribution of the number of virtual machines corresponding to the target business domain in each available fault domain. A target available fault domain is an available fault domain where the number of virtual machines corresponding to the target business domain meets a set condition. The set condition is a system default value and can be manually modified for different application scenarios.
[0090] Exemplarily, a set of available fault domains is determined based on a set of available hosts in a virtualization cluster. A target business domain to which the virtual machine to be scheduled belongs is determined based on business attributes. A virtual machine scheduling table is queried based on each available fault domain in the set of available fault domains and the target business domain to obtain a distribution of the number of virtual machines corresponding to the target business domain in each available fault domain. Based on this distribution, a target available fault domain in the set of available fault domains is determined. Specifically, the target available fault domain may be the available fault domain that runs the minimum number of virtual machines in the target business domain.
[0091] Specifically, determining the set of available fault domains based on the set of available hosts in the virtualization cluster can be achieved by obtaining the fault domain identifier of each available host in the set of available hosts in the virtualization cluster, dividing the host set according to the fault domain identifier to obtain a subset of available hosts. Available fault domains are generated based on the fault domain identifiers and the subset of hosts, and the set of available fault domains is generated based on the available fault domains. In one embodiment, the set of available fault domains can be dynamically configured based on the application scenario. For example, the set of available fault domains may include all fault domains, the current fault domain, and other fault domains in the set of all fault domains excluding the current fault domain.
[0092] Specifically, determining the target service domain to which the virtual machine to be scheduled belongs according to the service attributes can be achieved in the following manner: determining the target service domain to which the virtual machine to be scheduled belongs according to the service domain field in the service attributes of the virtual machine to be scheduled.
[0093] Figure 2 A schematic diagram of a virtual machine scheduling structure provided by an embodiment of the present invention. Figure 2 As shown, for ease of understanding, the virtualization scheduling process is explained using a cloud computing platform with six virtual machines to be scheduled as an example. The virtual machines to be scheduled 210, based on their respective business domains, include three virtual machines in Tenant A's business domain and three virtual machines in Tenant B's business domain. Scheduler 220 includes, among other things, a host node condition filter 221, a fault domain virtual machine distribution balance analyzer 222, a host node weight calculator 223, a host node real-time information library 224, and a virtual machine scheduling table 225. Scheduler 220 queries the host node real-time information library 224 to obtain hosts. Using host node condition filter 221, it filters out hosts that do not meet the virtual machine's available resource requirements based on CPU, memory, host aggregation (ag), available zone (az), and status. The remaining hosts then form a set of available hosts. The fault domain virtual machine distribution balance analyzer 222 determines the available fault domain set based on the available host machine set in the virtualization cluster 230; determines the target business domain to which the virtual machine to be scheduled belongs based on the business attributes; queries the virtual machine scheduling table 225 based on each available fault domain and the target business domain in the available fault domain set to obtain the quantity distribution of the virtual machines corresponding to the target business domain in each available fault domain, and determines the target available fault domain in the available fault domain set based on the quantity distribution.
[0094] S130: Determine a scheduling weight value of each host machine in the target available fault domain, determine a target host machine according to the scheduling weight value, and schedule the virtual machine to be scheduled to the target host machine.
[0095] The scheduling weight value is the weight for scheduling the virtual machine to the host machine in the target available fault domain, and is used to reflect the tendency of scheduling the virtual machine to each host machine in the target available fault domain.
[0096] continue Figure 2 In the example, the scheduler uses the host node weight calculator to calculate the scheduling weight of each host based on the remaining capacity of CPU, memory, and disk on each host in the target available fault domain. Based on the scheduling weight, the scheduler selects a target host from the target available fault domain and schedules the virtual machine to the selected target host.
[0097] The technical solution of this embodiment prioritizes evenly scheduling all virtual machines within the same business domain within a set of available fault domains, and then evenly scheduling the virtual machines across hosts in the target available fault domain. This ensures that virtual machines within the same business domain are evenly distributed across fault domains over the long term, resolving the issue of business continuity impacted by virtual machine migration. Furthermore, the use of fault domains and business domains allows for the identification of affected hosts and service types when a failure occurs, addressing the issue of the scope of unpredictable failures affecting the virtualization cluster.
[0098] Figure 3 This is a flowchart of another virtual machine scheduling method provided by an embodiment of the present invention. This embodiment adds a solution for generating a virtual machine scheduling table based on the above embodiment. Figure 3 As shown, the method includes:
[0099] S310: Obtain a virtual machine to be scheduled.
[0100] S320: Determine a set of available fault domains according to a set of available host machines in the virtualization cluster.
[0101] S330: Determine the target service domain to which the virtual machine to be scheduled belongs according to service attributes.
[0102] S340: Obtain service attributes of all virtual machines in the virtualization cluster, and determine a first correspondence between each service domain and the virtual machine according to the service attributes.
[0103] Exemplarily, the business attributes in the virtual machine data structure are read, and the business domain to which each virtual machine belongs is determined based on the business attributes. The business attributes include a business domain field. In one case, the business domain field in the virtual machine data structure is read, and the business domain to which the corresponding virtual machine belongs is determined based on the business domain field. In order to maintain scheduling flexibility, the present invention does not force all virtual machines to be associated with a business domain. The tenant field of the virtual machine can also be obtained to achieve tenant-oriented cross-fault domain balanced scheduling. In this case, the tenant field in the virtual machine data structure is read, and the tenant to which the corresponding virtual machine belongs is determined based on the tenant field. Virtual machines of the same tenant are regarded as virtual machines of the same type of business.
[0104] S350: Determine a second correspondence between each fault domain and the virtual machine according to the fault domain to which each host machine belongs and the virtual machine on each host machine.
[0105] Exemplarily, the fault domain in the host data structure is read to determine the mapping relationship between the host and the fault domain, and then determine the fault domain to which the virtual machine on the host belongs.
[0106] S360: Determine the quantity distribution of virtual machines of all business domains in each fault domain according to the first corresponding relationship and the second corresponding relationship.
[0107] For example, based on the business domains and fault domains to which the virtual machines belong, the distribution of the number of virtual machines in each business domain within each fault domain is calculated. For example, <fault domain A, business domain, number of virtual machines X>. Alternatively, the distribution of the number of virtual machines in each fault domain for each tenant can be calculated based on the tenant to which the virtual machines belong and the fault domain to which the virtual machines belong. Thus, the virtual machine scheduling table can be updated based on the mapping between fault domains, tenants, and the number of virtual machines.
[0108] S370: Generate a virtual machine scheduling table based on the quantity distribution of virtual machines of all business domains in each fault domain.
[0109] Exemplarily, a virtual machine scheduling table is generated according to the number of virtual machines of all business domains in each fault domain. For virtual machines whose business domains are unknown, they are added to the virtual machine scheduling table based on their tenants and business domains.
[0110] S380: Query a virtual machine scheduling table according to each available fault domain in the available fault domain set and the target service domain to obtain the quantity distribution of the virtual machines corresponding to the target service domain in each of the available fault domains.
[0111] Illustratively, after determining the target business domain to which the virtual machine to be scheduled belongs, the scheduler queries the virtual machine scheduling table for the scheduling distribution of the virtual machines of the target business domain in each fault domain, thereby achieving balanced scheduling across fault domains for actual business.
[0112] S390. Determine a target available fault domain in the set of available fault domains according to the quantity distribution.
[0113] S3100. Determine a scheduling weight value of each host machine in the target available fault domain, determine a target host machine according to the scheduling weight value, and schedule the virtual machine to be scheduled to the target host machine.
[0114] S3110. Update the virtual machine scheduling table according to the number of virtual machines to be scheduled.
[0115] For example, after each virtual machine is scheduled to a new fault domain, the number of virtual machines in the corresponding business domain in the original fault domain is reduced by the corresponding number in the virtual machine scheduling table, and the number of virtual machines in the corresponding business domain in the new fault domain is increased by the corresponding number. In an initial placement scheduling scenario, since the original fault domain does not exist, only the number of virtual machines in the corresponding business domain in the new fault domain needs to be increased by the corresponding number.
[0116] The technical solution of the embodiment of the present invention counts the number distribution of virtual machines in each business domain in each fault domain through the business domain to which the virtual machine belongs and the fault domain to which the virtual machine belongs, and generates a virtual machine scheduling table based on the number distribution of virtual machines in each fault domain of all business domains. Balanced scheduling based on fault domains can be achieved based on the virtual machine scheduling table, avoiding the problem of virtual machine migration taking a long time and affecting business continuity due to virtual machines in the same business domain belonging to the same fault domain, thereby improving the fault tolerance and availability of virtual machine clusters in large-scale cloud computing platforms.
[0117] Figure 4 This is a flowchart of another virtual machine scheduling method provided by an embodiment of the present invention. This embodiment specifically defines the generation of an available fault domain set based on the available fault domains based on the above embodiment. Figure 4 As shown, the method includes:
[0118] S410: Obtain a virtual machine to be scheduled.
[0119] S420: Obtain a fault domain identifier of each available host machine in the set of available host machines in the virtualization cluster, and divide the set of host machines according to the fault domain identifier.
[0120] S430: Generate an available fault domain according to the fault domain identifier and the host subset.
[0121] S440: Obtain scheduling range parameters.
[0122] The scheduling scope parameter is used to configure the fault domains that participate in virtual machine scheduling within the virtualization cluster. Specifically, the scheduling scope parameter can include all fault domains, the current fault domain, and other fault domains. Typically, the default value for the scheduling scope parameter is all fault domains, but it can be modified in the configuration file.
[0123] In one case, if the scheduling scope parameter is all fault domains or a null value, the virtual machine is scheduled in all fault domains of the virtualization cluster. This situation applies to the initial placement scheduling scenario.
[0124] In one case, if the scheduling scope parameter is the current fault domain, the target available fault domain is determined to include only the current fault domain, and the process jumps to S490. This case is applicable to fault evacuation scheduling scenarios or fault domain local maintenance scenarios during proactive maintenance scheduling.
[0125] In one case, if the scheduling scope parameter is other fault domains, the virtual machine is scheduled in the remaining fault domains of the virtualization cluster except the current fault domain. This scenario is applicable to fault evacuation scheduling and proactive maintenance scheduling for localized fault domain maintenance scenarios.
[0126] S450: Generate an available fault domain set according to the scheduling range parameter and the available fault domains.
[0127] Exemplarily, based on the scheduling scope parameter, some or all fault domains are filtered from the available fault domains, and an available fault domain set is generated based on some or all fault domains. If the scheduling scope parameter is all fault domains or a null value, a fault domain set is generated based on all available fault domains. If the scheduling scope parameter is the current fault domain, the current fault domain is selected from all available fault domains as the target available fault domain. If the scheduling scope parameter is other fault domains, a fault domain set is generated based on the remaining available fault domains after filtering out the current fault domain from all available fault domains.
[0128] S460: Determine the target service domain to which the virtual machine to be scheduled belongs according to service attributes.
[0129] S470: Query a virtual machine scheduling table according to each available fault domain in the available fault domain set and the target service domain to obtain the quantity distribution of the virtual machines corresponding to the target service domain in each of the available fault domains.
[0130] S480: Determine a target available fault domain in the set of available fault domains according to the quantity distribution.
[0131] S490: Determine a scheduling weight value of each host machine in the target available fault domain, determine a target host machine according to the scheduling weight value, and schedule the virtual machine to be scheduled to the target host machine.
[0132] The technical solution of the embodiment of the present invention obtains scheduling range parameters, generates an available fault domain set according to the scheduling range parameters and available fault domains, and achieves the effect of dynamically configuring the available fault domain range based on different scheduling scenarios.
[0133] Figure 5 This is a flowchart of another virtual machine scheduling method provided by an embodiment of the present invention. This embodiment adds a process selection feature based on the above embodiment. Figure 5 As shown, the method includes:
[0134] S510: Obtain a virtual machine to be scheduled.
[0135] S520: Query the host node real-time information library to obtain hosts, filter out hosts that do not meet the virtual machine's available resource requirements based on CPU, memory, host aggregation, availability zone, and status items using a host node filter, and form an available host set based on the remaining hosts.
[0136] S530 , obtaining process selection parameters, and determining whether to execute the process based on fault domain scheduling according to the process selection parameters; if so, executing S540 , otherwise executing S560 .
[0137] Exemplarily, when the process selection parameter is a first set value, it is determined that the process based on fault domain scheduling needs to be executed, and S540 is executed. When the process selection parameter is a second set value, it is determined that the process based on fault domain scheduling does not need to be executed, and S560 is executed. The first set value and the second set value are both pre-configured values indicating whether to execute fault domain scheduling. Specifically, when the process selection parameter is Yes, the scheduler executes a cross-fault domain scheduling process, where the input of the cross-fault domain scheduling traffic is the filtered set of available hosts, and the output is the filtered set of available hosts based on the fault domain and the business domain.
[0138] S540. Determine an available fault domain set based on the available host machine set in the virtualization cluster, determine the target business domain to which the virtual machine to be scheduled belongs based on business attributes, and determine the target available fault domain based on the distribution information of the virtual machines corresponding to the target business domain in the available fault domain set.
[0139] S550: Filter the set of available hosts based on the target available fault domain to obtain a re-determined set of available hosts.
[0140] S560: Calculate a scheduling weight value based on the available resources of the virtual machines of each host machine in the set of available host machines, determine a target host machine based on the scheduling weight value, and schedule the virtual machine to be scheduled to the target host machine.
[0141] The available resources of the virtual machines include the remaining capacity of the CPU, memory, and disk on each host machine.
[0142] The technical solution of the embodiment of the present invention instructs the scheduler to execute the traditional scheduling process or the cross-fault domain scheduling process through process selection parameters, thereby realizing dynamic on-demand selection of the traditional scheduling process or the cross-fault domain scheduling process, and expanding the application scope of the scheduler.
[0143] Figure 6 This is a structural diagram of a virtual machine scheduling device provided by an embodiment of the present invention. The virtual machine scheduling device can be implemented in the form of hardware and / or software, and the virtual machine scheduling device can be configured in an electronic device. The electronic device is configured with cloud computing platform software. Figure 6 As shown, the device includes: an acquisition module 610, a determination module 620 and a scheduling module 630.
[0144] An acquisition module 610 is configured to acquire a virtual machine to be scheduled;
[0145] A determination module 620 is configured to determine a set of available fault domains based on a set of available host machines in the virtualization cluster, determine a target business domain to which the virtual machine to be scheduled belongs based on business attributes, and determine a target available fault domain based on distribution information of virtual machines corresponding to the target business domain in the set of available fault domains;
[0146] The scheduling module 630 is configured to determine a scheduling weight value of each host machine in the target available fault domain, determine a target host machine according to the scheduling weight value, and schedule the virtual machine to be scheduled to the target host machine.
[0147] Optionally, the module is specifically configured to execute:
[0148] Determine the available fault domain set based on the available host set in the virtualization cluster;
[0149] Determine the target service domain to which the virtual machine to be scheduled belongs according to service attributes;
[0150] querying a virtual machine scheduling table according to each available fault domain in the available fault domain set and the target business domain to obtain a quantity distribution of virtual machines corresponding to the target business domain in each of the available fault domains, wherein the virtual machine scheduling table is used to reflect a mapping relationship between fault domains, business domains, and virtual machines in the virtualization cluster;
[0151] A target available fault domain in the set of available fault domains is determined according to the quantity distribution.
[0152] Optionally, the device further comprises:
[0153] a scheduling table generating module, configured to obtain service attributes of all virtual machines in the virtualization cluster before querying a virtual machine scheduling table based on each available fault domain in the available fault domain set and the target business domain to obtain a quantity distribution of virtual machines corresponding to the target business domain in each of the available fault domains, and determining a first correspondence between each business domain and the virtual machine based on the service attributes;
[0154] Determine a second correspondence between each fault domain and the virtual machine based on the fault domain to which each host machine belongs and the virtual machine on each host machine;
[0155] Determine the quantity distribution of virtual machines of all business domains in each fault domain according to the first corresponding relationship and the second corresponding relationship;
[0156] A virtual machine scheduling table is generated according to the quantity distribution of virtual machines of all business domains in each fault domain, and after the virtual machines to be scheduled are scheduled to the target host machine, the virtual machine scheduling table is updated according to the quantity of the virtual machines to be scheduled.
[0157] Optionally, the determination module is further configured to execute:
[0158] The target service domain to which the virtual machine to be scheduled belongs is determined according to the service domain field in the service attribute of the virtual machine to be scheduled.
[0159] Optionally, the determination module is further configured to execute:
[0160] Obtaining a fault domain identifier of each available host machine in the set of available host machines in the virtualization cluster, and dividing the set of host machines according to the fault domain identifier;
[0161] An available fault domain is generated according to the fault domain identifier and the host subset, and an available fault domain set is generated according to the available fault domain.
[0162] Optionally, the determination module is further configured to execute:
[0163] Obtaining a scheduling scope parameter, wherein the scheduling scope parameter is used to configure a fault domain participating in virtual machine scheduling in a virtualization cluster;
[0164] An available fault domain set is generated according to the scheduling range parameter and the available fault domains.
[0165] Optionally, the device further comprises:
[0166] A process selection module is used to obtain process selection parameters after obtaining the virtual machine to be scheduled;
[0167] When the process selection parameter is a first set value, performing the step of determining an available fault domain set according to an available host set in the virtualization cluster;
[0168] When the process selection parameter is the second setting data, the steps of calculating a scheduling weight value according to the available resources of the virtual machines of each host machine in the available host machine set and determining a target host machine according to the scheduling weight value are executed.
[0169] The virtual machine scheduling device provided in the embodiment of the present invention can execute the virtual machine scheduling method provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the execution method.
[0170] Figure 7 A schematic diagram of the structure of an electronic device provided by an embodiment of the present invention is shown in FIG. Figure 7 As shown, the electronic device 700 includes a processor 710 and a memory 720; the number of processors 710 in the electronic device can be one or more. Figure 7 In the figure, a processor 710 is used as an example; the processor 710 and the memory 720 in the electronic device can be connected via a bus or other means. Figure 7 The bus connection is taken as an example.
[0171] The memory 720, as a computer-readable storage medium, can be used to store software programs, computer executable programs, and modules, such as program instructions / modules corresponding to the virtual machine scheduling method in the embodiment of the present invention (for example, the acquisition module 610, the determination module 620, and the scheduling module 630). The processor 710 executes the software programs, instructions, and modules stored in the memory 720 to execute various functional applications and data processing of the electronic device, that is, to implement the above-mentioned virtual machine scheduling method.
[0172] The memory 720 may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system and applications required for at least one function; the data storage area may store data created based on the use of the terminal, etc. In addition, the memory 720 may include a high-speed random access memory and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other non-volatile solid-state storage device. In some instances, the memory 720 may further include a memory remotely located relative to the processor 710, and these remote memories may be connected to the electronic device via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0173] An embodiment of the present invention further provides a storage medium containing computer-executable instructions, wherein the computer-executable instructions, when executed by a computer processor, are used to perform a virtual machine scheduling method, the method comprising:
[0174] Get the virtual machine to be scheduled;
[0175] Determine an available fault domain set based on the available host set in the virtualization cluster, determine the target business domain to which the virtual machine to be scheduled belongs based on the business attributes, and determine the target available fault domain based on the distribution information of the virtual machines corresponding to the target business domain in the available fault domain set;
[0176] Determine a scheduling weight value of each host machine in the target available fault domain, determine a target host machine according to the scheduling weight value, and schedule the virtual machine to be scheduled to the target host machine.
[0177] Of course, the computer executable instructions of the storage medium containing computer executable instructions provided by the embodiment of the present invention are not limited to the operations of the method described above, and can also execute related operations in the virtual machine scheduling method provided by any embodiment of the present invention.
[0178] Through the above description of the implementation methods, those skilled in the art can clearly understand that the present invention can be implemented with the help of software and necessary general-purpose hardware. Of course, it can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present invention is essentially or the part that contributes to the prior art can be embodied in the form of a software product. The computer software product can be stored in a computer-readable storage medium, such as a computer floppy disk, read-only memory (ROM), random access memory (RAM), flash memory (FLASH), hard disk or optical disk, etc., and includes a number of instructions for enabling a computer device (which can be a personal computer, server, or network device, etc.) to execute the methods described in each embodiment of the present invention.
[0179] It is worth noting that in the embodiments of the virtual machine scheduling device described above, the various units and modules included are divided only according to functional logic, but are not limited to this division, as long as they can achieve the corresponding functions. In addition, the specific names of the functional units are only for the purpose of distinguishing them from each other and are not intended to limit the scope of protection of the present invention.
[0180] Note that the above are only preferred embodiments of the present invention and the technical principles employed. Those skilled in the art will understand that the present invention is not limited to the specific embodiments described herein, and that various obvious changes, readjustments, and substitutions can be made by those skilled in the art without departing from the scope of protection of the present invention. Therefore, although the present invention has been described in detail through the above embodiments, the present invention is not limited to the above embodiments and may include many other equivalent embodiments without departing from the concept of the present invention. The scope of the present invention is determined by the scope of the appended claims.
Claims
1. A virtual machine scheduling method, characterized in that: include: Get the virtual machine to be scheduled; Determine an available fault domain set according to an available host set in the virtualization cluster, determine a target business domain to which the to-be-scheduled virtual machine belongs according to a business attribute, query a virtual machine scheduling table according to each available fault domain in the available fault domain set and the target business domain, and obtain a quantity distribution of virtual machines corresponding to the target business domain in each of the available fault domains, wherein the virtual machine scheduling table is used to reflect a mapping relationship between fault domains, business domains, and virtual machines in the virtualization cluster; Determine a target available fault domain in the set of available fault domains according to the quantity distribution; Determine a scheduling weight value of each host machine in the target available fault domain, determine a target host machine according to the scheduling weight value, and schedule the virtual machine to be scheduled to the target host machine.
2. The method according to claim 1, characterized in that Before querying a virtual machine scheduling table according to each available fault domain in the available fault domain set and the target service domain to obtain the quantity distribution of virtual machines corresponding to the target service domain in each available fault domain, the method further includes: Obtaining service attributes of all virtual machines in the virtualization cluster, and determining a first correspondence between each service domain and the virtual machine according to the service attributes; Determine a second correspondence between each fault domain and the virtual machine based on the fault domain to which each host machine belongs and the virtual machine on each host machine; Determine the quantity distribution of virtual machines of all business domains in each fault domain according to the first corresponding relationship and the second corresponding relationship; A virtual machine scheduling table is generated according to the quantity distribution of virtual machines of all business domains in each fault domain, and after the virtual machines to be scheduled are scheduled to the target host machine, the virtual machine scheduling table is updated according to the quantity of the virtual machines to be scheduled.
3. The method according to claim 1, characterized in that The determining, according to the service attributes, the target service domain to which the virtual machine to be scheduled belongs includes: The target service domain to which the virtual machine to be scheduled belongs is determined according to the service domain field in the service attribute of the virtual machine to be scheduled.
4. The method according to claim 1, wherein Determining the available fault domain set according to the available host set in the virtualization cluster includes: Obtaining a fault domain identifier of each available host machine in the set of available host machines in the virtualization cluster, and dividing the set of host machines according to the fault domain identifier; An available fault domain is generated according to the fault domain identifier and the host subset, and an available fault domain set is generated according to the available fault domain.
5. The method according to claim 4, characterized in that Generating an available fault domain set according to the available fault domains includes: Obtaining a scheduling scope parameter, wherein the scheduling scope parameter is used to configure a fault domain participating in virtual machine scheduling in a virtualization cluster; An available fault domain set is generated according to the scheduling range parameter and the available fault domains.
6. The method according to any one of claims 1 to 5, characterized in that After obtaining the virtual machine to be scheduled, the following steps are also included: Get process selection parameters; When the process selection parameter is a first set value, performing the step of determining an available fault domain set according to an available host set in the virtualization cluster; When the process selection parameter is the second setting data, the steps of calculating a scheduling weight value according to the available resources of the virtual machines of each host machine in the available host machine set and determining a target host machine according to the scheduling weight value are executed.
7. A virtual machine scheduling device, characterized in that: include: An acquisition module, used to execute and acquire a virtual machine to be scheduled; a determination module, configured to determine a set of available fault domains based on a set of available host machines in the virtualization cluster, determine a target business domain to which the virtual machine to be scheduled belongs based on business attributes, query a virtual machine scheduling table based on each available fault domain in the set of available fault domains and the target business domain, and obtain a quantity distribution of virtual machines corresponding to the target business domain in each of the available fault domains, wherein the virtual machine scheduling table is used to reflect a mapping relationship between fault domains, business domains, and virtual machines in the virtualization cluster; Determine a target available fault domain in the set of available fault domains according to the quantity distribution; The scheduling module is used to determine the scheduling weight value of each host machine in the target available fault domain, determine the target host machine according to the scheduling weight value, and schedule the virtual machine to be scheduled to the target host machine.
8. An electronic device, characterized in that: The electronic device comprises: at least one processor; and a memory communicatively connected to the at least one processor; wherein, The memory stores a computer program that can be executed by the at least one processor. The computer program is executed by the at least one processor to enable the at least one processor to execute the virtual machine scheduling method according to any one of claims 1 to 6.
9. A computer-readable storage medium, characterized in that The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the virtual machine scheduling method according to any one of claims 1 to 6 when executed.
Citation Information
Patent Citations
Method, equipment and system for virtual machine scheduling
CN107479950A
Service processing method and device
CN114328509A
Availability management in a distributed computing system
US20180260261A1