Elastic IP scheduling method and device, electronic equipment and readable medium
By periodically obtaining cloud environment resource pool data and detecting the number of unallocated elastic IPs, the problem of users failing to purchase elastic IP addresses in cloud computing environments is solved, and the automated scheduling and effective utilization of elastic IPs is realized, and the user experience is improved.
Patent Information
- Application Number
- CN202411772964.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-04
- Publication Date
- 2025-04-11
AI Technical Summary
In a cloud computing environment, when users purchase elastic IP addresses during peak periods, it may be that the number of elastic IPs in the cloud environment resource pool is limited and they cannot provide elastic IP addresses to all users, resulting in user purchase failure and affecting the user experience.
By periodically obtaining the data of each cloud environment resource pool, the number of unallocated elastic IPs is detected. If the number of unallocated elastic IPs in a cloud environment resource pool is less than the preset number, the target elastic IP will be scheduled from another cloud environment resource pool with the number of unallocated elastic IPs greater than the preset threshold to the required cloud environment resource pool, and the target elastic IP will be deleted.
It ensures that the cloud environment resource pool always has sufficient elastic IP addresses for allocation, avoids user purchase failures, improves user experience, and realizes automated scheduling, reducing the need for human intervention.
Smart Images

Figure CN119814728A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of cloud computing technology, and in particular to an elastic IP scheduling method, an elastic IP scheduling device, an electronic device and a computer-readable medium. Background Art
[0002] Elastic IP (EIP for short) is a public IP address that can be dynamically bound to cloud resources (such as virtual machines, containers, etc.). Elastic IP can be easily allocated and re-bound between different cloud resources, allowing users' services to flexibly adjust backend resources without changing the public access address.
[0003] Users can use cloud resources by purchasing elastic IP addresses. However, it is not possible to prepay the number of online customers before cloud computing resources are deployed or used. If a large number of customers purchase elastic IPs during the peak purchase period, the number of elastic IPs in the cloud environment resource pool is limited, and elastic IP addresses cannot be provided to all users. As a result, user purchases may fail, resulting in a poor user experience. Summary of the invention
[0004] The embodiment of the present invention provides a scheduling method, device, electronic device and computer-readable storage medium for an elastic IP to solve the problem that an elastic IP address cannot be reliably provided.
[0005] The embodiment of the present invention discloses a scheduling method for an elastic IP, which is characterized by comprising: periodically obtaining cloud environment resource pool data of each cloud environment resource pool, the cloud environment resource pool data including: the number of unallocated elastic IPs in the elastic IP pool; detecting whether there is a first cloud environment resource pool whose number of unallocated elastic IPs is less than a preset number; if so, obtaining a second cloud environment resource pool whose number of unallocated elastic IPs is greater than a preset threshold according to each of the cloud environment resource pool data; scheduling a target elastic IP from the unallocated elastic IPs in the second cloud environment resource pool to the first cloud environment resource pool, the number of the target elastic IPs being less than the number of the unallocated elastic IPs in the second cloud environment resource pool; and deleting the target elastic IP in the second cloud environment resource pool.
[0006] In one embodiment, the elastic IP in the elastic IP pool is divided into multiple CIDR segments, each of which includes multiple IP addresses; the cloud environment resource pool data also includes: unallocated IP addresses in each of the CIDR segments,
[0007] The step of obtaining the second cloud environment resource pool in which the number of unallocated elastic IPs is greater than a preset threshold according to the data of each cloud environment resource pool includes:
[0008] According to the unallocated IP addresses in each of the CIDR network segments, obtaining the second cloud environment resource pool having an idle CIDR network segment;
[0009] The step of scheduling the target elastic IP from the unallocated elastic IP in the second cloud environment resource pool to the first cloud environment resource pool includes:
[0010] Scheduling the target CIDR network segment from the idle CIDR network segment of the second cloud environment resource pool to the first cloud environment resource pool;
[0011] The deleting the target elastic IP in the second cloud environment resource pool includes:
[0012] Delete the target CIDR network segment in the second cloud environment resource pool.
[0013] In one embodiment, the method further comprises:
[0014] Receive the elastic IP application request of the target cloud environment resource pool sent by the client;
[0015] Obtaining the usage rate of each CIDR network segment in the target cloud environment resource pool according to the unallocated IP addresses in each CIDR network segment in the target cloud environment resource pool and the total number of IP addresses in the corresponding CIDR network segment;
[0016] Detect whether there are any unallocated IP addresses in the CIDR network segment with the highest usage rate;
[0017] If there are unallocated IP addresses in the CIDR network segment with the highest usage rate, select a target IP address from the CIDR network segment with the highest usage rate;
[0018] If there is no unallocated IP address in the CIDR network segment with the highest usage rate, selecting the target IP address from the CIDR network segment with the second highest usage rate;
[0019] The target IP address is returned to the client.
[0020] In one embodiment, before returning the target IP address to the client, the method further includes:
[0021] If it is determined according to the usage rates of the CIDR network segments that none of the CIDR network segments are used, then selecting a target CIDR network segment from the CIDR network segments according to a preset rule;
[0022] The target IP address is selected from the target CIDR network segment.
[0023] In one embodiment, scheduling the target CIDR network segment from the idle CIDR network segment of the second cloud environment resource pool to the first cloud environment resource pool includes:
[0024] Sending a locking instruction to the second cloud environment resource pool, wherein the locking instruction instructs the second cloud environment resource pool to lock the target CIDR network segment;
[0025] Schedule the target CIDR network segment to the first cloud environment resource pool.
[0026] In one embodiment, the step of acquiring the second cloud environment resource pool having an idle CIDR network segment according to the data of each cloud environment resource pool includes:
[0027] Acquire multiple candidate target cloud environment resource pools with idle CIDR network segments according to the data of each cloud environment resource pool;
[0028] The cloud environment resource pool with the most idle CIDR network segments is selected from the multiple candidate target cloud environment resource pools as the second cloud environment resource pool.
[0029] In one embodiment, the scheduling target CIDR network segment to the first cloud environment resource pool includes:
[0030] Send configuration information to the first cloud environment resource pool, where the configuration information includes the target CIDR network segment, so that the first cloud environment resource pool configures the target CIDR network segment according to the configuration information.
[0031] The embodiment of the present invention further discloses a scheduling device for an elastic IP, including:
[0032] A first acquisition module is used to periodically acquire cloud environment resource pool data of each cloud environment resource pool, wherein the cloud environment resource pool data includes: the number of unallocated elastic IPs in the elastic IP pool;
[0033] A detection module, used to detect whether there is a first cloud environment resource pool in which the number of unallocated elastic IPs is less than a preset number;
[0034] A second acquisition module is used for acquiring a second cloud environment resource pool whose number of unallocated elastic IPs is greater than a preset threshold according to data of each of the cloud environment resource pools if the detection module detects that there is a first cloud environment resource pool whose number of unallocated elastic IPs is less than a preset number;
[0035] A scheduling module, used to schedule a target elastic IP from the unallocated elastic IPs in the second cloud environment resource pool to the first cloud environment resource pool, wherein the number of the target elastic IPs is less than the number of the unallocated elastic IPs in the second cloud environment resource pool;
[0036] A deletion module is used to delete the target elastic IP in the second cloud environment resource pool.
[0037] The embodiment of the present invention further discloses 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;
[0038] The memory is used to store computer programs;
[0039] The processor is used to implement the method described in the embodiment of the present invention when executing the program stored in the memory.
[0040] The embodiment of the present invention further discloses one or more computer-readable media on which instructions are stored. When executed by one or more processors, the processors are enabled to execute the method described in the embodiment of the present invention.
[0041] The embodiments of the present invention include the following advantages: since it is periodically detected whether there is a first cloud environment resource pool with a number of unallocated elastic IPs less than a preset number, once it is detected that there is a first cloud environment resource pool with a number of unallocated elastic IPs less than a preset number, the target elastic IP is immediately dispatched from the second cloud environment resource pool with schedulable unallocated elastic IPs to the first cloud environment resource pool, so that the first cloud environment resource pool has enough elastic IPs to allocate, thereby avoiding customer purchase failure due to the lack of available elastic IPs in the first cloud environment resource pool, thereby improving user experience. BRIEF DESCRIPTION OF THE DRAWINGS
[0042] Figure 1 This is a step flow of a scheduling method for an elastic IP provided in an embodiment of the present invention. Figure 1 ;
[0043] Figure 2 This is a schematic diagram of the CIDR network segment in the cloud environment resource pool provided in an embodiment of the present invention. Figure 1 ;
[0044] Figure 3 This is a step flow of a scheduling method for an elastic IP provided in an embodiment of the present invention. Figure 2 ;
[0045] Figure 4 This is a schematic diagram of the CIDR network segment in the cloud environment resource pool provided in an embodiment of the present invention. Figure 2 ;
[0046] Figure 5 This is a schematic diagram of the CIDR network segment in the cloud environment resource pool provided in an embodiment of the present invention. Figure 3 ;
[0047] Figure 6 This is a step flow of a scheduling method for an elastic IP provided in an embodiment of the present invention. Figure 3 ;
[0048] Figure 7 This is a step flow of a scheduling method for an elastic IP provided in an embodiment of the present invention. Figure 4 ;
[0049] Figure 8 It is a structural block diagram of a scheduling device for an elastic IP provided in an embodiment of the present invention;
[0050] Fig. 9 is an architecture diagram of an elastic IP scheduling system provided in an embodiment of the present invention;
[0051] Fig.10 This is a step flow of a scheduling method for an elastic IP provided in an embodiment of the present invention. Figure 5 ;
[0052] Fig.11 is a block diagram of an electronic device provided in an embodiment of the present invention;
[0053] Fig.12 is a schematic diagram of a computer-readable medium provided in an embodiment of the present invention. DETAILED DESCRIPTION
[0054] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, the present invention is further described in detail below with reference to the accompanying drawings and specific embodiments.
[0055] Reference Figure 1 , shows a flowchart of a method for scheduling an elastic IP provided in an embodiment of the present invention, which may specifically include the following steps S101-S105:
[0056] S101. Periodically obtain data of each cloud environment resource pool, where the cloud environment resource pool data includes: the number of unallocated elastic IPs in the elastic IP pool.
[0057] Elastic IP (EIP for short) is a static IP address of an external network (the external network can be either the public Internet or the enterprise's internal LAN). It can be directly accessed through the external network and can be flexibly bound and unbound to resources such as elastic cloud servers, bare metal servers, virtual IPs, and elastic load balancing. By binding an elastic IP to the cloud server associated with the subnet, the cloud server can communicate with the external network.
[0058] Currently, some cloud computing resource pools have implemented a distributed deployment architecture. There may be multiple cloud computing resource pools in a region. The data of each cloud environment resource pool can be periodically obtained. The cloud environment resource pool data here includes not only the number of unallocated elastic IPs in the elastic IP pool, but also other information, such as: the total number of elastic IPs in the elastic IP pool, the number of used elastic IPs in the elastic IP pool, etc.
[0059] The API-server interface of the cloud environment resource pool can be called through the region identifier (regin id), through which the underlying resources in the cloud environment resource pool can be created, updated, queried and deleted.
[0060] The specific duration of the cycle can be adjusted according to the market. For example, during peak purchasing periods, the cycle can be shortened, and during low purchasing periods, the cycle can be extended. The specific duration of the cycle can also be preset, and the present disclosure does not impose any restrictions on the specific duration of the cycle.
[0061] S102: Detect whether there is a first cloud environment resource pool in which the number of unallocated elastic IP addresses is less than a preset number.
[0062] After obtaining the cloud environment resource pool data of each cloud environment resource pool, it will be detected whether the number of unallocated elastic IPs in each cloud environment resource pool is less than the preset number. If it is less than the preset number, it means that the elastic IPs in the cloud environment resource pool are insufficient and elastic IPs need to be dispatched from other cloud environment resource pools to the cloud environment resource pool.
[0063] Among them, the preset number can also be adjusted based on the actual scenario, and the present disclosure does not limit the specific value of the preset number.
[0064] In one implementable manner, the preset number may be 1, that is, after it is detected that the elastic IP in the cloud environment resource pool is exhausted, the elastic IP is dispatched from other cloud environment resource pools to the cloud environment resource pool.
[0065] It is worth noting that the first cloud environment resource pool here can be one or more.
[0066] S103: If so, obtain a second cloud environment resource pool whose number of unallocated elastic IP addresses is greater than a preset threshold according to the data of each cloud environment resource pool.
[0067] If it is detected that there is a first cloud environment resource pool with a number of unallocated elastic IPs less than a preset number, it indicates that elastic IPs need to be scheduled from other cloud environment resource pools to the first cloud environment resource pool. At this time, it is necessary to evaluate whether there is a cloud environment resource pool that can schedule elastic IPs. Here, the scheduling qualification can be determined based on the number of unallocated elastic IPs in other cloud environment resource pools. If there is a second cloud environment resource pool with a number of unallocated elastic IPs greater than a preset threshold, it indicates that the second cloud environment resource pool has sufficient elastic IPs and some elastic IPs can be transferred.
[0068] S104: Schedule target elastic IPs from the unallocated elastic IPs in the second cloud environment resource pool to the first cloud environment resource pool, where the number of target elastic IPs is less than the number of unallocated elastic IPs in the second cloud environment resource pool.
[0069] After finding the second cloud environment resource pool that can schedule the elastic IP, a target elastic IP can be selected from the unallocated elastic IPs in the second cloud environment resource pool and scheduled to the first cloud environment resource pool.
[0070] Among them, the target elastic IP can be based on quantity, that is, a preset number of elastic IPs can be selected from unallocated elastic IPs as target elastic IPs. When selecting, you can randomly select from unallocated elastic IPs, or you can select from the end of the unallocated elastic IPs. The present disclosure does not limit the selection method of the target elastic IP, as long as a preset number of target elastic IPs are selected.
[0071] For example, the preset number is 10, and 10 elastic IPs can be randomly selected from the unallocated elastic IPs as the target elastic IPs, or the last 10 elastic IPs of the unallocated elastic IPs can be selected as the target elastic IPs.
[0072] In order to avoid scheduling all the unallocated elastic IPs in the second cloud environment resource pool, so that there is no unallocated elastic IP available for allocation in the second cloud environment resource pool, the number of target elastic IPs to be scheduled should be less than the number of unallocated elastic IPs.
[0073] Alternatively, in order to ensure that the second cloud environment resource pool can still allocate elastic IPs to customers after scheduling, it is necessary to ensure that the number of unallocated elastic IPs in the second cloud environment resource pool after scheduling meets a certain preset number. For example, after scheduling, it is necessary to ensure that the number of unallocated elastic IPs in the second cloud environment resource pool is greater than 15. If the number of unallocated elastic IPs in the second cloud environment resource pool before scheduling is 50, then the number of target elastic IPs for scheduling must be less than 50-15=35. In this way, it can be ensured that the number of unallocated elastic IPs in the second cloud environment resource pool after scheduling is greater than 15, thereby ensuring that the second cloud environment resource pool can normally allocate elastic IPs to customers.
[0074] S105. Delete the target elastic IP in the second cloud environment resource pool.
[0075] In order to prevent the second cloud environment resource pool from allocating target elastic IPs to customers before deletion, an instruction for locking these target elastic IPs will be sent to the second cloud environment resource pool to allow the second cloud environment resource pool to lock these target elastic IPs, thereby preventing the second cloud environment resource pool from allocating elastic IPs to customers from these target elastic IPs during the scheduling process to the first cloud resource pool, causing scheduling failure.
[0076] When deleting the target elastic IP in the second cloud environment resource pool, a deletion instruction can be sent to the second cloud environment resource pool first. The deletion instruction includes the address information of the target elastic IP. After receiving the deletion instruction, the second cloud resource pool deletes the corresponding target elastic IP based on the address information of the target elastic IP.
[0077] In one embodiment, if there are multiple second cloud environment resource pools that meet the conditions, the second cloud environment resource pool with the largest number of unallocated elastic IPs can be selected for scheduling the elastic IP, or any second cloud environment resource pool can be randomly selected for scheduling the elastic IP, or, based on the consumption rate of the elastic IPs in each second cloud environment resource pool, the second cloud environment resource pool with the slowest consumption efficiency can be selected for scheduling the elastic IP.
[0078] The present disclosure proposes a scheduling method for elastic IP, including: periodically obtaining data of each cloud environment resource pool, the cloud environment resource pool data including: the number of unallocated elastic IPs in the elastic IP pool; detecting whether there is a first cloud environment resource pool with a number of unallocated elastic IPs less than a preset number; if there is, obtaining a second cloud environment resource pool with a number of unallocated elastic IPs greater than a preset threshold according to the data of each cloud environment resource pool; scheduling a target elastic IP from the unallocated elastic IPs in the second cloud environment resource pool to the first cloud environment resource pool, the number of target elastic IPs being less than the number of unallocated elastic IPs in the second cloud environment resource pool; deleting the target elastic IP in the second cloud environment resource pool. Among them, since it is periodically detected whether there is a first cloud environment resource pool with a number of unallocated elastic IPs less than a preset number, once it is detected that there is a first cloud environment resource pool with a number of unallocated elastic IPs less than a preset number, the target elastic IP will be immediately scheduled from the second cloud environment resource pool with schedulable unallocated elastic IPs to the first cloud environment resource pool, so that the first cloud environment resource pool has enough elastic IPs to allocate, avoiding the failure of customer purchase due to the lack of available elastic IPs in the first cloud environment resource pool, thereby improving the user experience.
[0079] Furthermore, in the related art, human intervention is required when performing elastic IP scheduling. Since the human intervention processing period is long, it affects the sale of EIP and the user experience. The present disclosure can automate scheduling, thereby effectively solving this problem.
[0080] In the present disclosure, the elastic IPs in the elastic IP pool in a single cloud environment resource pool can be managed into multiple Classless Inter-Domain Routing (CIDR) network segments, such as Figure 2 As shown in the figure, the 32 elastic IPs in the elastic IP pool in the cloud environment resource pool are managed into four CIDR network segments, namely CIDR1, CIDR2, CIDR3 and CIDR4. Each CIDR network segment includes 8 IP addresses. Figure 2 In the example, when the cloud environment resource pool is just managed, the IP addresses in each CIDR network segment have not yet been allocated. Figure 3 As shown, the method further includes the following steps S201-S206:
[0081] S201. Receive an elastic IP application request for a target cloud environment resource pool sent by a client.
[0082] S202. Obtain the usage rate of each CIDR network segment in the target cloud environment resource pool according to the unallocated IP addresses in each CIDR network segment in the target cloud environment resource pool and the total number of IP addresses in the corresponding CIDR network segment.
[0083] exist Figure 2 After the elastic IP in the elastic IP pool in the cloud environment resource pool is managed, if an elastic IP application request is received, when allocating the elastic IP, the CIDR segment for allocating the IP address will be selected based on the IP address usage rate.
[0084] Among them, CIDR network segment utilization rate = (number of allocated IP addresses) / (total number of IP addresses in the CIDR network segment), such as Figure 4 As shown in the figure, the IP address usage rate of CIDR1 is 0.625, and the IP address usage rates of CIDR2, CIDR3, and CIDR4 are all 0.
[0085] S203: Detect whether there are any unallocated IP addresses in the CIDR network segment with the highest usage rate.
[0086] S204: If there are unallocated IP addresses in the CIDR network segment with the highest usage rate, select a target IP address from the CIDR network segment with the highest usage rate.
[0087] like Figure 4 As shown in the figure, there are still unallocated IP addresses in CIDR1 with the highest usage rate. At this time, the target IP address allocated to the client will be selected from CIDR1.
[0088] S205. If there are no unallocated IP addresses in the CIDR network segment with the highest usage rate, select a target IP address from the CIDR network segment with the second highest usage rate.
[0089] like Figure 5 As shown in the figure, the usage rate of CIDR1 is 1, the usage rate of CIDR2 is 0.375, the usage rate of CIDR1 is 0, and the usage rate of CIDR2 is 0. At this time, there are no unallocated IP addresses in CIDR1 with the highest usage rate, so the target IP address allocated to the client will be selected from CIDR2 with the second highest usage rate.
[0090] S206: Return the target IP address to the client.
[0091] In one embodiment, if it is determined based on the usage rates of the CIDR network segments that all CIDR network segments are not in use, a target CIDR network segment is selected from the CIDR network segments based on a preset rule; and then a target IP address is selected from the target CIDR network segment.
[0092] That is, after the cloud environment resource pool is managed, when the IP address is allocated for the first time, you can select a CIDR segment from the four CIDR segments according to the preset rules to allocate the elastic IP. For example, you can select any CIDR segment from the four CIDR segments to allocate the elastic IP, or you can select the first CIDR segment to allocate the elastic IP, or you can select the last CIDR segment to allocate the elastic IP.
[0093] In the related art, when allocating IP addresses, they are randomly allocated, and idle elastic IP addresses are scattered in the elastic IP pool, which is not conducive to the recycling and reuse of elastic IPs. In the present disclosure, the elastic IP addresses in the elastic IP pool under the cloud environment resource pool can be managed into multiple CIDR network segments. When allocating IP addresses, the IP addresses will be allocated in the order of the utilization rate of the CIDR network, and the CIDR network segment with the highest utilization rate will be allocated first. If the CIDR network segment with the highest utilization rate cannot be allocated, then it will be allocated from the CIDR network segment with the second highest utilization rate. In this way, the unallocated IP addresses will not be scattered in the elastic IP pool, which is conducive to the recycling and reuse of elastic IPs.
[0094] In order to achieve scheduling across cloud environment resource pools, when allocating IP addresses within a single cloud environment resource, they cannot be randomly allocated from multiple CIDR network segments to prevent each CIDR network segment from being occupied, which is conducive to the recycling and reuse of IP addresses.
[0095] In another embodiment, Figure 6 As shown, the above method further includes the following steps S301-S306:
[0096] S301: Receive an elastic IP application request for a target cloud environment resource pool sent by a client.
[0097] S302. Obtain the usage rate of each CIDR network segment in the target cloud environment resource pool according to the unallocated IP addresses in each CIDR network segment in the target cloud environment resource pool and the total number of IP addresses in the corresponding CIDR network segment.
[0098] S303. Detect whether there is a target CIDR network segment whose usage rate is less than 1 and greater than 0.
[0099] When the IP address usage rate of a CIDR segment is 1, it indicates that all IP addresses in the CIDR segment are used and no more IP addresses can be allocated. When the IP address usage rate of a CIDR segment is 0, it indicates that none of the IP addresses in the CIDR segment are allocated. When the IP address usage rate of a CIDR segment is less than 1 and greater than 0, it indicates that IP addresses in the CIDR segment are being allocated and it is the CIDR segment with the highest current usage rate.
[0100] S304: If it exists, select a target IP address from the target CIDR network segment.
[0101] After detecting that there is a target CIDR network segment with a usage rate less than 1 and greater than 0, that is, there is a target CIDR network segment in use, IP addresses will continue to be allocated to clients from the target CIDR network segment.
[0102] by Figure 4 For example, after receiving the elastic IP allocation request, an IP address will be allocated to the client from CIDR1.
[0103] S305. If it does not exist, select a target IP address from an unused CIDR network segment.
[0104] If there is no target CIDR network segment with a usage rate less than 1 and greater than 0, it means that there is no CIDR network segment with free IP addresses currently in use. Then, the target IP address will be selected from the unused CIDR network segment to give to the client, that is, the target IP address will be selected from the CIDR network segment with a usage rate of 0 to give to the client.
[0105] It is worth noting that when selecting, you can choose any CIDR network segment from all unused CIDR network segments, or you can choose in order, which is not limited by the present disclosure.
[0106] S306: Return the target IP address to the client.
[0107] In one embodiment, the elastic IP in the elastic IP pool is divided into multiple CIDR segments, each CIDR segment includes multiple IP addresses, and the cloud environment resource pool data also includes: unallocated IP addresses in each CIDR segment, such as Figure 7 As shown:
[0108] In the above step S103, obtaining a second cloud environment resource pool having a number of unallocated elastic IP addresses greater than a preset threshold according to the data of each cloud environment resource pool includes the following sub-step S1031:
[0109] S1031. According to the unallocated IP addresses in each CIDR network segment, obtain a second cloud environment resource pool with idle CIDR network segments.
[0110] Specifically, if there are multiple cloud environment resource pools with free CIDR network segments, at this time, multiple candidate target cloud environment resource pools with free CIDR network segments can be obtained based on the data of each cloud environment resource pool; then the cloud environment resource pool with the most free CIDR network segments is selected from the multiple candidate target cloud environment resource pools as the second cloud environment resource pool.
[0111] In the above step S104, scheduling the target elastic IP from the unallocated elastic IP in the second cloud environment resource pool to the first cloud environment resource pool includes the following sub-step S1041:
[0112] S1041. Schedule the target CIDR network segment from the idle CIDR network segment of the second cloud environment resource pool to the first cloud environment resource pool.
[0113] In one embodiment, all IP addresses in the target CIDR network segment may be scheduled to the first cloud environment resource pool.
[0114] Deleting the target elastic IP in the second cloud environment resource pool in the above step S105 includes the following sub-step S1051:
[0115] S1051. Delete the scheduled IP addresses in the target CIDR network segment in the second cloud environment resource pool.
[0116] In the present disclosure, in order to achieve scheduling across cloud environment resource pools, when allocating IP addresses within a single cloud environment resource, they cannot be randomly allocated from multiple CIDR segments to prevent each CIDR segment from being occupied. This is because if an IP address in a CIDR segment is allocated, the CIDR segment cannot achieve cross-resource scheduling. Based on the above background, the present disclosure calculates the usage rate of each CIDR under the cloud environment resource pool, and then sorts the usage rates, and selects the CIDR with the highest usage rate to allocate the target IP address; if there are no IP addresses that can be allocated under the CIDR with the highest usage rate, the CIDR with the second highest usage rate is selected to allocate the target IP address, and so on. This allocation algorithm can avoid the fragmentation of multiple CIDR segments within a single cloud environment resource pool, affect cross-resource pool scheduling, and improve the utilization rate of IP addresses.
[0117] In one embodiment, in order to prevent the second cloud environment resource pool from allocating IP addresses to users from the target CIDR network segment before scheduling, an instruction for locking the target CIDR network segments will be sent to the second cloud environment resource pool to allow the second cloud environment resource pool to lock the target CIDR network segment, thereby preventing the second cloud environment resource pool from allocating elastic IPs to customers from the target CIDR network segment during scheduling to the first cloud resource pool, thereby causing scheduling failure. Specifically: a locking instruction can be sent to the second cloud environment resource pool, the locking instruction instructing the second cloud environment resource pool to lock the target CIDR network segment; and then the target CIDR network segment is scheduled to the first cloud environment resource pool.
[0118] It should be noted that, for the sake of simplicity, the method embodiments are described as a series of action combinations, but those skilled in the art should be aware that the embodiments of the present invention are not limited by the order of the actions described, because according to the embodiments of the present invention, 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 involved are not necessarily required by the embodiments of the present invention.
[0119] Reference Figure 8 , shows a structural block diagram of an elastic IP scheduling device provided in an embodiment of the present invention, which may specifically include the following modules:
[0120] The first acquisition module 11 is used to periodically acquire cloud environment resource pool data of each cloud environment resource pool, and the cloud environment resource pool data includes: the number of unallocated elastic IPs in the elastic IP pool;
[0121] A first detection module 12 is used to detect whether there is a first cloud environment resource pool in which the number of unallocated elastic IPs is less than a preset number;
[0122] A second acquisition module 13 is used to acquire a second cloud environment resource pool whose number of unallocated elastic IPs is greater than a preset threshold according to data of each cloud environment resource pool if the detection module detects that there is a first cloud environment resource pool whose number of unallocated elastic IPs is less than a preset number;
[0123] A scheduling module 14 is used to schedule a target elastic IP from the unallocated elastic IPs in the second cloud environment resource pool to the first cloud environment resource pool, wherein the number of the target elastic IPs is less than the number of the unallocated elastic IPs in the second cloud environment resource pool;
[0124] The deletion module 15 is used to delete the target elastic IP in the second cloud environment resource pool.
[0125] In one embodiment, the elastic IP in the elastic IP pool is divided into multiple CIDR segments, each CIDR segment includes multiple IP addresses; the cloud environment resource pool data also includes: unallocated IP addresses in each CIDR segment,
[0126] The second acquisition module 13 is specifically used for:
[0127] According to the unallocated IP addresses in each CIDR network segment, obtain the second cloud environment resource pool with idle CIDR network segments;
[0128] The scheduling module 14 is specifically used for:
[0129] Dispatch the target CIDR network segment from the idle CIDR network segment of the second cloud environment resource pool to the first cloud environment resource pool;
[0130] The deletion module 15 is specifically used for:
[0131] Delete the target CIDR network segment in the resource pool of the second cloud environment.
[0132] In one embodiment, the apparatus further comprises:
[0133] A receiving module is used to receive an elastic IP application request for a target cloud environment resource pool sent by a client;
[0134] The third acquisition module is used to obtain the usage rate of each CIDR network segment in the target cloud environment resource pool according to the unallocated IP addresses in each CIDR network segment in the target cloud environment resource pool and the total number of IP addresses in the corresponding CIDR network segment;
[0135] The second detection module is used to detect whether there are any unallocated IP addresses in the CIDR network segment with the highest usage rate;
[0136] A selection module is used to select a target IP address from the CIDR network segment with the highest usage rate if there are unallocated IP addresses in the CIDR network segment with the highest usage rate; if there are no unallocated IP addresses in the CIDR network segment with the highest usage rate, then select a target IP address from the CIDR network segment with the second highest usage rate;
[0137] The sending module is used to return the target IP address to the client.
[0138] In one embodiment, the selection module is further used to select a target CIDR network segment from each CIDR network segment according to a preset rule if it is determined based on the usage rate of each CIDR network segment that each CIDR network segment is not in use; and select a target IP address from the target CIDR network segment.
[0139] In one embodiment, the scheduling module 14 is specifically used for:
[0140] A locking instruction is sent to the second cloud environment resource pool, the locking instruction instructing the second cloud environment resource pool to lock the target CIDR network segment; and the target CIDR network segment is scheduled to the first cloud environment resource pool.
[0141] In one embodiment, the second acquisition module 13 is specifically used for:
[0142] According to the data of each cloud environment resource pool, multiple candidate target cloud environment resource pools with free CIDR network segments are obtained; and the cloud environment resource pool with the most free CIDR network segments is selected from the multiple candidate target cloud environment resource pools as the second cloud environment resource pool.
[0143] In one embodiment, the scheduling module is specifically used to:
[0144] The configuration information is sent to the first cloud environment resource pool, where the configuration information includes the target CIDR network segment, so that the first cloud environment resource pool configures the target CIDR network segment according to the configuration information.
[0145] As for the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.
[0146] The present disclosure also provides a scheduling system for elastic IP, such as Fig. 9 As shown, it includes: a cloud management server and multiple resource control devices, each of which includes: a cloud environment resource pool, an SDN controller and network element equipment, wherein the network element equipment includes: a tenant gateway, a switch and a router, etc.
[0147] like Fig. 9 As shown, the cloud management server includes: an EIP usage query module, an EIP usage comparison module and an EIP policy scheduling module which are connected in sequence. The cloud management server is connected to each cloud environment resource pool respectively.
[0148] Among them, the cloud management server can call the API-server interface of each cloud environment resource pool through the regin id, so as to realize the creation, update, query and deletion of the underlying resources. The API-serve of the cloud environment resource pool can execute the call to the cloud management server, which maintains a database of the cloud environment resource pool, which contains the detailed business data of the cloud environment resource pool. The SDN controller can form an accurate flow table according to the API-server instructions, and send relevant configurations to the network element devices. As the controller of the resource pool, it maintains the operation data of the network of the resource pool. Network element devices include tenant gateways, virtual routers, virtual switches, security devices and other devices. As a data plane device, it executes configuration for forwarding.
[0149] Specifically, the flow chart is as follows Fig.10As shown, the EIP usage query module in the cloud management server will periodically query the elastic IP resources of each cloud environment resource pool, that is, execute the periodic task get_eip_availabe_worker at a certain time. This work will call the underlying resources of each cloud environment resource pool respectively to query the usage of EIPs in each cloud environment resource pool and record it in the eip_use table of the cloud management database. The EIP usage comparison module executes the periodic task find_eip_useless, queries the eip_use table, and analyzes the EIPs in each current cloud environment resource pool. If a cloud environment resource pool with no available EIP is found, find_eip_useless compares the unallocated EIP with the currently set preset threshold. If the unallocated EIP is less than the preset threshold, it means that there is no available EIP, and then triggers the cross-resource pool EIP scheduling task. The EIP policy scheduling module triggers the schedule_eip task, obtains the target cloud environment resource pool with available EIP from the eip_use table, finds the available CIDR under the target cloud environment resource pool, and then locks the CIDR, so that The target cloud environment resource pool cannot allocate IP addresses from the CIDR to prevent the target cloud environment resource pool from allocating IP addresses from the CIDR during the scheduling process. Then, the scheduling strategy is executed. The main action is to manage the CIDR network segment from the target cloud environment resource pool, and then re-manage the CIDR network segment in the cloud environment resource pool without available EIP. That is, the execution of scheduling action 1 is: delete the CIDR network segment under the target cloud environment resource pool, delete the configuration of the corresponding switch, delete the configuration on the router and security device, and then execute scheduling action 2: add the CIDR network segment to the cloud environment resource pool without available EIP, and send the corresponding switch configuration, router and security device configuration to the cloud environment resource pool.
[0150] In addition, an embodiment of the present invention further provides an electronic device, such as Fig.11 As shown, it includes a processor 21, a communication interface 22, a memory 23 and a communication bus 24, wherein the processor 21, the communication interface 22, and the memory 23 communicate with each other through the communication bus 24.
[0151] Memory 23, used for storing computer programs;
[0152] The processor 21 is used to execute the program stored in the memory 23, and implements the following steps:
[0153] Periodically obtain cloud environment resource pool data of each cloud environment resource pool, wherein the cloud environment resource pool data includes: the number of unallocated elastic IPs in the elastic IP pool;
[0154] Detect whether there is a first cloud environment resource pool in which the number of unallocated elastic IPs is less than a preset number;
[0155] If so, obtaining the second cloud environment resource pool whose number of unallocated elastic IPs is greater than a preset threshold according to the data of each cloud environment resource pool;
[0156] Dispatching a target elastic IP from the unallocated elastic IPs in the second cloud environment resource pool to the first cloud environment resource pool, wherein the number of the target elastic IPs is less than the number of the unallocated elastic IPs in the second cloud environment resource pool;
[0157] Delete the target elastic IP in the second cloud environment resource pool.
[0158] In one embodiment, the elastic IP in the elastic IP pool is divided into multiple CIDR segments, each of which includes multiple IP addresses; the cloud environment resource pool data also includes: unallocated IP addresses in each of the CIDR segments,
[0159] The step of obtaining the second cloud environment resource pool in which the number of unallocated elastic IPs is greater than a preset threshold according to the data of each cloud environment resource pool includes:
[0160] According to the unallocated IP addresses in each of the CIDR network segments, obtaining the second cloud environment resource pool having an idle CIDR network segment;
[0161] The step of scheduling the target elastic IP from the unallocated elastic IP in the second cloud environment resource pool to the first cloud environment resource pool includes:
[0162] Scheduling the target CIDR network segment from the idle CIDR network segment of the second cloud environment resource pool to the first cloud environment resource pool;
[0163] The deleting the target elastic IP in the second cloud environment resource pool includes:
[0164] Delete the target CIDR network segment in the second cloud environment resource pool.
[0165] In one embodiment, the method further comprises:
[0166] Receive the elastic IP application request of the target cloud environment resource pool sent by the client;
[0167] Obtaining the usage rate of each CIDR network segment in the target cloud environment resource pool according to the unallocated IP addresses in each CIDR network segment in the target cloud environment resource pool and the total number of IP addresses in the corresponding CIDR network segment;
[0168] Detect whether there are any unallocated IP addresses in the CIDR network segment with the highest usage rate;
[0169] If there are unallocated IP addresses in the CIDR network segment with the highest usage rate, select a target IP address from the CIDR network segment with the highest usage rate;
[0170] If there is no unallocated IP address in the CIDR network segment with the highest usage rate, selecting the target IP address from the CIDR network segment with the second highest usage rate;
[0171] The target IP address is returned to the client.
[0172] In one embodiment, before returning the target IP address to the client, the method further includes:
[0173] If it is determined according to the usage rates of the CIDR network segments that none of the CIDR network segments are used, then selecting a target CIDR network segment from the CIDR network segments according to a preset rule;
[0174] The target IP address is selected from the target CIDR network segment.
[0175] In one embodiment, scheduling the target CIDR network segment from the idle CIDR network segment of the second cloud environment resource pool to the first cloud environment resource pool includes:
[0176] Sending a locking instruction to the second cloud environment resource pool, wherein the locking instruction instructs the second cloud environment resource pool to lock the target CIDR network segment;
[0177] Schedule the target CIDR network segment to the first cloud environment resource pool.
[0178] In one embodiment, the step of acquiring the second cloud environment resource pool having an idle CIDR network segment according to the data of each cloud environment resource pool includes:
[0179] Acquire multiple candidate target cloud environment resource pools with idle CIDR network segments according to the data of each cloud environment resource pool;
[0180] The cloud environment resource pool with the most idle CIDR network segments is selected from the multiple candidate target cloud environment resource pools as the second cloud environment resource pool.
[0181] In one embodiment, the scheduling target CIDR network segment to the first cloud environment resource pool includes:
[0182] Send configuration information to the first cloud environment resource pool, where the configuration information includes the target CIDR network segment, so that the first cloud environment resource pool configures the target CIDR network segment according to the configuration information.
[0183] The communication bus mentioned in the above terminal can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) 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.
[0184] The communication interface is used for communication between the above terminal and other devices.
[0185] The memory may include a random access memory (RAM) or a non-volatile memory, such as at least one disk memory. Optionally, the memory may also be at least one storage device located away from the aforementioned processor.
[0186] The above-mentioned processor can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.
[0187] like Fig.12 As shown, in another embodiment provided by the present invention, a computer-readable storage medium 31 is also provided, in which instructions are stored. When the computer-readable storage medium 31 is run on a computer, the computer executes the scheduling method of the elastic IP in the above embodiment.
[0188] In another embodiment of the present invention, a computer program product including instructions is provided. When the computer program product is run on a computer, the computer executes the elastic IP scheduling method in the above embodiment.
[0189] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function according to the embodiment of the present invention is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. The computer instructions can be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions can be transmitted from a website site, a computer, a server or a data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) mode to another website site, computer, server or data center. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or a data center that includes one or more available media integration. The available medium can be a magnetic medium (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state hard disk Solid State Disk (SSD)), etc.
[0190] It should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.
[0191] Each embodiment in this specification is described in a related manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the system embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.
[0192] The above description is only a preferred embodiment of the present invention and is not intended to limit the protection scope of the present invention. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention are included in the protection scope of the present invention.
Claims
1. A scheduling method for an elastic IP, characterized in that: include: Periodically obtain cloud environment resource pool data of each cloud environment resource pool, wherein the cloud environment resource pool data includes: the number of unallocated elastic IPs in the elastic IP pool; Detect whether there is a first cloud environment resource pool in which the number of unallocated elastic IPs is less than a preset number; If so, obtaining the second cloud environment resource pool whose number of unallocated elastic IPs is greater than a preset threshold according to the data of each cloud environment resource pool; Dispatching a target elastic IP from the unallocated elastic IPs in the second cloud environment resource pool to the first cloud environment resource pool, wherein the number of the target elastic IPs is less than the number of the unallocated elastic IPs in the second cloud environment resource pool; Delete the target elastic IP in the second cloud environment resource pool.
2. The method according to claim 1, characterized in that The elastic IP in the elastic IP pool is divided into multiple CIDR network segments, each of which includes multiple IP addresses; the cloud environment resource pool data also includes: unallocated IP addresses in each of the CIDR network segments, The step of obtaining the second cloud environment resource pool in which the number of unallocated elastic IPs is greater than a preset threshold according to the data of each cloud environment resource pool includes: According to the unallocated IP addresses in each of the CIDR network segments, obtaining the second cloud environment resource pool having an idle CIDR network segment; The step of scheduling the target elastic IP from the unallocated elastic IP in the second cloud environment resource pool to the first cloud environment resource pool includes: Scheduling the target CIDR network segment from the idle CIDR network segment of the second cloud environment resource pool to the first cloud environment resource pool; The deleting the target elastic IP in the second cloud environment resource pool includes: Delete the target CIDR network segment in the second cloud environment resource pool.
3. The method according to claim 2, characterized in that The method further comprises: Receive the elastic IP application request of the target cloud environment resource pool sent by the client; Obtaining the usage rate of each CIDR network segment in the target cloud environment resource pool according to the unallocated IP addresses in each CIDR network segment in the target cloud environment resource pool and the total number of IP addresses in the corresponding CIDR network segment; Detect whether there are any unallocated IP addresses in the CIDR network segment with the highest usage rate; If there are unallocated IP addresses in the CIDR network segment with the highest usage rate, select a target IP address from the CIDR network segment with the highest usage rate; If there is no unallocated IP address in the CIDR network segment with the highest usage rate, selecting the target IP address from the CIDR network segment with the second highest usage rate; The target IP address is returned to the client.
4. The method according to claim 3, characterized in that Before returning the target IP address to the client, the method further includes: If it is determined according to the usage rates of the CIDR network segments that none of the CIDR network segments are used, then selecting a target CIDR network segment from the CIDR network segments according to a preset rule; The target IP address is selected from the target CIDR network segment.
5. The method according to claim 2, characterized in that: The step of scheduling the target CIDR network segment from the idle CIDR network segment of the second cloud environment resource pool to the first cloud environment resource pool includes: Sending a locking instruction to the second cloud environment resource pool, wherein the locking instruction instructs the second cloud environment resource pool to lock the target CIDR network segment; Schedule the target CIDR network segment to the first cloud environment resource pool.
6. The method according to claim 2, characterized in that The step of obtaining the second cloud environment resource pool having an idle CIDR network segment according to the data of each cloud environment resource pool includes: Acquire multiple candidate target cloud environment resource pools with idle CIDR network segments according to the data of each cloud environment resource pool; The cloud environment resource pool with the most idle CIDR network segments is selected from the multiple candidate target cloud environment resource pools as the second cloud environment resource pool.
7. The method according to claim 2, characterized in that The scheduling target CIDR network segment to the first cloud environment resource pool includes: Send configuration information to the first cloud environment resource pool, where the configuration information includes the target CIDR network segment, so that the first cloud environment resource pool configures the target CIDR network segment according to the configuration information.
8. A scheduling device for an elastic IP, characterized in that: include: A first acquisition module is used to periodically acquire cloud environment resource pool data of each cloud environment resource pool, wherein the cloud environment resource pool data includes: the number of unallocated elastic IPs in the elastic IP pool; A detection module, used to detect whether there is a first cloud environment resource pool in which the number of unallocated elastic IPs is less than a preset number; A second acquisition module is used for acquiring a second cloud environment resource pool whose number of unallocated elastic IPs is greater than a preset threshold according to data of each of the cloud environment resource pools if the detection module detects that there is a first cloud environment resource pool whose number of unallocated elastic IPs is less than a preset number; A scheduling module, used to schedule a target elastic IP from the unallocated elastic IPs in the second cloud environment resource pool to the first cloud environment resource pool, wherein the number of the target elastic IPs is less than the number of the unallocated elastic IPs in the second cloud environment resource pool; A deletion module is used to delete the target elastic IP in the second cloud environment resource pool.
9. An electronic device, characterized in that: It includes a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other through the communication bus; The memory is used to store computer programs; The processor is used to implement the method according to any one of claims 1 to 7 when executing the program stored in the memory.
10. A computer-readable medium having instructions stored thereon, which, when executed by one or more processors, cause the processors to perform the method according to any one of claims 1 to 7.