Cloud resource scheduling method and device, electronic equipment and storage medium
Through the unified cloud resource application request mechanism, the complexity and resource management inconsistency caused by the independent scheduling logic of virtual machines and bare metal resource scheduling is solved, and the unified resource scheduling and management consistency are achieved.
Patent Information
- Application Number
- CN202411756605.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-02
- Publication Date
- 2025-04-08
AI Technical Summary
In the existing cloud resource scheduling system, the scheduling logic of virtual machines and bare metal resources is independent, resulting in high scheduling complexity, inconsistent resource management, and inability to schedule uniformly.
Through the unified cloud resource application request mechanism, the user's resource application request is obtained, and the target resource type and quantity are determined based on the request, and the target node that meets the conditions is selected in the resource pool and dispatch it to the user.
It realizes the scheduling logic of virtual machines and bare metal resources and the consistency of resource management, and can perform resource scheduling in a unified scheduling system, solving the problems of inconsistent scheduling complexity and resource management.
Smart Images

Figure CN119781960A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of cloud computing technology, and in particular to a cloud resource scheduling method and device, an electronic device, and a storage medium. Background Art
[0002] In traditional cloud resource scheduling systems, the scheduling of virtual machines (VMs) and bare metal resources in cloud resources is usually handled in different ways. Virtual machine scheduling usually includes the following steps:
[0003] 1. Resource filtering: The scheduling system will select suitable candidate hosts from multiple hosts.
[0004] 2. Resource selection: The system selects the most suitable designated host from the candidate hosts to meet the resource requirements of the virtual machine.
[0005] 3. Resource pre-occupancy: Forward the virtual machine request to the selected designated host machine and pre-occupy resources.
[0006] The scheduling of bare metal resources is relatively simple, usually by directly applying for resource purchase without going through a detailed scheduling process. In other words, the scheduling of bare metal resources only focuses on whether there are available bare metal resources that can be sold directly, and does not involve complex resource matching and sharing mechanisms.
[0007] In the related art, the scheduling logic of virtual machines and bare metal resources is independent of each other, resulting in the scheduling services used to implement the scheduling of virtual machines and bare metal resources needing to handle different scheduling strategies and business attributes, increasing the complexity of the scheduling logic; in addition, virtual machines and bare metal resources use different management methods, which may lead to inconsistent resource management and affect the overall resource utilization efficiency and scheduling consistency; finally, because bare metal resources in the related art only focus on whether there are available bare metal resources that can be sold directly, the resource application and allocation process is not flexible enough and cannot be scheduled in a unified scheduling system.
[0008] Therefore, related technologies have technical problems such as high complexity of scheduling logic for virtual machines and bare metal resources in cloud resources, inconsistent resource management, and inability to uniformly schedule. Summary of the invention
[0009] The present application provides a cloud resource scheduling method and device, an electronic device and a storage medium to at least solve the problems in the related art of high complexity in scheduling logic of virtual machines and bare metal resources in cloud resources, inconsistent resource management and inability to uniformly schedule.
[0010] According to one aspect of an embodiment of the present application, a cloud resource scheduling method is provided, including:
[0011] Obtain cloud resource application requests from target users;
[0012] Determine the target cloud resource type and target resource amount to be applied for according to the cloud resource application request, wherein the cloud resource type includes: virtual machine and bare metal resource;
[0013] Selecting a target node that meets the target resource type and the target resource amount in the resource pool;
[0014] The target node is dispatched to the target user.
[0015] Optionally, as described in any of the preceding methods, determining the target cloud resource type and target resource amount to be applied for according to the cloud resource application request includes:
[0016] In a case where the cloud resource application request includes at least one first field type for applying for a virtual machine, determining that the target cloud resource type required to be applied for by the cloud resource application request is a virtual machine;
[0017] The target resource amount is determined by determining a field value corresponding to each first field type in the cloud resource application request.
[0018] Optionally, as described in any of the preceding methods, determining the target cloud resource type and target resource amount to be applied for according to the cloud resource application request includes:
[0019] In a case where the cloud resource application request includes a second field type for applying for a bare metal resource, determining that the target cloud resource type required to be applied for by the cloud resource application request is a bare metal resource;
[0020] The target resource amount is determined by determining a field value corresponding to the second field type in the cloud resource application request.
[0021] Optionally, as described in any of the preceding methods, selecting a target node that meets the target resource type and the target resource amount in the resource pool includes:
[0022] In a case where the target resource type is the virtual machine, determining host resources of each available host machine in all available host machines in the resource pool;
[0023] A target host whose host resources meet the target resource amount is selected from all the available host machines, and the target host machine is determined as the target node.
[0024] Optionally, as described in any of the preceding methods, selecting a target node that meets the target resource type and the target resource amount in the resource pool includes:
[0025] When the target resource type is the bare metal resource, determining all unsold bare metal nodes in the resource pool;
[0026] Among all the unsold bare metal nodes, target bare metal nodes that meet the target number indicated by the target resource amount are selected, and the target bare metal nodes of the target number are determined as the target nodes.
[0027] Optionally, as described in any of the preceding methods, before scheduling the target node to the target user, the method further includes:
[0028] Marking the target node as pre-occupied;
[0029] Pre-occupancy information for indicating that the target node is to be pre-occupied is added to the resource pre-occupancy report.
[0030] Optionally, the method as described in any of the preceding items further includes:
[0031] Obtaining the current resource usage status of each resource in the resource pool at the current moment;
[0032] A resource status report is generated to indicate a current resource usage status of each resource.
[0033] According to another aspect of the embodiment of the present application, a cloud resource scheduling device is also provided, including:
[0034] An acquisition module is used to obtain cloud resource application requests from target users;
[0035] A determination module is used to determine the target cloud resource type and target resource amount required to be applied for according to the cloud resource application request, wherein the cloud resource type includes: virtual machine and bare metal resource;
[0036] A selection module, used to select a target node that meets the target resource type and the target resource amount in the resource pool;
[0037] A scheduling module is used to schedule the target node to the target user.
[0038] According to another aspect of the embodiments of the present application, there is also provided an electronic device, including a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other via the communication bus; wherein the memory is used to store a computer program; and the processor is used to execute the method steps in any of the above embodiments by running the computer program stored in the memory.
[0039] According to another aspect of the embodiments of the present application, a computer-readable storage medium is provided, in which a computer program is stored, wherein the computer program is configured to execute the method steps in any of the above embodiments when executed.
[0040] In the embodiment of the present application, a method of obtaining a request for a virtual machine and a bare metal resource by a unified cloud resource application request is adopted, by obtaining a cloud resource application request from a target user; determining the target cloud resource type and the target resource amount required to be applied for according to the cloud resource application request, wherein the cloud resource type includes: a virtual machine and a bare metal resource; selecting a target node that meets the target resource type and the target resource amount in the resource pool; and scheduling the target node to the target user. Since a unified cloud resource application request can be adopted to apply for a target node that meets the target resource type and the target resource amount, and the cloud resource type includes: a virtual machine and a bare metal resource; thus, the bare metal resources required by the user can be represented by the target cloud resource type and the target resource amount, just like the virtual machine, and the resource application can be made according to the target resource amount, thereby achieving the purpose of unifying the scheduling logic of virtual machines and bare metal resources, using the same management method for virtual machines and bare metal resources, and scheduling virtual machines and bare metal resources in a unified scheduling system, achieving the technical effect of unified scheduling of virtual machines and bare metal resources, thereby solving the technical problems of high complexity of scheduling logic of virtual machines and bare metal resources in cloud resources, inconsistent resource management, and inability to be uniformly scheduled in the related art. BRIEF DESCRIPTION OF THE DRAWINGS
[0041] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.
[0042] In order to more clearly illustrate the embodiments of the present application 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, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.
[0043] Figure 1is a schematic diagram of a hardware environment of an optional cloud resource scheduling method according to an embodiment of the present application;
[0044] Figure 2 is a flow chart of an optional cloud resource scheduling method according to an embodiment of the present application;
[0045] Figure 3 is a flowchart of another optional cloud resource scheduling method according to an embodiment of the present application;
[0046] Figure 4 is a flowchart of another optional cloud resource scheduling method according to an embodiment of the present application;
[0047] Figure 5 is a structural block diagram of an optional cloud resource scheduling device according to an embodiment of the present application;
[0048] Figure 6 It is a structural block diagram of an optional electronic device according to an embodiment of the present application. DETAILED DESCRIPTION
[0049] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present application.
[0050] It should be noted that the terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device comprising a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0051] First, some nouns or terms that appear in the description of the embodiments of the present application are subject to the following interpretation:
[0052] 1. Virtual Machine: A virtual machine is a machine with complete hardware system functions simulated by software, on which a complete operating system and applications can be run. Virtual machine technology allows multiple independent operating system instances to run on a physical computer, and each instance believes that it has exclusive access to the entire hardware resources.
[0053] 2. Host Machine: The actual physical computer or the computer running virtualization software.
[0054] 3. Bare Metal Resources refers to computing resources that directly access and use physical hardware resources without going through any virtualization layer. In cloud computing and data center environments, bare metal resources usually refer to physical servers that do not run virtualization software (such as Hypervisor) and can directly run operating systems and applications.
[0055] According to one aspect of an embodiment of the present application, a cloud resource scheduling method is provided. Optionally, in this embodiment, the cloud resource scheduling method can be applied to Figure 1 In the hardware environment composed of terminal 1402 and server 1404 shown in FIG. Figure 1 As shown, server 1404 is connected to terminal 1402 via a network, and can be used to provide services (such as game services, application services, etc.) for the terminal or a client installed on the terminal. A database can be set up on the server or independently of the server to provide data storage services for server 1404.
[0056] The above network may include but is not limited to at least one of the following: wired network, wireless network. The above wired network may include but is not limited to at least one of the following: wide area network, metropolitan area network, local area network, and the above wireless network may include but is not limited to at least one of the following: WIFI (Wireless Fidelity), Bluetooth. The terminal may not be limited to a PC, a mobile phone, a tablet computer, etc.
[0057] The cloud resource scheduling method of the embodiment of the present application can be executed by a server, a terminal, or a server and a terminal together. The cloud resource scheduling method of the embodiment of the present application can be executed by a terminal or a client installed thereon.
[0058] Taking the cloud resource scheduling method in this embodiment as an example, the scheduling service implemented in the server performs the scheduling. Figure 2 A cloud resource scheduling method provided in an embodiment of the present application includes the following steps:
[0059] Step S202: Obtain a cloud resource application request from a target user.
[0060] The cloud resource scheduling method in this embodiment can be applied to scenarios where it is necessary to determine cloud computing resources for scheduling to users in a cloud computing environment, for example: determining scenarios where virtual machines and / or bare metal resources are scheduled to users in a cloud computing environment, or other resources in a cloud computing environment are scheduled to users. In the embodiments of this application, virtual machines and / or bare metal resources are used as examples to illustrate the above cloud resource scheduling method. For other types of cloud resources, the above cloud resource scheduling method is also applicable if there is no contradiction.
[0061] Specifically, in a cloud computing environment, the target user can submit a cloud resource application request to the cloud server through the API, web interface or other methods provided by the cloud server to obtain the computing resources indicated by the cloud resource application request (such as virtual machines (that is, host machines required to support the operation of virtual machines), bare metal resources, etc.).
[0062] The target user may be any user who can apply for cloud resources from the cloud service end implementing the method of this embodiment.
[0063] Step S204: determining the target cloud resource type and target resource quantity to be applied for according to the cloud resource application request, wherein the cloud resource type includes: virtual machine and bare metal resource.
[0064] Specifically, in a cloud resource application request, virtual machines and bare metal resources may be characterized by a unified scheduling data model, and any cloud resource application request includes: a target cloud resource type and a target resource quantity.
[0065] For virtual machines and bare metal resources, since they are different types of cloud resources, the types of cloud resources that need to be scheduled indicated in the cloud resource application request are also different. When the cloud resource type is a virtual machine, it can include the following subtypes: "CPU", "Memory" and "Disk", where "CPU" is the number of CPU cores required by the virtual machine, "Memory" is the memory size required by the virtual machine (in MB), and "Disk" is the disk space required by the virtual machine (in GB). When the cloud resource type is a bare metal resource, since the bare metal resource is an entire physical server, it can only include a type "Sold" to indicate the required amount of bare metal resources. When "Sold" is 0, it means not applying for the bare metal resource; if it is 1, it means applying for 1 bare metal resource; if it is N, it means applying for N bare metal resources.
[0066] like Figure 3As shown, as an optional implementation, as in any of the previous methods, the aforementioned step S204 can be implemented by the following steps S302 and S304 to determine the target cloud resource type and target resource amount required to be applied for according to the cloud resource application request:
[0067] Step S302: When the cloud resource application request includes at least one first field type for applying for a virtual machine, determine that the target cloud resource type to be applied for by the cloud resource application request is a virtual machine.
[0068] That is to say, when parsing the cloud resource application request, the field type contained in the cloud resource application request can be determined. If the field type obtained by the analysis is at least one first field type used for virtual machine application, it can be determined that the target cloud resource type required for the cloud resource application request is a virtual machine. Generally, the first field type is the type of resource that the virtual machine can apply for, namely: CPU, Memory, and Disk. For example, for any cloud resource application request for virtual machine application, the first field types it contains are: "CPU", "Memory", and "Disk", and then for the received cloud resource application request I shown below:
[0069] flavor
[0070] CPU: 2,
[0071] Memory:2024,
[0072] Disk:50
[0073] }
[0074] Since the first field types included in the above cloud resource application request I are "CPU", "Memory" and "Disk", it can be determined that the target cloud resource type of the above cloud resource application request I is a virtual machine.
[0075] Step S304: determining the target resource amount by determining the field value corresponding to each first field type in the cloud resource application request.
[0076] Specifically, since the first field type is generally the type of resource that the virtual machine can apply for, the field value corresponding to each first field type is used to characterize the resource amount of the resource indicated by each first field type. Therefore, after determining each first field type, the target resource amount indicated by the cloud resource application request can be determined by determining the field value corresponding to each first field type. Still taking the above-mentioned cloud resource application request I as an example: the field value corresponding to the first field type "CPU" is "2", the field value corresponding to the first field type "Memory" is 2024, and the field value corresponding to the first field type "Disk" is 50. Then, the target resource amount can be determined as 2 core CPUs, 2024MB of memory, and 50GB of disk space in combination with the predetermined units corresponding to each first field type (for example, the unit corresponding to "CPU" is the number of CPU cores, the unit corresponding to "Memory" is the memory size (in MB), and the unit corresponding to "Disk" is the disk space (in GB)).
[0077] like Figure 4 As shown, as an optional implementation, as in any of the previous methods, the aforementioned step S204 can be implemented by the following steps S402 and S404 to determine the target cloud resource type and target resource amount required to be applied for according to the cloud resource application request:
[0078] Step S402: When the cloud resource application request includes a second field type for applying for bare metal resources, it is determined that the target cloud resource type to be applied for by the cloud resource application request is a bare metal resource.
[0079] That is to say, when parsing the cloud resource application request, the field type contained in the cloud resource application request can be determined. If the field type obtained by the analysis is the second field type used for bare metal resource application, it can be determined that the target cloud resource type required for the cloud resource application request is a bare metal resource. Generally, the second field type is the type of resource that can be applied for bare metal resources, that is, a bare metal unit. For example, for any cloud resource application request for bare metal resource application, the second field type it contains is: "Sold", and then for the received cloud resource application request II shown below:
[0080] flavor
[0081] Sold:1
[0082] }
[0083] Since the second field type included in the cloud resource application request II is “Sold”, it can be determined that the target cloud resource type of the cloud resource application request II is a bare metal resource.
[0084] Step S404: determine the target resource amount by determining the field value corresponding to the second field type in the cloud resource application request.
[0085] Specifically, since in general, the second field type is the type of resource that can be applied for bare metal resources, the field value corresponding to the second field type is used to characterize the resource quantity indicated by each second field type. Therefore, after determining the second field type, the target resource quantity indicated by the cloud resource application request can be determined by determining the field value corresponding to the second field type. Still taking the above-mentioned cloud resource application request II as an example: the field value corresponding to the second field type "Sold" is "1". Then the target resource quantity can be determined to be 1 bare metal unit in combination with each predetermined unit corresponding to the second field type (for example, the unit corresponding to "Sold" is 1 bare metal unit).
[0086] Step S206: Select a target node that meets the target resource type and target resource quantity in the resource pool.
[0087] Specifically, after determining the target resource type and the target resource amount, all available resources of the target resource type may be determined in the resource pool, and then target nodes that meet the target resource amount may be screened out from the available resources.
[0088] As an optional implementation, as in any of the previous methods, the aforementioned step S206 can be implemented by the following steps to select a target node in the resource pool that meets the target resource type and target resource amount: when the target resource type is a virtual machine, determine the host resources of each available host in all available hosts in the resource pool; select a target host whose host resources meet the target resource amount from among all available hosts, and determine the target host as the target node. That is, when it is determined that the target resource type is a virtual machine, all available hosts can be determined in the resource pool, and the available hosts are idle hosts that have not been allocated to users. Therefore, after determining the available hosts, the host resources of each available host can be determined. Then, a target host that meets the target resource amount is selected from among all available hosts, and the target host can be the host with the smallest amount of resources among all hosts that meet the target resource amount. Furthermore, the host with the smallest amount of resources among all the hosts that meet the target amount of resources can be selected through the following steps: a designated host that meets the target amount of resources is selected from all available hosts, all designated hosts are sorted from large to small according to the amount of resources to obtain a first sorting result, and then the last designated host is selected as the target host according to the first sorting result; in addition, all designated hosts can be sorted from small to large according to the amount of resources to obtain a second sorting result, and then the first designated host is selected as the target host according to the second sorting result. After the target host is determined, it can be determined as the target node.
[0089] As an optional implementation, as in the method of any of the previous items, the aforementioned step S206 can be implemented by the following steps to select a target node that meets the target resource type and target resource amount in the resource pool: when the target resource type is a bare metal resource, all unsold bare metal nodes in the resource pool are determined; among all unsold bare metal nodes, the target bare metal nodes that meet the target number indicated by the target resource amount are selected, and the target number of target bare metal nodes are determined as target nodes. That is, when it is determined that the target resource type is a bare metal resource, all unsold bare metal nodes can be determined in the resource pool, and the unsold bare metal nodes are idle bare metal nodes that have not been sold to users. Therefore, after determining the unsold bare metal nodes, the target bare metal nodes that meet the target number indicated by the target resource amount can be selected from all unsold bare metal nodes, and the target bare metal node can be one of the target number of bare metal nodes indicated by all target resource amounts. After determining the target number of target bare metal nodes, all target number of target bare metal nodes can be determined as target nodes.
[0090] As an optional implementation, as in the method of any of the previous items, the following steps are also included between selecting a target node that meets the target resource type and target resource amount in the resource pool in step S206 and scheduling the target node to the target user in step S208: marking the target node as pre-occupied; adding pre-occupancy information indicating that the target node is pre-occupied in the resource pre-occupancy report. That is, after determining the target node, before scheduling the target node to the target user, in order to avoid secondary scheduling of the target node, the target node can be marked as pre-occupied. When the target cloud resource type of the target node is a virtual machine, once a suitable target host is selected and determined as the target node, the scheduling service will lock the resources of the target node (i.e., the target host) to prevent other virtual machines from requesting to use the same target host. At this time, the available resources on the target node will gradually decrease until the virtual machine is successfully deployed or the request is canceled. When the target cloud resource type of the target node is a bare metal resource, after the target number of target bare metal nodes is selected, the scheduling service will mark the target number of target bare metal nodes as sold, that is, for any of the target number of target bare metal nodes, the field value of the second field type Sold of the target bare metal node becomes sold:{total:1,used:1}. As a result, the number of used bare metal nodes in the resource pool will increase to prevent duplicate applications. Furthermore, the status and sales status of the bare metal nodes will be synchronized to the resource management system. It should be noted that the pre-occupancy here can be achieved by increasing the number of used, and the total-used number is the available number, that is, when the field value of Sold becomes total:1,used:1, total-used=0, indicating that the corresponding target bare metal node has been sold. The scheduling service can add pre-occupancy information to indicate that the target node is pre-occupied in the resource pre-occupancy report. Specifically, the resource pre-occupancy report can be established in advance, and then the monitoring system can track the status and usage of resources (i.e., virtual machines and bare metal resources). After determining that there is a new node marked as pre-occupied, the pre-occupancy information can be added to the resource pre-occupancy report to indicate that the target node is pre-occupied. For example, the resource pre-occupancy report can include a pre-occupancy field for each node, and the field value of the pre-occupancy field of the target node can be identified as a value used to indicate that it has been pre-occupied, so as to add the pre-occupancy information to indicate that the target node is pre-occupied in the resource pre-occupancy report. Through the method of this embodiment, users and administrators can be helped to understand the allocation of resources.
[0091] Step S208: dispatch the target node to the target user.
[0092] After the target node is determined, it can be dispatched to the target user to complete the response to the cloud resource application request.
[0093] In the embodiment of the present application, a method of obtaining a request for a virtual machine and a bare metal resource through a unified cloud resource application request is adopted, by obtaining a cloud resource application request from a target user; determining the target cloud resource type and the target resource amount required to be applied for according to the cloud resource application request, wherein the cloud resource type includes: a virtual machine and a bare metal resource; selecting a target node that meets the target resource type and the target resource amount in the resource pool; and scheduling the target node to the target user. Since a unified cloud resource application request can be used to apply for a target node that meets the target resource type and the target resource amount, and the cloud resource type includes: a virtual machine and a bare metal resource, the bare metal resources required by the user can be represented by the target cloud resource type and the target resource amount, just like the virtual machine, and the resource application can be made according to the target resource amount, thereby achieving the purpose of unifying the scheduling logic of virtual machines and bare metal resources, using the same management method for virtual machines and bare metal resources, and scheduling virtual machines and bare metal resources in a unified scheduling system, achieving the technical effect of unified scheduling of virtual machines and bare metal resources, thereby solving the technical problems of high complexity of scheduling logic of virtual machines and bare metal resources in cloud resources, inconsistent resource management, and inability to be uniformly scheduled in the related art.
[0094] As an optional implementation, as in the method of any of the previous items, the method further includes the following steps: obtaining the current resource usage status of each resource in the resource pool at the current moment; generating a resource status report for indicating the current resource usage status of each resource. At the current moment, in order to achieve effective scheduling of resources, it is necessary to determine the current resource usage status of each resource in the resource pool. The resources in the resource pool can be virtual machine resources (i.e., host machines) and bare metal resources. The virtual machine resources can be managed as follows: Since the scheduling service needs to ensure the accuracy and consistency of resources, the resources (such as CPU, memory, disk) of each host machine in the resource pool will be updated in real time, and the usage of the resources of each host machine (such as which virtual machines have been allocated) will be synchronized between the scheduling service and the host machine, so that the scheduling service can obtain the current resource usage status of each host machine. The bare metal resources in the resource pool can be managed as follows: the purchase and sale status of bare metal resources needs to be synchronized in the scheduling service and the resource management system, and the bare metal resource status change (such as from available to sold) needs to be updated in time to ensure that the information in the scheduling service is accurate, thereby determining the current resource usage status of each bare metal resource. Furthermore, the scheduling service can synchronize data with the resource management system to ensure that the current resource usage status of each resource (such as the deployment status of the virtual machine, the enable availability status of the bare metal resource) is consistent in each system. Optionally, data synchronization can be achieved through regular data updates and real-time status checks. After determining the current resource usage status of each resource, the scheduling service can generate a resource status report indicating the current resource usage status of each resource and the aforementioned resource pre-occupancy report (that is, inventory history data) to help users and administrators understand the allocation of resources. The resource status report and resource pre-occupancy report can facilitate tracking the status and usage of resources, and timely discover and handle problems in resource management. Since the bare metal resources disclosed in the present invention can be represented by the target cloud resource type and the target resource amount like the virtual machine, the resource pre-occupancy situation can also be analyzed and summarized in a unified manner, with good adaptability. Furthermore, if new cloud resource types (such as GPU, FPGA, etc.) need to be introduced in the future, they can be incorporated into a unified data model. In other words, when requesting a new cloud resource type, the cloud resource application request can parse the new cloud resource type and the target resource volume corresponding to the new cloud resource type, thereby maintaining the consistency of the scheduling logic. The unified data model simplifies system maintenance and makes system modification and expansion more convenient. New resource types or scheduling strategies can be implemented by modifying the data model and scheduling logic without redesigning the entire system.
[0095] As described below, an application example of applying any of the above embodiments is provided:
[0096] When a user submits a first cloud resource application request for a virtual machine application: the requirements are 2-core CPU, 2024MB memory, and 50GB disk; and submits a second cloud resource application request for a bare metal resource application, the requirement is 1 bare metal node.
[0097] Process description:
[0098] 1. User submits application: The user submits a first cloud resource application request and a second cloud resource application request.
[0099] 2. Parsing the data model of cloud resource application requests:
[0100] The first cloud resource application request of the virtual machine is: flavor{CPU:2,Memory:2024,Disk:50}.
[0101] Second cloud resource application request for bare metal resource application: flavor{Sold:1}.
[0102] 3. Process virtual machine application:
[0103] The virtual machine resource requirements are extracted from the first cloud resource application request, that is, the field values corresponding to the second field type: CPU: 2, Memory: 2024, Disk: 50.
[0104] Search the resource pool for hosts that meet the requirements.
[0105] Select the most appropriate target host and lock its resources.
[0106] Updates the status of each host in the host resources in memory.
[0107] 4. Processing Bare Metal Applications:
[0108] The Sold attribute of the bare metal resource is checked from the second cloud resource application request, that is, the field value corresponding to the second field type: Sold: 1, indicating that a bare metal node needs to be scheduled.
[0109] Select one of the unsold bare metal nodes as the target bare metal node.
[0110] Mark the selected target bare metal node as sold (Sold is 1).
[0111] Updates the status of each bare metal node in the bare metal resource in memory.
[0112] 5. Generate pre-occupancy records:
[0113] After the target host or target bare metal node is occupied, an inventory pre-occupancy record corresponding to the target host or target bare metal node is generated to make the inventory data traceable and ensure transaction consistency.
[0114] 6. Generate reports:
[0115] Generate resource status reports and resource pre-occupancy reports for virtual machines and bare metal resources based on the status of each host machine, the status of each bare metal node, and the inventory pre-occupancy records corresponding to the target host machine or target bare metal node, to help users and administrators understand resource allocation.
[0116] It should be noted that, for the aforementioned method embodiments, for the sake of simplicity, they are all expressed as a series of action combinations, but those skilled in the art should be aware that the present application is not limited by the described order of actions, because according to the present application, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required by the present application.
[0117] Through the description of the above implementation methods, those skilled in the art can clearly understand that the method according to the above embodiment can be implemented by means of software plus a necessary general hardware platform, and of course it can also be implemented by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM (Read-Only Memory) / RAM (Random Access Memory), a magnetic disk, or an optical disk), and includes a number of instructions for a terminal device (which can be a mobile phone, a computer, a server, or a network device, etc.) to execute the methods of each embodiment of the present application.
[0118] According to another aspect of an embodiment of the present application, a cloud resource scheduling device for implementing the above-mentioned cloud resource scheduling method is also provided. Figure 5 is a structural block diagram of an optional cloud resource scheduling device according to an embodiment of the present application, such as Figure 5 As shown, the device may include:
[0119] The acquisition module 51 is used to acquire a cloud resource application request from a target user.
[0120] The determination module 52 is used to determine the target cloud resource type and target resource amount required to be applied for according to the cloud resource application request, wherein the cloud resource type includes: virtual machine and bare metal resource.
[0121] The selection module 53 is used to select a target node that meets the target resource type and target resource quantity in the resource pool.
[0122] The scheduling module 54 is used to schedule the target node to the target user.
[0123] It should be noted that the acquisition module 51 in this embodiment can be used to execute the above step S202, the determination module 52 in this embodiment can be used to execute the above step S204, the selection module 53 in this embodiment can be used to execute the above step S206, and the scheduling module 54 in this embodiment can be used to execute the above step S208.
[0124] Through the above modules, a method of obtaining requests for virtual machines and bare metal resources through a unified cloud resource application request is adopted, by obtaining a cloud resource application request from a target user; determining the target cloud resource type and target resource amount required to be applied for according to the cloud resource application request, wherein the cloud resource type includes: virtual machines and bare metal resources; selecting a target node that meets the target resource type and target resource amount in the resource pool; and scheduling the target node to the target user. Since a unified cloud resource application request can be used to apply for a target node that meets the target resource type and target resource amount, and the cloud resource type includes: virtual machines and bare metal resources, the bare metal resources required by the user can be represented by the target cloud resource type and target resource amount, just like virtual machines, and resources can be applied for according to the target resource amount, thereby achieving the purpose of unifying the scheduling logic of virtual machines and bare metal resources, using the same management method for virtual machines and bare metal resources, and scheduling virtual machines and bare metal resources in a unified scheduling system, achieving the technical effect of unified scheduling of virtual machines and bare metal resources, thereby solving the technical problems of high complexity of scheduling logic of virtual machines and bare metal resources in cloud resources, inconsistent resource management, and inability to be uniformly scheduled in the related technologies.
[0125] As an optional implementation, in the device of any of the preceding items, the determination module 52 includes: a first determination submodule; the first determination submodule is configured to:
[0126] In a case where the cloud resource application request includes at least one first field type for applying for a virtual machine, determining that the target cloud resource type required to be applied for by the cloud resource application request is a virtual machine;
[0127] The target resource amount is determined by determining the field value corresponding to each first field type in the cloud resource application request.
[0128] As an optional implementation, as in the device of any of the preceding items, the determination module 52 includes: a second determination submodule; the second determination submodule is configured to:
[0129] In a case where the cloud resource application request includes a second field type for applying for a bare metal resource, determining that the target cloud resource type required to be applied for by the cloud resource application request is a bare metal resource;
[0130] The target resource amount is determined by determining a field value corresponding to the second field type in the cloud resource application request.
[0131] As an optional implementation, as in any of the preceding apparatuses, the selection module 53 includes: a first selection submodule, wherein the first selection submodule is configured to:
[0132] When the target resource type is a virtual machine, determining the host resources of each available host in all available hosts in the resource pool;
[0133] Among all available hosts, a target host whose host resources meet the target resource amount is selected, and the target host is determined as the target node.
[0134] As an optional implementation, in the device of any of the preceding items, the selection module 53 includes: a second selection submodule, and the second selection submodule is configured to:
[0135] When the target resource type is a bare metal resource, all unsold bare metal nodes in the resource pool are determined;
[0136] Among all unsold bare metal nodes, target bare metal nodes that meet the target number indicated by the target resource amount are selected, and the target bare metal nodes of the target number are determined as target nodes.
[0137] As an optional implementation, the device of any of the preceding items further includes a pre-occupancy module, wherein the pre-occupancy module is configured to:
[0138] Mark the target node as pre-occupied;
[0139] Pre-occupancy information for indicating that a target node is pre-occupied is added to the resource pre-occupancy report.
[0140] As an optional implementation, the device of any of the preceding items further includes a usage status module, wherein the usage status module is configured to:
[0141] Get the current resource usage status of each resource in the resource pool at the current moment;
[0142] Generates a resource status report that indicates the current resource usage status of each resource.
[0143] The device in this embodiment, in addition to the above modules, may also include a module for executing any method in any of the above-mentioned cloud resource scheduling method embodiments.
[0144] It should be noted that the examples and application scenarios implemented by the above modules and corresponding steps are the same, but are not limited to the contents disclosed in the above embodiments. It should be noted that the above modules as part of the device can be run in Figure 1 In the hardware environment shown, it can be implemented by software or by hardware, wherein the hardware environment includes a network environment.
[0145] According to another aspect of an embodiment of the present application, an electronic device for implementing the above-mentioned cloud resource scheduling method is also provided. The electronic device may be a server, a terminal, or a combination thereof.
[0146] According to another embodiment of the present application, there is also provided an electronic device, including: Figure 6 As shown, the electronic device may include: a processor 1501 , a communication interface 1502 , a memory 1503 and a communication bus 1504 , wherein the processor 1501 , the communication interface 1502 , and the memory 1503 communicate with each other via the communication bus 1504 .
[0147] Memory 1503, used for storing computer programs;
[0148] The processor 1501 is used to implement the following steps when executing the program stored in the memory 1503:
[0149] Step S202: Obtain a cloud resource application request from a target user.
[0150] Step S204: determining the target cloud resource type and target resource quantity to be applied for according to the cloud resource application request, wherein the cloud resource type includes: virtual machine and bare metal resource.
[0151] Step S206: Select a target node that meets the target resource type and target resource quantity in the resource pool.
[0152] Step S208: dispatch the target node to the target user.
[0153] Optionally, in this embodiment, the above-mentioned communication bus can be a PCI (Peripheral Component Interconnect) bus, or an EISA (Extended Industry Standard Architecture) bus, etc. The communication bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, only one thick line is used in the figure, but it does not mean that there is only one bus or one type of bus. The communication interface is used for communication between the above-mentioned electronic device and other devices.
[0154] The memory may include a random access memory (RAM) or a non-volatile memory (NVM), such as at least one disk memory. Optionally, the memory may also be at least one storage device located away from the aforementioned processor.
[0155] As an example, the memory 1503 may include, but is not limited to, the acquisition module 51, determination module 52, selection module 53, and scheduling module 54 in the cloud resource scheduling device. In addition, it may also include, but is not limited to, other module units in the cloud resource scheduling device, which will not be repeated in this example.
[0156] The above-mentioned processor can be a general-purpose processor, which can include but not be limited to: CPU (Central Processing Unit), NP (Network Processor), etc.; it can also be DSP (Digital Signal Processor), ASIC (Application Specific Integrated Circuit), FPGA (Field-Programmable Gate Array) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.
[0157] An embodiment of the present application further provides a computer-readable storage medium, the storage medium including a stored program, wherein the method steps of the above method embodiment are executed when the program is run.
[0158] Optionally, in this embodiment, the storage medium may include, but is not limited to, various media that can store program codes, such as a USB flash drive, a ROM, a RAM, a mobile hard disk, a magnetic disk, or an optical disk.
[0159] The serial numbers of the above-mentioned embodiments of the present application are for description only and do not represent the advantages or disadvantages of the embodiments.
[0160] If the integrated units in the above embodiments are implemented in the form of software functional units and sold or used as independent products, they can be stored in the above computer-readable storage medium. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for enabling one or more computer devices (which may be personal computers, servers, or network devices, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present application.
[0161] In the above embodiments of the present application, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, please refer to the relevant description of other embodiments.
[0162] In the several embodiments provided in the present application, it should be understood that the disclosed client can be implemented in other ways. Among them, the device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of units or modules, which can be electrical or other forms.
[0163] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution provided in this embodiment.
[0164] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0165] The above is only a preferred implementation of the present application. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present application. These improvements and modifications should also be regarded as the scope of protection of the present application.
Claims
1. A cloud resource scheduling method, characterized in that: include: Obtain cloud resource application requests from target users; Determine the target cloud resource type and target resource amount to be applied for according to the cloud resource application request, wherein the cloud resource type includes: virtual machine and bare metal resource; Selecting a target node that meets the target resource type and the target resource amount in the resource pool; The target node is dispatched to the target user.
2. The method according to claim 1, characterized in that: Determining the target cloud resource type and target resource amount required to be applied for according to the cloud resource application request includes: In a case where the cloud resource application request includes at least one first field type for applying for a virtual machine, determining that the target cloud resource type required to be applied for by the cloud resource application request is a virtual machine; The target resource amount is determined by determining a field value corresponding to each first field type in the cloud resource application request.
3. The method according to claim 1, characterized in that Determining the target cloud resource type and target resource amount required to be applied for according to the cloud resource application request includes: In a case where the cloud resource application request includes a second field type for applying for a bare metal resource, determining that the target cloud resource type required to be applied for by the cloud resource application request is a bare metal resource; The target resource amount is determined by determining a field value corresponding to the second field type in the cloud resource application request.
4. The method according to claim 1, characterized in that: Selecting a target node that meets the target resource type and the target resource amount in the resource pool includes: In a case where the target resource type is the virtual machine, determining host resources of each available host machine in all available host machines in the resource pool; A target host whose host resources meet the target resource amount is selected from all the available host machines, and the target host machine is determined as the target node.
5. The method according to claim 1, characterized in that Selecting a target node that meets the target resource type and the target resource amount in the resource pool includes: When the target resource type is the bare metal resource, determining all unsold bare metal nodes in the resource pool; Among all the unsold bare metal nodes, target bare metal nodes that meet the target number indicated by the target resource amount are selected, and the target bare metal nodes of the target number are determined as the target nodes.
6. The method according to claim 1, characterized in that Before scheduling the target node to the target user, the method further includes: Marking the target node as pre-occupied; Pre-occupancy information for indicating that the target node is to be pre-occupied is added to the resource pre-occupancy report.
7. The method according to any one of claims 1 to 6, characterized in that The method further comprises: Obtaining the current resource usage status of each resource in the resource pool at the current moment; A resource status report is generated to indicate a current resource usage status of each resource.
8. A cloud resource scheduling device, characterized in that: include: An acquisition module is used to obtain cloud resource application requests from target users; A determination module is used to determine the target cloud resource type and target resource amount required to be applied for according to the cloud resource application request, wherein the cloud resource type includes: virtual machine and bare metal resource; A selection module, used to select a target node that meets the target resource type and the target resource amount in the resource pool; A scheduling module is used to schedule the target node to the target user.
9. An electronic device comprising a processor, a communication interface, a memory and a communication bus, wherein: The processor, the communication interface and the memory communicate with each other via the communication bus, wherein: The memory is used to store computer programs; The processor is configured to execute the method according to any one of claims 1 to 7 by running the computer program stored in the memory.
10. A computer-readable storage medium, characterized in that: The storage medium stores a computer program, wherein the computer program is configured to execute the method according to any one of claims 1 to 7 when executed.