Method and system for creating stateful virtual machine, storage medium and computer equipment

By anonymously locking resources and setting lease periods, the problems of low resource utilization and scheduling failure when creating a stateful virtual machine are solved, and the full utilization of resources and the improvement of system flexibility are achieved.

CN118916116APending Publication Date: 2024-11-08SINA TECH (CHINA) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411020895.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-07-29
Publication Date
2024-11-08

AI Technical Summary

Technical Problem

In the prior art, when a stateful virtual machine is created, real-name locking of a specific resource leads to low resource utilization. If not locking, it may lead to scheduling failure and poor resource mobility.

Method used

Using anonymous locking of resources, we create a stateful virtual machine by anonymously locking resources within the target server and setting a lease term to create a stateful virtual machine to avoid resource waste and scheduling failure.

Benefits of technology

Improve resource utilization and liquidity, avoid resource waste, improve the success rate of stateful virtual machines creation and system flexibility.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118916116A_ABST
    Figure CN118916116A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides a stateful virtual machine creation method and system, a storage medium and computer equipment, and relates to the field of stateful virtual machine creation, the method comprises the steps that an initialization task is acquired from a task list, and the initialization task comprises a task type and task information; when the task type of the initialization task is order creation and the state type is determined to be stateful according to the task information, generating a corresponding stateful order according to the task information of the initialization task, and anonymously locking scheduled resources for the stateful order; and according to the corresponding stateful order, anonymous locking resources in the occupied lease period in the target server are scheduled, and a corresponding stateful virtual machine is created. The scheduling range is performed aiming at the whole cluster, and any available anonymous locking resources in the whole cluster can be called, so that the cluster utilization rate and the resource adaptability can be effectively improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of virtualization, and in particular to a method, system, storage medium and computer equipment for creating a stateful virtual machine. Background Art

[0002] With the development of Internet technology, more and more virtual machine deployments tend to be deployed on the cloud. The requirements for virtual machines are various, among which the most complex is some stateful virtual machine scheduling. The virtual machines provided by cloud service providers are usually stateless, which means that virtual machines do not store key data or user status, but rely on external storage services or databases to store and retain data. In some specific application scenarios, stateful virtual machines may be more suitable, such as: storage scenarios, data volume scenarios, index service scenarios, GPU scenarios, etc. When these stateful virtual machines are created, they can only be scheduled to servers with specific resources. In the current scheduling process, servers with specific resources are usually locked by real name to limit resource use to solve the needs of stateful virtual machines, but at the same time, they bring the defects of low resource utilization and low versatility. In addition, because the resources on the cloud are mobile, these specific resources are also easy to be occupied, which will lead to scheduling failure. In order to solve various limitations, it is necessary to construct a resource scheduling method when creating stateful virtual machines. Summary of the invention

[0003] The embodiments of the present invention provide a method, system, storage medium and computer device for creating a stateful virtual machine, which can solve the technical problem in the prior art that when a stateful virtual machine is created, specific resources scheduled are locked by real name, resulting in low resource utilization, and if not locked, scheduling of specific resources may fail.

[0004] To achieve the above-mentioned purpose, in a first aspect, an embodiment of the present invention provides a method for creating a stateful virtual machine, comprising:

[0005] Acquire an initialization task from the task list, wherein the initialization task includes a task type and task information;

[0006] When the task type of the initialization task is order creation and the state type is determined to be stateful according to the task information, a corresponding stateful order is generated according to the task information of the initialization task, and the stateful order is used to lock resources for the stateful virtual machine to be created;

[0007] Scheduling resources in the target server for the stateful order, anonymously locking the scheduled resources and setting an occupation lease for the anonymously locked resources;

[0008] In the case where the task type of the initialization task is stateful virtual machine creation, anonymous locked resources within the occupied lease period are scheduled in the target server according to the corresponding stateful order, and the corresponding stateful virtual machine is created. The initialization task with the task type of stateful virtual machine creation is generated based on the corresponding stateful order.

[0009] In a second aspect, an embodiment of the present invention provides a system for creating a stateful virtual machine, including:

[0010] A task acquisition unit, used to acquire an initialization task from a task list, wherein the initialization task includes a task type and task information;

[0011] An order creation unit, configured to generate a corresponding stateful order according to the task information of the initialization task when the task type of the initialization task is order creation and the state type is determined to be stateful according to the task information, wherein the stateful order is used to lock resources for the stateful virtual machine to be created;

[0012] A resource scheduling unit, used for scheduling resources in a target server for the stateful order, anonymously locking the scheduled resources and setting an occupation lease for the anonymously locked resources;

[0013] A virtual machine creation unit is used to schedule anonymous locked resources within the occupied lease period in the target server according to the corresponding stateful order when the task type of the initialization task is stateful virtual machine creation, and create a corresponding stateful virtual machine. The initialization task with the task type of stateful virtual machine creation is generated based on the corresponding stateful order.

[0014] In a third aspect, an embodiment of the present invention provides a computer-readable storage medium, which stores one or more programs. When the one or more programs are executed by a computer device, the computer device executes the aforementioned method for creating a stateful virtual machine.

[0015] In a fourth aspect, an embodiment of the present invention provides a computer device, including:

[0016] A processor; and a memory arranged to store computer executable instructions, wherein when the executable instructions are executed, the processor executes the aforementioned method for creating a stateful virtual machine.

[0017] The above technical solution has the following beneficial effects: scheduling resources in the target server for the stateful order, anonymously locking the scheduled resources and setting an occupation lease for the anonymously locked resources; instead of locking the stateful order and the scheduled resources in a real-name unique correspondence. Then, when the task type of the initialization task is any stateful virtual machine creation, it is determined whether there is a matching anonymously locked resource based on the resource specifications required for the stateful virtual machine creation. The anonymously locked resource can be: an anonymously locked resource that matches the stateful order corresponding to the stateful virtual machine creation, or an anonymously locked resource that matches other stateful orders, so that the anonymously locked resource is not occupied by the only stateful virtual machine creation, so that the resources are fully utilized and the waste of resources is avoided. BRIEF DESCRIPTION OF THE DRAWINGS

[0018] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. 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 paying creative work.

[0019] Figure 1 is a flow chart of a method for creating a stateful virtual machine according to an embodiment of the present invention;

[0020] Figure 2 It is a logical structure diagram of a system for creating a stateful virtual machine according to an embodiment of the present invention;

[0021] Figure 3 is a logical structure diagram of a computer device according to an embodiment of the present invention;

[0022] Figure 4 It is a judgment logic diagram for creation of a stateful virtual machine according to an embodiment of the present invention;

[0023] Figure 5 This is a sequential process of creating a stateful virtual machine according to an embodiment of the present invention;

[0024] Figure 6 It is a flowchart of resource scheduling according to an embodiment of the present invention. DETAILED DESCRIPTION

[0025] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments 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 creative work are within the scope of protection of the present invention.

[0026] The technical terms involved in the embodiments of the present invention are defined as follows:

[0027] Cloud deployment: The process of deploying applications, services, or resources to a cloud computing platform. Cloud computing platforms provide a flexible and scalable way to host applications and process computing tasks.

[0028] Stateful VM: A VM instance running in a virtualized environment with persistent state and data. In contrast to stateless VMs, stateful VMs rely on special resources on the server, such as GPU, pass-through disk, GPU, nvme, aep, DMA, etc.

[0029] Server: The host in a virtualization cluster refers to a physical server (also called a host or host), which constitutes the infrastructure in a virtualization environment. In a virtualization cluster, multiple hosts use virtualization software (such as VMware ESXi, Microsoft Hyper-V, KVM, etc.) to jointly manage and run multiple virtual machine instances. The server provides the physical environment for the virtual machine to run, such as CPU, memory, hard disk, GPU, network card, etc.

[0030] like Figure 1 As shown, in combination with an embodiment of the present invention, a method for creating a stateful virtual machine is provided, comprising:

[0031] S101: Acquire an initialization task from a task list, wherein the initialization task includes a task type and task information;

[0032] S102: When the task type of the initialization task is order creation and the state type is determined to be stateful according to the task information, generating a corresponding stateful order according to the task information of the initialization task, wherein the stateful order is used to lock resources for the stateful virtual machine to be created;

[0033] S103: Scheduling resources in the target server for the stateful order, anonymously locking the scheduled resources and setting an occupation lease for the anonymously locked resources;

[0034] S104: In the case where the task type of the initialization task is stateful virtual machine creation, anonymous locked resources within the occupied lease period are scheduled in the target server according to the corresponding stateful order, and a corresponding stateful virtual machine is created. The initialization task with the task type of stateful virtual machine creation is generated based on the corresponding stateful order.

[0035] Resources are scheduled in the target server for the stateful order, the scheduled resources are anonymously locked, and an occupation lease is set for the anonymously locked resources; instead of locking the stateful order and the scheduled resources in a real-name unique correspondence. Then, when the task type of the initialization task is any stateful virtual machine creation, it is determined whether there is a matching anonymously locked resource based on the resource specifications required for the stateful virtual machine creation. The anonymously locked resource can be: an anonymously locked resource that matches the stateful order corresponding to the stateful virtual machine creation, or an anonymously locked resource that matches other stateful orders, so that the anonymously locked resource is not occupied by the only stateful virtual machine creation, so that the resources are fully utilized and the waste of resources is avoided.

[0036] Preferably, the method for creating a stateful virtual machine further includes:

[0037] S105: constructing an initialization task related to virtual machine creation according to the input information corresponding to each field of the initialization task, and adding it to the task list; wherein the initialization task includes the following fields:

[0038] Task type, including order creation or stateful virtual machine creation;

[0039] Task information, including:

[0040] The unique identifier ID of the task, which is automatically incremented according to the number of tasks in the task list;

[0041] Account user, indicating the account that creates the task;

[0042] Namespace, which indicates the organization or business unit to which the task belongs, so as to distinguish the organization or business unit to which the task belongs;

[0043] The geographic region is used to specify the region where the virtual machine to be created for the task is located. Because resources cannot be mixed and need to be distinguished, the geographic region is used as a mark to distinguish resource clusters, such as Beijing region and Shanghai region.

[0044] Resource size, used to specify the resource size required for the task, that is, the model or configuration of the required resource;

[0045] The resource quantity num is used to specify the number of virtual machines that need to be created for the task;

[0046] The resource lease time indicates the actual lease time of the required resources for the created virtual machine, indicating the actual usage time of the resources;

[0047] The occupation lease period of the anonymous lock resource indicates the duration of time that the order is allowed to occupy the anonymous lock resource after the order is created and before the virtual machine is created according to the order. If the stateful virtual machine has not been created when the occupation period expires, the anonymous lock resource is automatically released. The occupation lease period of the anonymous lock resource is used to create the stateful virtual machine.

[0048] For example, the resource lease time is a one-year lease, and the anonymous locked resource occupation lease period tells the user to anonymously reserve the required resources for a period of time so that they can be used at any time. If the resources are not used after the reserved period, they will not be reserved again.

[0049] The order status Status includes active anonymous lock resource occupancy, inactive anonymous lock resource occupancy expired, or the order has been used by a stateful virtual machine.

[0050] Task list L: [ID, type, user, namespace, region, size, num, time, period, status, state]. Task list L is set by the user according to needs, such as creating an order for 3 virtual machines, or creating 3 virtual machines.

[0051] By initializing the task module, specific tasks can be defined and configured, and used in subsequent processes to perform operations such as order creation, resource scheduling, and resource occupation, so as to achieve automated task processing and effective use of resources.

[0052] Preferably, the method for creating a stateful virtual machine further includes:

[0053] S106: Determine the state type of the initialization task according to the input information corresponding to the resource specification, the state type includes stateful or stateless, and S106 is executed before S102. The main function of the consumption information unit is to consume the task list, read the task type, and classify and prioritize the tasks. According to the value of the type field in the task list L, it can be divided into two types: order creation and virtual machine creation, where virtual machine creation includes stateful virtual machine creation and stateless virtual machine creation.

[0054] Distinguish the state types of task types: stateful virtual machine creation and stateless virtual machine creation. When a stateful virtual machine is created, special requirements are identified according to L[size], such as [pass-through disk, GPU, nvme, aep, DMA, etc.]. When a stateful virtual machine is created, state=1 is added to the task list L, and when an ignorant state is created, state=0 is added to the task list L.

[0055] Preferably, the method for creating a stateful virtual machine, S102: when the task type of the initialization task is order creation and the state type is determined to be stateful according to the task information, generating a corresponding stateful order according to the task information of the initialization task, comprises:

[0056] S102-1: According to the state type of the initialization task being stateful, setting a processing priority for the corresponding stateful order, wherein the stateful processing priority is higher than the stateless processing priority;

[0057] S102-2: Reading input information corresponding to each field of the task information from the initialization task, converting the input information corresponding to each field into the corresponding field of the order information according to the set format, and constructing the stateful order information;

[0058] S102-3: Parse the stateful order information, and generate a corresponding stateful order according to the parsed stateful order information.

[0059] The task list created by the user is converted into the format specified by the status order information to facilitate automatic identification during subsequent use.

[0060] Preferably, S102-3: parsing the stateful order information, and generating a corresponding stateful order according to the parsed stateful order information, includes:

[0061] The stateful order information is parsed to extract parameters for creating a stateful virtual machine, wherein the parameters for creating a stateful virtual machine include: machine model, geographical region, resource specification, resource quantity, and special requirements corresponding to the creation of a stateful virtual machine identified from the resource specification, such as [through disk, GPU, etc.], wherein the machine model is determined according to the state type, and the machine model refers to a stateful virtual machine; the parameters for creating a stateful virtual machine are extracted by parsing the stateful order information, with the goal of realizing the creation of a stateful order and preparing for resource scheduling.

[0062] Then verify the order information, and verify whether the format of the parsed stateful order information is correct and whether the resource specifications are available;

[0063] In case of verification failure, a prompt is triggered to handle the error or prompt the user to make changes;

[0064] In case of successful verification, a corresponding stateful order is generated.

[0065] Verification can standardize the format of stateful order information to meet the requirements, and further confirm whether the resource specifications are available, so that subsequent work can be implemented smoothly.

[0066] Preferably, if Figure 6 As shown, S103: scheduling resources in the target server for the stateful order, anonymously locking the scheduled resources and setting an occupation lease for the anonymously locked resources, including:

[0067] That is, the corresponding processing logic is triggered according to the state. When L[state]=1, resource scheduling is performed, the scheduled resources are anonymously locked, and the occupation lease period is set for the anonymously locked resources. When L[state]==0, there is no state order and no special processing is required.

[0068] When L[state]=1, resource priority matching is performed within the cloud cluster according to the demand and actual cluster resource situation, and eligible servers are screened out; if the screening is not completed, resource scheduling is performed to screen out the server closest to the resource, and then the resources on the server are adjusted (usually migrated) to meet the scheduling requirements, thereby achieving effective scheduling and allocation of resources.

[0069] Because resources are divided from the target server, they are available when a stateless virtual machine is created, but they may be occupied by other resources. In order to avoid the situation where a stateful virtual machine has been created but there are no corresponding resources on the server, and the stateful virtual machine cannot be created. Anonymous locking resources are used to lock these resources. The locked resources will not be allocated again, but the anonymous locked resources can be used by the stateful virtual machine to create any matching order. Therefore, anonymous locking can increase liquidity and avoid resources being occupied by a single stateful order without building a stateful virtual machine, which causes resources to be idle for a long time and wastes resources.

[0070] S103-1: According to the resource specifications in the parameters for creating a stateful virtual machine, a target server that meets the resource specifications is selected from a cluster corresponding to the geographical area in the parameters for creating a stateful virtual machine; and resources that meet special requirements are filtered (e.g., a 4T pass-through disk, and a target server with a remaining pass-through disk of 4T or more needs to be selected).

[0071] S103-2: Score and sort each target server, score and sort the target servers that meet the resource specifications, and obtain the remaining resources of each target server from the resource pool: For example: resource_pool = [

[0072] {'name':'server1','cpu':8,'memory':16},

[0073] {'name':'server2','cpu':16,'memory':32},

[0074] {'name':'server3','cpu':32,'memory':64}].

[0075] Then the target server's resources are weighted and scored, such as weight: resource_quoate = [

[0076] {'cpu':0.8,'memory':0.2}], score resource_score = resource_pool*resource_quoate. Then sort the resource_score, schedule the resources of each target server in descending order, anonymously lock the scheduled resources corresponding to the stateful virtual machine, set an occupation lease for the anonymously locked resources, and the occupation lease does not exceed the set resource occupation threshold;

[0077] S103-3: Mark the order status of the initialization task as anonymous locked resource occupied, and mark the anonymous locked resource as unavailable.

[0078] During the scheduling process, for the target server that meets the resource specifications of the stateful order, the resources in the target server are scheduled, and anonymous locking is performed corresponding to the stateful virtual machine. Anonymous locked resources are created and placed in the resource pool to ensure that the server can meet the resource requirements of the stateful order and prevent stateless virtual machines from occupying the resources. The anonymous occupation lasts until a stateful virtual machine is created or the occupation lease expires. When the anonymous locked resource lease expires, the occupied resources are released. During the period of anonymous locked occupation of resources, the locked resources will be marked as unavailable to ensure that they are not occupied by requests other than the creation of stateful virtual machines.

[0079] Resource lock occupation will affect resource utilization and flexibility. Therefore, the period is usually short. If no stateful order is used to create in a short period of time, the anonymous lock resource will no longer be retained. If a stateful order needs to create a virtual machine, if the anonymous lock resource is available, the resource needs to be scheduled again.

[0080] Preferably, if Figure 6 As shown, S103: scheduling resources in the target server for the stateful order, anonymously locking the scheduled resources and setting an occupation lease for the anonymously locked resources, further comprising:

[0081] S103-4: In the process of scheduling the resources of each target server in the order of high to low scores, if the remaining resources of any target server are less than the resource specification required by a single stateful virtual machine in the stateful order, the resources on the target server need to be rescheduled. That is, the stateless virtual machines on the current target server are screened out, the resource requirements of each stateless virtual machine are scored, and the stateless virtual machines are sorted in the order of low to high scores;

[0082] S103-5: Scheduling starts from the resources occupied by the stateless virtual machine with the lowest score until the resource specifications of the stateful order are met.

[0083] By rescheduling the resources on the target server, the priority processing of stateful orders is matched to meet the demand for priority creation of stateful virtual machines.

[0084] Preferably, S104: when the task type of the initialization task is stateful virtual machine creation, anonymous locked resources within an occupied lease period in the target server are scheduled according to the corresponding stateful order, and a corresponding stateful virtual machine is created, including:

[0085] S104-1: When the task type of the initialization task is stateful virtual machine creation, searching whether there is an anonymous locked resource within the occupied lease period;

[0086] S104-2: If there are anonymous locked resources within the occupied lease period, directly modify the name of the available anonymous locked resources to the input information corresponding to the namespace in the stateful order information, the stateful virtual machine is created, and the order status is marked as the order has been used by the stateful virtual machine creation;

[0087] The order information task list L[state]==0 is the stateful virtual machine creation. According to the required resource specifications, it is determined whether there are matching anonymous locked resources. The anonymous locked resources can be: anonymous locked resources that match the stateful order corresponding to the stateful virtual machine creation, or anonymous locked resources that match other stateful orders, so that the anonymous locked resources are not occupied by the only stateful virtual machine creation, thereby achieving full utilization of resources and avoiding waste of resources.

[0088] For the creation of a stateless virtual machine with L[state]==0, there is no need to search for locked resources, and resource scheduling is performed directly, and the virtual machine is created based on the scheduling result.

[0089] S104-3: If there is no anonymous locked resource within the occupied lease period, the resources are scheduled in the target server according to the stateful order information and the scheduled resources are locked. The name of the scheduled resources is modified to the input information corresponding to the namespace in the stateful order information. The stateful virtual machine is created and the order status is marked as the order has been used by the stateful virtual machine creation.

[0090] In summary, the judgment logic for creating a stateful virtual machine is as follows: Figure 4 As shown in the figure, a sequential process of creating a stateful virtual machine is as follows Figure 5 shown.

[0091] like Figure 2 As shown, in combination with an embodiment of the present invention, a system for creating a stateful virtual machine is provided, comprising:

[0092] A task acquisition unit 21 is used to acquire an initialization task from a task list, wherein the initialization task includes a task type and task information;

[0093] An order creation unit 22, configured to generate a corresponding stateful order according to the task information of the initialization task when the task type of the initialization task is order creation and the state type is determined to be stateful according to the task information, wherein the stateful order is used to lock resources for the stateful virtual machine to be created;

[0094] A resource scheduling unit 23, configured to schedule resources in a target server for the stateful order, anonymously lock the scheduled resources, and set an occupation lease for the anonymously locked resources;

[0095] A virtual machine creation unit 24 is used to schedule anonymous locked resources within an occupied lease period in the target server according to a corresponding stateful order and create a corresponding stateful virtual machine when the task type of the initialization task is stateful virtual machine creation. The initialization task with a task type of stateful virtual machine creation is generated based on the corresponding stateful order.

[0096] The resources are scheduled in the target server for the stateful order, the scheduled resources are anonymously locked, and an occupation lease is set for the anonymously locked resources; instead of locking the stateful order and the scheduled resources in a real-name unique correspondence. Then, when the task type of the initialization task is any stateful virtual machine creation, it is determined whether there is a matching anonymously locked resource based on the resource specifications required for the stateful virtual machine creation. The anonymously locked resource can be: an anonymously locked resource that matches the stateful order corresponding to the stateful virtual machine creation, or an anonymously locked resource that matches other stateful orders, so that the anonymously locked resource is not occupied by the only stateful virtual machine creation, so that the resources are fully utilized and the waste of resources is avoided.

[0097] Preferably, the system for creating a stateful virtual machine further includes:

[0098] The initialization task unit is used to construct an initialization task related to virtual machine creation according to the input information corresponding to each field of the initialization task, and add it to the task list; wherein the initialization task includes the following fields:

[0099] Task type, including order creation or stateful virtual machine creation;

[0100] Task information, including:

[0101] The unique identifier ID of the task, which is automatically incremented according to the number of tasks in the task list;

[0102] Account user, indicating the account that creates the task;

[0103] Namespace, which indicates the organization or business unit to which the task belongs, so as to distinguish the organization or business unit to which the task belongs;

[0104] The geographic region is used to specify the region where the virtual machine to be created for the task is located. Because resources cannot be mixed and need to be distinguished, the geographic region is used as a mark to distinguish resource clusters, such as Beijing region and Shanghai region.

[0105] Resource size, used to specify the resource size required for the task, that is, the model or configuration of the required resource;

[0106] The resource quantity num is used to specify the number of virtual machines that need to be created for the task;

[0107] The resource lease time indicates the actual lease time of the required resources for the created virtual machine, indicating the actual usage time of the resources;

[0108] The occupation lease period of the anonymous lock resource indicates the duration of time that the order is allowed to occupy the anonymous lock resource after the order is created and before the virtual machine is created according to the order. If the stateful virtual machine has not been created when the occupation period expires, the anonymous lock resource is automatically released. The occupation lease period of the anonymous lock resource is used to create the stateful virtual machine.

[0109] For example, the resource lease time is a one-year lease, and the anonymous locked resource occupation lease period tells the user to anonymously reserve the required resources for a period of time so that they can be used at any time. If the resources are not used after the reserved period, they will not be reserved again.

[0110] The order status Status includes active anonymous lock resource occupancy, inactive anonymous lock resource occupancy expired, or the order has been used by a stateful virtual machine.

[0111] Task list L: [ID, type, user, namespace, region, size, num, time, period, status, state]. Task list L is set by the user according to needs, such as creating an order for 3 virtual machines, or creating 3 virtual machines.

[0112] By initializing the task module, specific tasks can be defined and configured, and used in subsequent processes to perform operations such as order creation, resource scheduling, and resource occupation, so as to achieve automated task processing and effective use of resources.

[0113] Preferably, the system for creating a stateful virtual machine further includes:

[0114] The message consumption unit is used to determine the state type of the initialization task according to the input information corresponding to the resource specification, and the state type includes stateful or stateless. The main function of the information consumption unit is to consume the task list, read the task type, and classify and prioritize the tasks. According to the value of the type field in the task list L, it can be divided into two types: order creation and virtual machine creation, where virtual machine creation includes stateful virtual machine creation and stateless virtual machine creation.

[0115] Distinguish the state types of task types: stateful virtual machine creation and stateless virtual machine creation. When a stateful virtual machine is created, special requirements are identified according to L[size], such as [pass-through disk, GPU, nvme, aep, DMA, etc.]. When a stateful virtual machine is created, state=1 is added to the task list L, and when an ignorant state is created, state=0 is added to the task list L.

[0116] Preferably, the order creation unit includes:

[0117] An order priority setting subunit, used to set a processing priority for a corresponding stateful order according to the state type of the initialization task being stateful, wherein the stateful processing priority is higher than the stateless processing priority;

[0118] An order information construction subunit is used to read the input information corresponding to each field of the task information from the initialization task, convert the input information corresponding to each field into the corresponding field of the order information according to the set format, and construct the stateful order information;

[0119] The order construction subunit is used to parse the stateful order information and generate a corresponding stateful order according to the parsed stateful order information.

[0120] The task list created by the user is converted into the format specified by the status order information to facilitate automatic identification during subsequent use.

[0121] Preferably, the order construction subunit is specifically used for:

[0122] The stateful order information is parsed to extract parameters for creating a stateful virtual machine, wherein the parameters for creating a stateful virtual machine include: machine model, geographical region, resource specification, resource quantity, and special requirements corresponding to the creation of a stateful virtual machine identified from the resource specification, such as [through disk, GPU, etc.], wherein the machine model is determined according to the state type, and the machine model refers to a stateful virtual machine; the parameters for creating a stateful virtual machine are extracted by parsing the stateful order information, with the goal of realizing the creation of a stateful order and preparing for resource scheduling.

[0123] Then verify the order information, and verify whether the format of the parsed stateful order information is correct and whether the resource specifications are available;

[0124] In case of verification failure, a prompt is triggered to handle the error or prompt the user to make changes;

[0125] If the verification is successful, the corresponding stateful order is generated. The verification can standardize the format of the stateful order information to meet the requirements, and further confirm whether the resource specifications are available, so that the subsequent work can be smoothly implemented.

[0126] The resource scheduling unit is specifically used to:

[0127] That is, the corresponding processing logic is triggered according to the state. When L[state]=1, resource scheduling is performed, the scheduled resources are anonymously locked, and the occupation lease period is set for the anonymously locked resources. When L[state]==0, there is no state order and no special processing is required.

[0128] When L[state]=1, resource priority matching is performed within the cloud cluster according to the demand and actual cluster resource situation, and eligible servers are screened out; if the screening is not completed, resource scheduling is performed to screen out the server closest to the resource, and then the resources on the server are adjusted (usually migrated) to meet the scheduling requirements, thereby achieving effective scheduling and allocation of resources.

[0129] Because resources are divided from the target server, they are available when a stateless virtual machine is created, but they may be occupied by other resources. In order to avoid the situation where a stateful virtual machine has been created but there are no corresponding resources on the server, and the stateful virtual machine cannot be created. Anonymous locking resources are used to lock these resources. The locked resources will not be allocated again, but the anonymous locked resources can be used by the stateful virtual machine to create any matching order. Therefore, anonymous locking can increase liquidity and avoid resources being occupied by a single stateful order without building a stateful virtual machine, which causes resources to be idle for a long time and wastes resources.

[0130] According to the resource specifications in the parameters for creating a stateful virtual machine, a target server that meets the resource specifications is screened out from the cluster corresponding to the geographical area in the parameters for creating the stateful virtual machine; at the same time, resources that meet special requirements are filtered out (for example, a 4T pass-through disk requires screening out target servers with remaining 4T or more pass-through disks).

[0131] Score and sort each target server, score and sort the target servers that meet the resource specifications, and obtain the remaining resources of each target server from the resource pool: For example: resource_pool = [

[0132] {'name':'server1','cpu':8,'memory':16},

[0133] {'name':'server2','cpu':16,'memory':32},

[0134] {'name':'server3','cpu':32,'memory':64}].

[0135] Then the target server's resources are weighted and scored, such as weight: resource_quoate = [

[0136] {'cpu':0.8,'memory':0.2}], score resource_score = resource_pool*resource_quoate. Then sort the resource_score, schedule the resources of each target server in descending order, anonymously lock the scheduled resources corresponding to the stateful virtual machine, set an occupation lease for the anonymously locked resources, and the occupation lease does not exceed the set resource occupation threshold;

[0137] The order status of the initialization task is marked as anonymous locked resource being occupied, and the anonymous locked resource is marked as unavailable.

[0138] During the scheduling process, for the target server that meets the resource specifications of the stateful order, the resources in the target server are scheduled, and anonymous locking is performed corresponding to the stateful virtual machine. Anonymous locked resources are created and placed in the resource pool to ensure that the server can meet the resource requirements of the stateful order and prevent stateless virtual machines from occupying the resources. The anonymous occupation lasts until a stateful virtual machine is created or the occupation lease expires. When the anonymous locked resource lease expires, the occupied resources are released. During the period of anonymous locked occupation of resources, the locked resources will be marked as unavailable to ensure that they are not occupied by requests other than the creation of stateful virtual machines.

[0139] Resource lock occupation will affect resource utilization and flexibility. Therefore, the period is usually short. If no stateful order is used to create in a short period of time, the anonymous lock resource will no longer be retained. If a stateful order needs to create a virtual machine, if the anonymous lock resource is available, the resource needs to be scheduled again.

[0140] The resource scheduling unit is specifically used to:

[0141] In the process of scheduling the resources of each target server in the order of high to low scores, if the remaining resources of any target server are less than the resource specification size required by a single stateful virtual machine in the stateful order, the resources on the target server need to be rescheduled. That is, the stateless virtual machines on the current target server are screened out, the resource requirements of each stateless virtual machine are scored, and the stateless virtual machines are sorted in the order of low to high scores;

[0142] Scheduling starts from the resources occupied by the stateless virtual machine with the lowest score until the resource specifications of the stateful order are met.

[0143] By rescheduling the resources on the target server, the priority processing of stateful orders is matched to meet the demand for priority creation of stateful virtual machines.

[0144] The virtual machine creation unit is specifically used for:

[0145] In the case where the task type of the initialization task is stateful virtual machine creation, searching whether there is an anonymous locked resource within the occupied lease period;

[0146] If there are anonymous locked resources within the occupied lease period, directly modify the name of the available anonymous locked resources to the input information corresponding to the namespace in the stateful order information, the stateful virtual machine is created, and the order status is marked as the order has been used by the stateful virtual machine creation;

[0147] The order information task list L[state]==0 is the stateful virtual machine creation. According to the required resource specifications, it is determined whether there are matching anonymous locked resources. The anonymous locked resources can be: anonymous locked resources that match the stateful order corresponding to the stateful virtual machine creation, or anonymous locked resources that match other stateful orders, so that the anonymous locked resources are not occupied by the only stateful virtual machine creation, thereby achieving full utilization of resources and avoiding waste of resources.

[0148] For the creation of a stateless virtual machine with L[state]==0, there is no need to search for locked resources, and resource scheduling is performed directly, and the virtual machine is created based on the scheduling result.

[0149] If there is no anonymous locked resource in the occupied lease period, the resources are scheduled and locked in the target server according to the stateful order information, the name of the scheduled resource is modified to the input information corresponding to the namespace in the stateful order information, the stateful virtual machine is created, and the order status is marked as the order has been used by the stateful virtual machine creation.

[0150] In conjunction with an embodiment of the present invention, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores one or more programs, and when the one or more programs are executed by a computer device, the computer device executes the aforementioned method for creating a stateful virtual machine.

[0151] like Figure 3 As shown, in combination with an embodiment of the present invention, a computer device is provided, including:

[0152] A processor; and a memory arranged to store computer executable instructions, wherein when the executable instructions are executed, the processor executes the aforementioned method for creating a stateful virtual machine.

[0153] The above technical solution of the embodiment of the present invention is described in detail below in conjunction with specific application examples. For technical details not introduced during the implementation process, please refer to the relevant description in the previous text.

[0154] The beneficial technical effects achieved by the embodiments of the present invention are as follows:

[0155] In the embodiment of the present invention, a stateful virtual machine is finally created by initializing task creation, consuming information, creating a stateful order, scheduling resources for the stateful order, and anonymously occupying resources. Resources are scheduled in the target server for the stateful order, the scheduled resources are anonymously locked, and an occupation lease is set for the anonymously locked resources; instead of locking the stateful order and the scheduled resources in a real-name unique correspondence. Then, when the task type of the initialization task is any stateful virtual machine creation, it is determined whether there are matching anonymous locked resources based on the resource specifications required for the stateful virtual machine creation. The anonymous locked resources can be: anonymous locked resources that match the stateful order corresponding to the stateful virtual machine creation, or anonymous locked resources that match other stateful orders, so that the anonymous locked resources are not occupied by the only stateful virtual machine creation, so that the resources are fully utilized and the waste of resources is avoided.

[0156] 1. In the embodiments of the present invention, resource utilization and universality of physical servers are improved, and the real-name locking of server resources is no longer used to limit resource allocation. Resources are retrieved within the entire cluster, and the scheduling scope is for the entire cluster, and there is no need to distinguish between physical server categories. It can effectively improve cluster utilization and resource adaptability, and there is no manual restriction on the scheduling of stateful resources. In theory, all virtual machines can be scheduled to stateful servers, which improves the utilization of stateful resources and the universality of resources. In addition, resource locks are automatically released upon expiration, which can meet the requirements of resource utilization and resource liquidity. It avoids the technical problem of the prior art that "the current scheduling scheme has low resource utilization and requires specific servers. The current solution is to lock resources on servers with specific resources and not allow other virtual machines to be scheduled to these servers. If there is a demand for stateful virtual machines, the restrictions will be lifted. This causes the resources on these servers to be often idle."

[0157] 2. In the embodiment of the present invention, resource scheduling for stateful virtual machines takes precedence over resource scheduling for stateless virtual machines. The server where special resources are located does not need to be restricted, which can meet the needs of users to create stateful orders and virtual machines at any time. The real-time performance of the system is better, the scheduling accuracy is improved, and scheduling algorithms are used for scheduling matching to more accurately schedule resources to reasonable servers. The technical problem of the prior art is avoided: "The current scheduling scheme has poor scheduling accuracy. During the creation of a stateful virtual machine, resources are open to the entire cluster, and non-stateful virtual machines can also be scheduled to specific resources, resulting in resource occupation and reducing the availability of specific resources."

[0158] 3. In the embodiments of the present invention, the resource scheduling method is simplified and the operation complexity is reduced. The scheduling efficiency is high and the operation is simple. The allocation and locking of stateful resources are completed by the system without manual operation, and multiple orders can be completed in parallel. Simplify personnel operations, improve operational efficiency, reduce operational complexity and reduce manual participation. It allows maintenance personnel to focus more on improving technology. The scheduling accuracy is higher. Through the resource weighted scoring algorithm, resources can be better scheduled to avoid subjective scheduling by maintenance personnel, resulting in poor scheduling accuracy, uneven distribution of virtual machines and other problems. It avoids the technical problems of the prior art "The current scheduling scheme requires manual resource locking and release, which has the problems of low efficiency and complex scheduling. First, it is necessary to manually select a server with specific resources as an alternative and lock the resources. Then, when creating a virtual machine, it is necessary to unlock the resources first, and finally create the server, and lock the resources after the server is created. The entire operation process is long, there are many steps, and the operation is cumbersome."

[0159] It should be understood that the specific order or hierarchy of steps in the disclosed process is an example of an exemplary method. Based on design preferences, it should be understood that the specific order or hierarchy of steps in the process can be rearranged without departing from the scope of protection of the present disclosure. The attached method claims present the elements of the various steps in an exemplary order and are not intended to be limited to the specific order or hierarchy described.

[0160] In the above detailed description, various features are grouped together in a single embodiment to simplify the disclosure. This method of disclosure should not be interpreted as reflecting an intention that the embodiments of the claimed subject matter require more features than are clearly stated in each claim. On the contrary, as reflected in the appended claims, the invention is in a state of having less than all the features of the disclosed individual embodiments. Therefore, the appended claims are hereby expressly incorporated into the detailed description, with each claim standing on its own as a separate preferred embodiment of the invention.

[0161] The disclosed embodiments are described above to enable any person skilled in the art to implement or use the present invention. Various modifications of these embodiments are obvious to those skilled in the art, and the general principles defined herein may also be applied to other embodiments without departing from the spirit and scope of the present disclosure. Therefore, the present disclosure is not limited to the embodiments given herein, but is consistent with the broadest scope of the principles and novel features disclosed in this application.

[0162] The above description includes examples of one or more embodiments. Of course, it is impossible to describe all possible combinations of components or methods for the purpose of describing the above embodiments, but it should be recognized by those skilled in the art that the various embodiments may be further combined and arranged. Therefore, the embodiments described herein are intended to cover all such changes, modifications and variations that fall within the scope of protection of the appended claims. In addition, with respect to the term "comprising" used in the specification or claims, the word is covered in a manner similar to the term "including", just as "including," is explained as a transitional word in the claims. In addition, any term "or" used in the specification of the claims is intended to mean "non-exclusive or".

[0163] Those skilled in the art may also understand that the various illustrative logical blocks, units, and steps listed in the embodiments of the present invention may be implemented by electronic hardware, computer software, or a combination of the two. In order to clearly demonstrate the interchangeability of hardware and software, the various illustrative components, units, and steps described above have generally described their functions. Whether such functions are implemented by hardware or software depends on the specific application and the design requirements of the entire system. Those skilled in the art may use various methods to implement the described functions for each specific application, but such implementation should not be understood as exceeding the scope of protection of the embodiments of the present invention.

[0164] The various illustrative logic blocks or units described in the embodiments of the present invention can be implemented or operated by a general-purpose processor, a digital signal processor, an application-specific integrated circuit (ASIC), a field programmable gate array or other programmable logic device, a discrete gate or transistor logic, a discrete hardware component, or any combination of the above. The general-purpose processor can be a microprocessor, and optionally, the general-purpose processor can also be any conventional processor, controller, microcontroller or state machine. The processor can also be implemented by a combination of computing devices, such as a digital signal processor and a microprocessor, a plurality of microprocessors, one or more microprocessors combined with a digital signal processor core, or any other similar configuration.

[0165] The steps of the method or algorithm described in the embodiments of the present invention can be directly embedded in hardware, a software module executed by a processor, or a combination of the two. The software module can be stored in a RAM memory, a flash memory, a ROM memory, an EPROM memory, an EEPROM memory, a register, a hard disk, a removable disk, a CD-ROM, or other storage media of any form in the art. Exemplarily, the storage medium can be connected to the processor so that the processor can read information from the storage medium and can write information to the storage medium. Optionally, the storage medium can also be integrated into the processor. The processor and the storage medium can be arranged in an ASIC, and the ASIC can be arranged in a user terminal. Optionally, the processor and the storage medium can also be arranged in different components in the user terminal.

[0166] In one or more exemplary designs, the above functions described in the embodiments of the present invention can be implemented in hardware, software, firmware or any combination of the three. If implemented in software, these functions can be stored on a computer-readable medium, or transmitted in the form of one or more instructions or codes on a computer-readable medium. Computer-readable media include computer storage media and communication media that facilitate the transfer of computer programs from one place to another. The storage medium can be any available medium that can be accessed by any general or special computer. For example, such computer-readable media can include but are not limited to RAM, ROM, EEPROM, CD-ROM or other optical disk storage, disk storage or other magnetic storage devices, or any other medium that can be used to carry or store program codes in the form of instructions or data structures and other forms that can be read by general or special computers, or general or special processors. In addition, any connection can be appropriately defined as a computer-readable medium, for example, if the software is transmitted from a website site, server or other remote resource through a coaxial cable, fiber optic cable, twisted pair, digital subscriber line (DSL) or wirelessly, such as infrared, wireless and microwave, it is also included in the defined computer-readable medium. The disk and disc include compact disk, laser disk, optical disk, DVD, floppy disk and blue-ray disk. Disks usually copy data magnetically, while discs usually copy data optically with lasers. The above combination can also be included in computer readable media.

[0167] The specific implementation methods described above further illustrate the objectives, technical solutions and beneficial effects of the present invention in detail. It should be understood that the above description is only a specific implementation method of the present invention and is not intended to limit the scope of protection of the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present invention should be included in the scope of protection of the present invention.

Claims

1. A method for creating a stateful virtual machine, characterized in that: include: Acquire an initialization task from the task list, wherein the initialization task includes a task type and task information; When the task type of the initialization task is order creation and the state type is determined to be stateful according to the task information, a corresponding stateful order is generated according to the task information of the initialization task, and the stateful order is used to lock resources for the stateful virtual machine to be created; Scheduling resources in the target server for the stateful order, anonymously locking the scheduled resources and setting an occupation lease for the anonymously locked resources; In the case where the task type of the initialization task is stateful virtual machine creation, anonymous locked resources within the occupied lease period are scheduled in the target server according to the corresponding stateful order, and the corresponding stateful virtual machine is created. The initialization task with the task type of stateful virtual machine creation is generated based on the corresponding stateful order.

2. The method for creating a stateful virtual machine according to claim 1, characterized in that: Also includes: According to the input information corresponding to each field of the initialization task, construct an initialization task related to virtual machine creation and add it to the task list; wherein the initialization task includes the following fields: Task type, including order creation or stateful virtual machine creation; Task information, including: The unique identifier of the task, which is automatically incremented according to the number of tasks in the task list; Account, which indicates the account that created the task; Namespace, which indicates the organization or business unit to which the task belongs; Geographic region, which is used to specify the region where the virtual machine to be created for the task is located; Resource specifications, which are used to specify the model or configuration of resources required for the task; Resource quantity, which is used to specify the number of virtual machines that need to be created for the task; The resource lease period indicates the actual lease period of the required resources for the created virtual machine. The occupation lease of the anonymous locked resource indicates the duration of time that the anonymous locked resource is allowed to be occupied by the order after the order is created and before a virtual machine is created according to the order. If the stateful virtual machine has not been created when the occupation time expires, the anonymous locked resource is automatically released, wherein the occupation lease of the anonymous locked resource is used to create a stateful virtual machine; Order status, including anonymous lock resource occupancy, anonymous lock resource occupancy expired, or the order has been used by stateful virtual machine creation.

3. The method for creating a stateful virtual machine according to claim 2, characterized in that: Also includes: According to input information corresponding to the resource specification, a state type of the initialization task is determined, where the state type includes stateful or stateless.

4. The method for creating a stateful virtual machine according to claim 3, characterized in that: When the task type of the initialization task is order creation and the state type is determined to be stateful according to the task information, generating a corresponding stateful order according to the task information of the initialization task includes: According to the state type of the initialization task being stateful, setting a processing priority for the corresponding stateful order, wherein the processing priority of the stateful order is higher than the processing priority of the stateless order; Read the input information corresponding to each field of the task information from the initialization task, convert the input information corresponding to each field into the corresponding field of the order information according to the set format, and construct the stateful order information; The stateful order information is parsed, and a corresponding stateful order is generated according to the parsed stateful order information.

5. The method for creating a stateful virtual machine according to claim 4, characterized in that: The parsing of the stateful order information and generating a corresponding stateful order according to the parsed stateful order information includes: Parsing the stateful order information, extracting parameters for creating a stateful virtual machine, wherein the parameters for creating a stateful virtual machine include: a machine model, a geographical region, a resource specification, a resource quantity, and a special requirement corresponding to the creation of the stateful virtual machine identified from the resource specification, wherein the machine model is determined according to the state type, and the machine model refers to a stateful virtual machine; Verifying whether the format of the parsed stateful order information is correct and whether the resource specifications are available; In case of verification failure, a prompt is triggered to handle the error or prompt the user to make changes; In case of successful verification, a corresponding stateful order is generated.

6. The method for creating a stateful virtual machine according to claim 5, characterized in that: The step of scheduling resources in the target server for the stateful order, anonymously locking the scheduled resources, and setting an occupation lease for the anonymously locked resources includes: According to the resource specifications in the parameters for creating the stateful virtual machine, a target server meeting the resource specifications is selected from a cluster corresponding to the geographical area in the parameters for creating the stateful virtual machine; Scoring and ranking each target server, scheduling resources of each target server in descending order of scores, anonymously locking the scheduled resources corresponding to the stateful virtual machines, and setting an occupation lease for the anonymously locked resources, wherein the occupation lease does not exceed a set resource occupation threshold; The order status of the initialization task is marked as anonymous locked resource being occupied, and the anonymous locked resource is marked as unavailable.

7. The method for creating a stateful virtual machine according to claim 6, characterized in that: The step of scheduling resources in the target server for the stateful order, anonymously locking the scheduled resources and setting an occupation lease for the anonymously locked resources also includes: In the process of scheduling the resources of each target server in the order of high to low scores, if the remaining resources of any target server are less than the resource specification size required by a single stateful virtual machine in the stateful order, the stateless virtual machines on the current target server are screened out, the resource requirements of each stateless virtual machine are scored, and the stateless virtual machines are sorted in the order of low to high scores; Scheduling starts from the resources occupied by the stateless virtual machine with the lowest score until the resource specifications of the stateful order are met.

8. The method for creating a stateful virtual machine according to claim 6, characterized in that: In the case where the task type of the initialization task is stateful virtual machine creation, anonymous locked resources in the occupied lease period in the target server are scheduled according to the corresponding stateful order, and a corresponding stateful virtual machine is created, including: In the case where the task type of the initialization task is stateful virtual machine creation, searching whether there is an anonymous locked resource within the occupied lease period; If there are anonymous locked resources within the occupied lease period, directly modify the name of the available anonymous locked resources to the input information corresponding to the namespace in the stateful order information, the stateful virtual machine is created, and the order status is marked as the order has been used by the stateful virtual machine creation; If there is no anonymous locked resource in the occupied lease period, the resources are scheduled and locked in the target server according to the stateful order information, the name of the scheduled resource is modified to the input information corresponding to the namespace in the stateful order information, the stateful virtual machine is created, and the order status is marked as the order has been used by the stateful virtual machine creation.

9. A system for creating a stateful virtual machine, characterized in that: include: A task acquisition unit, used to acquire an initialization task from a task list, wherein the initialization task includes a task type and task information; An order creation unit, configured to generate a corresponding stateful order according to the task information of the initialization task when the task type of the initialization task is order creation and the state type is determined to be stateful according to the task information, wherein the stateful order is used to lock resources for the stateful virtual machine to be created; A resource scheduling unit, used for scheduling resources in a target server for the stateful order, anonymously locking the scheduled resources and setting an occupation lease for the anonymously locked resources; A virtual machine creation unit is used to schedule anonymous locked resources within the occupied lease period in the target server according to the corresponding stateful order when the task type of the initialization task is stateful virtual machine creation, and create a corresponding stateful virtual machine. The initialization task with the task type of stateful virtual machine creation is generated based on the corresponding stateful order.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores one or more programs, and when the one or more programs are executed by a computer device, the computer device executes the method for creating a stateful virtual machine according to any one of claims 1 to 8.

11. A computer device, characterized in that: include: processor; And, a memory arranged to store computer executable instructions, which, when executed, cause the processor to execute the method for creating a stateful virtual machine as described in any one of claims 1-8.