Volume creation method of Openstack cloud platform based on mimicry defense
By using the checksum adjudication mechanism of mimicry tags and multiple cinder-api components in the Openstack cloud platform, the problem of time-consuming creation of mimicry defense is solved, and an efficient volume creation process is realized, improving efficiency and stability.
Patent Information
- Application Number
- CN202410998417.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-24
- Publication Date
- 2024-11-15
- Estimated Expiration
- 2044-07-24
AI Technical Summary
After integrating simulating defense technology into the Openstack cloud platform, the process of creating volumes takes a long time and is inefficient.
By adding a verbial tag between the user-side proxy unit and the business-side proxy unit, copy and distribute requests to multiple cinder-api components for checksum adjudication, and write to the database in the cinder-schduler component to separate the parameter checksum calculation process In the mimic protection zone, the database writing process is outside the protection zone, simplifying the process.
It shortens the time-consuming process of creating volumes, improves volume creation efficiency, improves stability and efficiency, while maintaining good mimic security performance.
Smart Images

Figure CN118963653A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of storage technology, and in particular to a volume creation method for an Openstack cloud platform based on mimicry defense. Background Art
[0002] Currently, based on the mimicry defense technology, multiple mimicry protection zones can be set up in the Openstack cloud platform. Figure 1 As shown, the area framed by the dotted box is the mimetic protection zone. A mimetic defense architecture is set in each mimetic protection zone, which includes a user-side agent unit, multiple heterogeneous executors, and a business-side agent unit. Data is input from the user-side agent unit, and after calculation and processing by multiple heterogeneous executors, it is output to the business-side agent unit for judgment, and finally the business-side agent unit outputs the judgment result. Setting up multiple mimetic protection zones in the Openstack cloud platform can make the cloud platform have better security performance and improve the ability of the Openstack cloud platform to resist risks.
[0003] In actual situations, in an Openstack cloud platform with the above-mentioned mimicry protection zone, when creating a volume, since the Openstack cloud platform interacts frequently with the database, each access to the database must go through a large number of mimicry security components, resulting in a long response time for each access to the database, a long volume creation process, and low efficiency. Summary of the invention
[0004] The present invention provides a volume creation method for an Openstack cloud platform based on mimicry defense, so as to solve the defect that after the mimicry defense technology is integrated into the Openstack cloud platform in the prior art, the process of creating a volume in the Openstack cloud platform is time-consuming, and achieves the purpose of shortening the process time of creating a volume and improving the efficiency of volume creation when the mimicry defense technology is integrated into the Openstack cloud platform.
[0005] The present invention provides a volume creation method for an Openstack cloud platform based on mimicry defense, which is applied to the Openstack cloud platform based on mimicry defense. The Openstack cloud platform based on mimicry defense includes a user-side proxy unit for receiving user requests, n target cinder-api components, a business-side proxy unit for adjudicating received messages, a rabbitmq component, a cinder-schduler component and a cinder-volume component, where n is a positive integer and n≥3; the method includes the following steps.
[0006] The user-side proxy unit adds a mimetic label to the received Restful request for creating a target volume to obtain a first request, and copies and distributes the first request to n target cinder-api components; the Restful request carries the volume information of the target volume; the target cinder-api component verifies the volume information in the first request; the target cinder-api component generates volume creation information according to the volume information if the verification is passed; the target cinder-api component sends an RPC Call synchronization message carrying the mimetic label and volume creation information to the business-side proxy unit; the business-side proxy unit determines whether the information carried in the RPCCall synchronization messages of all target cinder-api components is consistent, and if the determination result is yes, sends a second request carrying the volume creation information to the cinder-schduler component through the rabbitmq component; the cinder-schduler component responds to the second request, and if it is determined that the number of volumes currently created does not exceed the preset total number of volume creations, writes the corresponding volume creation data in the database according to the volume creation information; if the volume creation data is successfully written into the database, the cinder-schduler component sends an RPC carrying the volume creation data to the cinder-volume component Cast message; the cinder-volume component creates data based on the volume and creates a target volume.
[0007] According to a volume creation method for an Openstack cloud platform based on mimicry defense provided by the present invention, when the cinder-schduler component successfully writes the volume creation data into the database, it also includes: executing an operation of returning the volume creation data to the business side proxy unit through the rabbitmq component in the current first thread, and creating a second thread; executing an operation of sending an RPCCast message carrying the volume creation data to the cinder-volume component through the rabbitmq component in the second thread.
[0008] According to a volume creation method for an Openstack cloud platform based on mimicry defense provided by the present invention, volume creation data includes: volume creation information and its corresponding identification information; the cinder-schduler component responds to a second request, and when it is determined that the number of volumes currently created does not exceed the preset total number of volume creations, writes the corresponding volume creation data in a database according to the volume creation information, including: the cinder-schduler component responds to the second request, and detects whether the number of volumes currently created exceeds the total number of volume creations; the cinder-schduler component generates identification information corresponding to the volume creation information when the number of volumes currently created does not exceed the preset total number of volume creations; the cinder-schduler component writes the volume creation information and the identification information into the database.
[0009] According to a volume creation method for an Openstack cloud platform based on mimicry defense provided by the present invention, after the cinder-schduler component writes the volume creation information and identification information into a database, the method further includes: the cinder-schduler component writes the creation operation record of the target volume into the database.
[0010] According to a volume creation method for an Openstack cloud platform based on mimicry defense provided by the present invention, after the cinder-schduler component writes the volume creation information and identification information into a database, it also includes: the cinder-schduler component updates the volume resource information in the database; wherein the volume resource information includes: the number of volumes that have been created.
[0011] According to a volume creation method for an Openstack cloud platform based on mimicry defense provided by the present invention, volume information includes the following parameters: volume name, volume capacity and volume type; the target cinder-api component verifies the volume information in the first request, including: the target cinder-api component extracts the volume name, volume capacity and volume type in the volume information, and determines whether the volume name, volume capacity and volume type are legal; when the volume name, volume capacity and volume type are legal, determines whether the volume capacity exceeds the current capacity to be configured; when the volume capacity does not exceed the configurable capacity, the verification passes; when the volume capacity exceeds the current configurable capacity, the verification fails and the current program is interrupted.
[0012] According to a volume creation method for an Openstack cloud platform based on mimicry defense provided by the present invention, a business side proxy unit determines whether the information carried in the RPC Call synchronization messages of all target cinder-api components is consistent, including: the business side proxy unit determines whether the mimicry tags in all RPC Call synchronization messages are consistent; when the mimicry tags in all RPC Call synchronization messages are consistent, the business side proxy unit determines whether the volume creation information carried in the RPC Call synchronization messages of all target cinder-api components is consistent.
[0013] The present invention also provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, a volume creation method for an Openstack cloud platform based on mimicry defense as described in any one of the above is implemented.
[0014] The present invention also provides a computer-readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the volume creation method of the Openstack cloud platform based on mimicry defense as described in any one of the above is implemented.
[0015] The present invention also provides a computer program product, including a computer program, which, when executed by a processor, implements a volume creation method for an Openstack cloud platform based on mimicry defense as described in any one of the above.
[0016] The volume creation method of the Openstack cloud platform based on mimicry defense provided by the present invention is realized by a user-side proxy unit for receiving user requests, n target cinder-api components and a business-side proxy unit for judging received messages. The method of the present invention adds a mimicry label to a received Restful request for creating a target volume by the user-side proxy unit to obtain a first request, and copies and distributes the first request to n target cinder-api components; the Restful request carries volume information of the target volume, n is a positive integer and n≥3; the target cinder-api component verifies the volume information in the first request; the target cinder-api component generates volume creation information according to the volume information when the verification passes; the target cinder-api component sends an RPC Call synchronization message carrying the mimicry label and the volume creation information to the business-side proxy unit; the business-side proxy unit performs RPC on all target cinder-api components A decision is made as to whether the information carried in the Call synchronization message is consistent. If the decision result is yes, a second request carrying volume creation information is sent to the cinder-schduler component through the rabbitmq component; the cinder-schduler component responds to the second request, and when it is determined that the number of volumes currently created does not exceed the preset total number of volume creations, the cinder-schduler component writes the corresponding volume creation data in the database according to the volume creation information; when the volume creation data is successfully written into the database, the cinder-schduler component sends an RPC Cast message carrying the volume creation data to the cinder-volume component; the cinder-volume component creates the target volume according to the volume creation data. In the present invention, parameter verification and calculation, volume creation information acquisition, and synchronous calling of the cinder-api component in the volume creation process are placed in the mimicry protection zone, and other processes such as writing data to the database and creating a target volume in the volume creation process are placed outside the mimicry protection zone, so that the entire volume creation process has good mimicry security performance and saves costs as much as possible, simplifies the complexity of the volume creation process, solves the defect of the prior art that the volume creation process in the Openstack cloud platform is time-consuming after the mimicry defense technology is integrated into the Openstack cloud platform, achieves the purpose of shortening the volume creation process time and improving the volume creation efficiency when the mimicry defense technology is integrated into the Openstack cloud platform, and greatly improves the stability and efficiency of the volume creation process. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] In order to more clearly illustrate the technical solutions in the present invention or the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0018] Figure 1 It is a schematic diagram of the mimicry protection zone in the related art.
[0019] Figure 2 This is one of the flow charts of the volume creation method of the Openstack cloud platform based on mimicry defense provided by the present invention.
[0020] Figure 3 This is the second flow chart of the volume creation method of the Openstack cloud platform based on mimicry defense provided by the present invention.
[0021] Figure 4 This is the third flow chart of the volume creation method of the Openstack cloud platform based on mimicry defense provided by the present invention.
[0022] Figure 5 It is a structural schematic diagram of the electronic device provided by the present invention. DETAILED DESCRIPTION
[0023] In order to make the purpose, technical solution and advantages of the present invention clearer, the technical solution of the present invention will be clearly and completely described below in conjunction with the drawings of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0024] Combine the following Figure 2-Figure 4 The present invention describes a volume creation method for an Openstack cloud platform based on mimicry defense.
[0025] Figure 2 Schematic diagram of the volume creation method of the Openstack cloud platform based on mimicry defense provided by the present invention. Figure 2 As shown, the method includes the following S210~S280.
[0026] S210: The user-side proxy unit adds a mimicking tag to the received Restful request for creating a target volume to obtain a first request, and copies and distributes the first request to n target cinder-api components; the Restful request carries volume information of the target volume.
[0027] Before introducing S210, the mimicry defense in the embodiment of the present invention is first introduced.
[0028] For example, Figure 3 As shown, the mimic defense function in the embodiment of the present invention is implemented by a user-side proxy unit 310 for receiving user requests, n target cinder-api components 320, and a service-side proxy unit 330 for adjudicating received messages. n is a positive integer and n≥3.
[0029] It should be noted that the user-side proxy unit 310 can receive user requests and can also make decisions and process received requests.
[0030] Next, we will introduce S210. Figure 3 and Figure 4 , user terminal ( Figure 3 and Figure 4 The RESTful request carries the volume information of the target volume, which includes, for example, the volume name, volume capacity, and volume type of the target volume and other parameters related to the creation of the target volume.
[0031] See also Figure 4 After receiving the Restful request from the user terminal, the user-side proxy unit adds a preset mimicry tag to the Restful request to obtain a first request.
[0032] The preset mimetic tag is used to identify the Restful request, so that when the subsequent business-side proxy unit receives messages from multiple cinder-api service execution bodies, it can identify messages from the same Restful request according to the mimetic tag carried in the message.
[0033] For example, adding a preset mimicry tag in a Restful request may include adding a preset mimicry tag in a request header of the Restful request.
[0034] Please continue to see Figure 3 and Figure 4 , n is 3. After receiving the first request, the user-side proxy unit copies and distributes the first request to three target cinder-api components. The three target cinder-api components process the information in the first request and send it to the service-side proxy unit.
[0035] The above n target cinder-api components are cinder-api components randomly selected from m cinder-api components, where m is a positive integer and m≥n.
[0036] Please continue to see Figure 3 The user-side proxy unit 310, the service-side proxy unit 330 and the target cinder-api component 320 therebetween constitute a mimicry protection zone.
[0037] S220: The target cinder-api component verifies the volume information in the first request.
[0038] The target cinder-api component may extract various parameters related to the volume in the volume information of the first request, and then determine whether the data types of the extracted parameters are legal.
[0039] For example, the target cinder-api component can extract the volume name, volume capacity, volume type, etc. in the volume information, and then determine whether the volume name, volume capacity, and volume type are legal.
[0040] If the volume name, volume capacity, and volume type are legal, the target cinder-api component can further determine whether the volume capacity exceeds the current capacity to be configured. The current capacity to be configured is the available capacity that can be allocated to the target volume.
[0041] If the volume capacity does not exceed the configurable capacity, the verification is passed and S230 is executed; if the volume capacity exceeds the configurable capacity, the verification fails and the current program is interrupted.
[0042] In some examples, the process of determining whether the volume name, volume capacity, and volume type are legal can be as follows: add the volume name, volume capacity, and volume type parameters extracted from the first request to the kwargs dictionary, and check whether the data type of the parameters in the kwargs dictionary complies with the specifications. If so, it is legal; if not, it is illegal.
[0043] In some examples, when all parameters in the volume information are legal, the above-mentioned verification may also include: determining whether necessary parameters are missing in the volume information of the first request. For example, multiple necessary parameters may be set in advance, and the multiple necessary parameters are compared with the parameters extracted from the volume information. If one or more of the above-mentioned multiple necessary parameters do not exist in all the parameters of the first request, it is determined that the necessary parameters are missing; otherwise, the necessary parameters are not missing.
[0044] Before extracting the parameters in the volume information of the first request, the target cinder-api component may construct a worker flow to verify whether the parameters related to the volume are legal.
[0045] S230: The target cinder-api component generates volume creation information according to the volume information if the above verification passes.
[0046] If the verification is passed, the target cinder-api component extracts the parameters in the volume information. After that, the target cinder-api component generates volume creation information according to the extracted parameters.
[0047] Volume creation information can be carried in the form of a volume object. Figure 3 and Figure 4 As shown, generating volume creation information may be performing volume object creation, that is, creating a new volume object in the program according to the volume information, and the information in the volume object is the volume creation information.
[0048] It should be noted that S220~S230 corresponds to Figure 3 In the process of "parameter verification and calculation, and volume object creation", S220~S230 corresponds to Figure 4 The target cinder-api component executes the processes of "parameter extraction and verification", "volume request parameter extraction" and "volume object creation".
[0049] S240: The target cinder-api component sends an RPC Call synchronization message carrying the mimic label and volume creation information to the business-side proxy unit.
[0050] Since the message sent by the target cinder-api component to the service side proxy unit is a synchronous message, the target cinder-api component will not process other received messages before receiving the feedback message returned by the service side proxy unit.
[0051] S240 Figure 3 Synchronous call in .
[0052] S250: The service-side proxy unit determines whether the information carried in the RPC Call synchronization messages of all target cinder-api components is consistent. If the determination result is yes, the service-side proxy unit sends a second request carrying the volume creation information to the cinder-schduler component through the rabbitmq component.
[0053] In some embodiments, the business side agent unit directly determines whether the information carried in the RPC Call synchronization messages of all target cinder-api components is consistent. If the determination result is yes, that is, the information carried in the RPC Call synchronization messages of all target cinder-api components is consistent, the business side agent unit sends a second request carrying volume creation information to the cinder-schduler component through the rabbitmq component.
[0054] If the decision result is no, that is, the information carried in the RPC Call synchronization messages of all target cinder-api components is inconsistent, the service-side proxy unit returns a message indicating inconsistent information to the user-side proxy unit.
[0055] In some embodiments, in order to improve processing efficiency, the business side proxy unit may first determine whether the mimic tags in all RPC Call synchronization messages are consistent. When it is determined that the mimic tags in all RPC Call synchronization messages are consistent, it can be determined that all RPC Call synchronization messages are issued based on the same Restful request. In the previous case, the business side proxy unit determines whether the volume creation information carried in the RPC Call synchronization messages of all target cinder-api components is consistent. When it is determined that the volume creation information carried in the RPC Call synchronization messages of all target cinder-api components is consistent, the determination result is yes, that is, the information carried in the RPC Call synchronization messages of all target cinder-api components is consistent, and the business side proxy unit sends a second request carrying the volume creation information to the cinder-schduler component through the rabbitmq component.
[0056] When it is determined that the mimic tags in all RPC Call synchronization messages are inconsistent, or when it is determined that the volume creation information carried in the RPC Call synchronization messages of all target cinder-api components is inconsistent, the judgment result is determined to be no, that is, the volume creation information carried in the RPC Call synchronization messages of all target cinder-api components is inconsistent, then a message of inconsistent information is returned to the user-side agent unit.
[0057] S260: The cinder-schduler component responds to the second request, and when determining that the number of volumes currently created does not exceed the preset total number of volume creations, writes corresponding volume creation data into the database according to the volume creation information.
[0058] The cinder-schduler component can first respond to the second request and detect whether the number of volumes currently created exceeds the preset total number of volumes created (corresponding to Figure 4 The total number of volumes created is the total number of volumes that can be created in the system.
[0059] The volume creation data includes: volume creation information and its corresponding identification information. When the cinder-schduler component detects that the number of volumes currently created does not exceed the preset total number of volume creations, it generates identification information corresponding to the volume creation information. For example, when a volume object is created in S230, the created volume object is used to call the database module to generate a volume-id corresponding to the volume object as the identification information of the volume object. Then the cinder-schduler component writes the volume creation information and identification information into the database.
[0060] For example, after the cinder-schduler component generates the volume-id corresponding to the volume object, it adds a new volume data in the volume table of the database and records the data in the volume object in the volume table (corresponding to Figure 4 Complete the operation of writing volume creation information and identification information into the database.
[0061] In some embodiments, after the cinder-schduler component writes the volume creation information and identification information into the database, the embodiment of the present invention further includes: the cinder-schduler component updates the volume resource information in the database (corresponding to Figure 4 The volume resource information includes: the number of volumes that have been created.
[0062] The volume resource information is information related to the volumes created in the database, such as the number of volumes created, the total capacity of the volumes created, etc. After the cinder-schduler component writes the volume creation information and identification information into the database, the volume resource information in the database can be updated, such as adding 1 to the number of created volumes. In a specific implementation, the volume resource information is recorded in the quota table of the database. After the cinder-schduler component writes the volume creation information and identification information into the database, the cinder-schduler component can update the volume resource information in the quota table to synchronize the information.
[0063] When an exception occurs in the cinder-scheduler or cinder-volume service and the system restarts, in order to quickly restore to the current volume creation process after the restart, after the cinder-scheduler component writes the volume creation information and identification information into the database, the embodiment of the present invention further includes: the cinder-scheduler component writes the target volume creation operation record into the database. The creation operation record includes, for example, the action of creating a volume.
[0064] For example, after the volume object and its corresponding volume-id are written into the volume table, the volume object calls the database and records the current volume creation operation in the worker table of the database. When the cinder-scheduler or cinder-volume service has an exception and restarts, the service can be called again to perform the volume creation operation according to the above volume creation operation recorded in the worker table.
[0065] S270: When the volume creation data is successfully written into the database, the cinder-schduler component sends an RPC Cast message carrying the volume creation data to the cinder-volume component.
[0066] See also Figure 4 , while the cinder-schduler component sends an RPCCast message carrying volume creation data to the inder-volume component, it also returns the volume creation data to the business-side proxy unit.
[0067] In some embodiments, the cinder-schduler component may send an RPC Cast message carrying volume creation data to the inder-volume component through the current first thread, and simultaneously return the volume creation data to the service-side proxy unit through the first thread.
[0068] Because when the cinder-schduler component sends the RPC Cast message carrying the volume creation data to the inder-volume component through the current first thread, the RPC Call message previously sent by the cinder-api component to the business-side proxy unit is a synchronous message, and the cinder-api service is still in a blocked state. In this case, in order to shorten the response time, the cinder-schduler component can execute the operation of returning the volume creation data to the business-side proxy unit through the rabbitmq component in the current first thread and create a second thread when the volume creation data is successfully written to the database; and execute the operation of sending the RPCCast message carrying the volume creation data to the cinder-volume component through the rabbitmq component in the second thread.
[0069] The second thread selects the optimal storage backend through an algorithm based on information such as the volume type, and initiates an RPC Cast call to the cinder-volume component through the rabbitmq message queue in the rabbitmq component. This call is an asynchronous call, that is, the RPC Cast message sent by the rabbitmq component to the cinder-volume component is an asynchronous message.
[0070] S280: The cinder-volume component creates data based on the volume and creates a target volume.
[0071] See also Figure 4 As shown, after receiving the RPC Cast message, the cinder-volume component builds a workflow, determines the volume type of the target volume to be created according to the volume creation data, and then calls the specified storage backend driver component to create the target volume.
[0072] For example, after receiving the RPC Cast message, the cinder-volume component builds a workflow to execute the task of creating a volume object. According to the volume-id, the volume object corresponding to the volume-id is obtained from the database, the volume creation information in the volume object is extracted, and the volume type in the volume creation information is determined as the volume type of the target volume to be created. Then the task of creating the target volume is executed. According to the volume type of the target volume, the corresponding volume creation method in the driver component of the specified storage backend is called, mainly including mirror creation volume, snapshot creation volume, backup creation volume and other methods. Then the storage backend is called through the driver component, and the target volume is successfully created on the storage.
[0073] The volume creation method of the Openstack cloud platform based on mimicry defense provided by the present invention, the function of mimicry defense is realized by a user-side proxy unit for receiving user requests, n target cinder-api components, and a business-side proxy unit for adjudicating received messages, n is a positive integer and n≥3, the method of the present invention adds a mimicry label to a received Restful request for creating a target volume by the user-side proxy unit to obtain a first request, and copies and distributes the first request to the n target cinder-api components; the Restful request carries the volume information of the target volume; the target cinder-api component verifies the volume information in the first request; the target cinder-api component generates volume creation information according to the volume information when the verification passes; the target cinder-api component sends an RPCCall synchronization message carrying the mimicry label and the volume creation information to the business-side proxy unit; the business-side proxy unit sends an RPC to all target cinder-api components The call synchronization message is judged whether the information carried in it is consistent. If the judgment result is yes, a second request carrying volume creation information is sent to the cinder-schduler component through the rabbitmq component; the cinder-schduler component responds to the second request, and if it is determined that the number of volumes currently created exceeds the preset total number of volume creations, the cinder-schduler component writes the corresponding volume creation data in the database according to the volume creation information; if the volume creation data is successfully written into the database, the cinder-schduler component sends an RPC Cast message carrying the volume creation data to the cinder-volume component; the cinder-volume component creates the target volume according to the volume creation data. In the present invention, parameter verification and calculation, volume creation information acquisition, and synchronous calling of the cinder-api component in the volume creation process are placed in the mimicry protection zone, and other processes such as writing data to the database and creating a target volume in the volume creation process are placed outside the mimicry protection zone, so that the entire volume creation process has good mimicry security performance and saves costs as much as possible, simplifies the complexity of the volume creation process, solves the defect of the prior art that the volume creation process in the Openstack cloud platform is time-consuming after the mimicry defense technology is integrated into the Openstack cloud platform, achieves the purpose of shortening the volume creation process time and improving the volume creation efficiency when the mimicry defense technology is integrated into the Openstack cloud platform, and greatly improves the stability and efficiency of the volume creation process.
[0074] The embodiment of the present invention only executes database read operations within the mimetic protection zone and executes database write operations outside the mimetic protection zone, thereby saving the waiting time of the business-side proxy unit waiting for multiple write requests to arrive when executing database write operations inside the mimetic protection zone, improving the speed of database write operations and ensuring the consistency of data writing.
[0075] The embodiment of the present invention adds a synchronous call module (i.e., cinder-api sends an RPC call synchronization message to the service side proxy unit). After the cinder-api component sends the PC call synchronization message, other requests will be blocked before the cinder-api component receives the message returned by the service side proxy unit. When executing a database write operation, identification information of the volume creation information of the target volume (such as volume-id in the above example) will be generated.
[0076] In the embodiment of the present invention, when the volume creation data is successfully written into the database, a second thread is created, and the volume creation data is returned to the cinder-api component through the first thread, and finally the volume creation data is returned to the user terminal. The second thread performs the operations of selecting the optimal backend, message transfer, and calling the driver to create the target volume. It is ensured that the identifier corresponding to the volume creation information is present in the returned information and the waiting time for the returned information is shortened as much as possible.
[0077] Figure 5 An example of a physical structure diagram of an electronic device is shown in FIG. Figure 5As shown, the electronic device may include: a processor (processor) 510, a communication interface (Communications Interface) 520, a memory (memory) 530 and a communication bus 540, wherein the processor 510, the communication interface 520, and the memory 530 communicate with each other through the communication bus 540. The processor 510 can call the logic instructions in the memory 530 to execute the volume creation method of the Openstack cloud platform based on mimicry defense, which is applied to the Openstack cloud platform based on mimicry defense. The Openstack cloud platform based on mimicry defense includes a user-side proxy unit for receiving user requests, n target cinder-api components, a business-side proxy unit for adjudicating received messages, a rabbitmq component, a cinder-schduler component, and a cinder-volume component, where n is a positive integer and n≥3; the method includes: the user-side proxy unit adds a mimicry label to the received Restful request for creating a target volume to obtain a first request, and copies and distributes the first request to the n target cinder-api components; the Restful request carries the volume information of the target volume; the target cinder-api component verifies the volume information in the first request; the target cinder-api component generates volume creation information according to the volume information if the verification passes; the target cinder-api component sends an RPC Call synchronization message carrying the mimicry label and the volume creation information to the business-side proxy unit; the business-side proxy unit sends an RPC Call synchronization message to all target cinder-api components A decision is made as to whether the information carried in the Call synchronization message is consistent. If the decision result is yes, a second request carrying volume creation information is sent to the cinder-schduler component through the rabbitmq component; the cinder-schduler component responds to the second request, and when it is determined that the number of volumes currently created does not exceed the preset total number of volume creations, the cinder-schduler component writes the corresponding volume creation data in the database according to the volume creation information; when the volume creation data is successfully written into the database, the cinder-schduler component sends an RPC Cast message carrying the volume creation data to the cinder-volume component; the cinder-volume component creates the target volume according to the volume creation data.
[0078] In addition, the logic instructions in the above-mentioned memory 530 can be implemented in the form of a software functional unit and can be stored in a computer-readable storage medium when it is sold or used as an independent product. Based on such an understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, etc. Various media that can store program codes.
[0079] On the other hand, the present invention also provides a computer program product, the computer program product includes a computer program, the computer program can be stored on a computer-readable storage medium, when the computer program is executed by a processor, the computer can execute the volume creation method of the Openstack cloud platform based on mimicry defense provided by the above methods, the method is applied to the Openstack cloud platform based on mimicry defense, the Openstack cloud platform based on mimicry defense includes a user-side proxy unit for receiving user requests, n target cinder-api components, a business-side proxy unit for adjudicating received messages, a rabbitmq component, a cinder -schduler component and cinder-volume component, n is a positive integer and n≥3; the method comprises: the user-side proxy unit adds a mimicry tag to the received Restful request for creating a target volume to obtain a first request, and copies and distributes the first request to n target cinder-api components; the Restful request carries the volume information of the target volume; the target cinder-api component verifies the volume information in the first request; the target cinder-api component generates volume creation information according to the volume information if the verification passes; the target cinder-api component sends an RPC carrying the mimicry tag and volume creation information to the business-side proxy unit Call synchronization message; the business-side proxy unit determines whether the information carried in the RPC Call synchronization messages of all target cinder-api components is consistent, and if the determination result is yes, sends a second request carrying volume creation information to the cinder-schduler component through the rabbitmq component; the cinder-schduler component responds to the second request, and when it is determined that the number of volumes currently created does not exceed the preset total number of volume creations, writes the corresponding volume creation data in the database according to the volume creation information; when the volume creation data is successfully written into the database, the cinder-schduler component sends an RPC Cast message carrying volume creation data to the cinder-volume component; the cinder-volume component creates the target volume according to the volume creation data.
[0080] On the other hand, the present invention also provides a computer-readable storage medium having a computer program stored thereon, which is implemented by a processor when executed to execute the volume creation method of the Openstack cloud platform based on mimicry defense provided by the above methods, the method being applied to the Openstack cloud platform based on mimicry defense, the Openstack cloud platform based on mimicry defense comprising a user-side proxy unit for receiving user requests, n target cinder-api components, a business-side proxy unit for adjudicating received messages, a rabbitmq component, a cinder-schduler component and a cinder-volume component, where n is a positive integer and n≥3; the method comprising: the user-side proxy unit adding a mimicry label to a received Restful request for creating a target volume to obtain a first request, and copying and distributing the first request to the n target cinder-api components; the Restful request carries the volume information of the target volume; the target cinder-api component verifies the volume information in the first request; the target cinder-api component generates volume creation information according to the volume information if the verification passes; the target cinder-api component sends an RPC carrying the mimicry label and the volume creation information to the business-side proxy unit Call synchronization message; the business-side proxy unit determines whether the information carried in the RPC Call synchronization messages of all target cinder-api components is consistent, and if the determination result is yes, sends a second request carrying volume creation information to the cinder-schduler component through the rabbitmq component; the cinder-schduler component responds to the second request, and when it is determined that the number of volumes currently created does not exceed the preset total number of volume creations, writes the corresponding volume creation data in the database according to the volume creation information; when the volume creation data is successfully written into the database, the cinder-schduler component sends an RPC Cast message carrying volume creation data to the cinder-volume component; the cinder-volume component creates the target volume according to the volume creation data.
[0081] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without paying creative labor.
[0082] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a necessary general hardware platform, and of course, can also be implemented by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.
[0083] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A volume creation method for Openstack cloud platform based on mimicry defense, It is characterized in that The method is applied to an Openstack cloud platform based on mimicry defense, wherein the Openstack cloud platform based on mimicry defense includes a user-side proxy unit for receiving user requests, n target cinder-api components, a business-side proxy unit for adjudicating received messages, a rabbitmq component, a cinder-schduler component, and a cinder-volume component, where n is a positive integer and n≥3; the method includes: The user-side proxy unit adds a mimic tag to the received Restful request for creating a target volume to obtain a first request, and copies and distributes the first request to n target cinder-api components; the Restful request carries volume information of the target volume; The target cinder-api component verifies the volume information in the first request; The target cinder-api component generates volume creation information according to the volume information if the verification passes; The target cinder-api component sends an RPC Call synchronization message carrying the mimic tag and the volume creation information to the service-side proxy unit; The service-side proxy unit determines whether the information carried in the RPC Call synchronization messages of all target cinder-api components is consistent, and if the determination result is yes, sends a second request carrying the volume creation information to the cinder-schduler component through the rabbitmq component; The cinder-schduler component responds to the second request, and writes corresponding volume creation data into the database according to the volume creation information when determining that the number of volumes currently created does not exceed the preset total number of volume creations; When the volume creation data is successfully written into the database, the cinder-schduler component sends an RPC Cast message carrying the volume creation data to the cinder-volume component; The cinder-volume component creates the target volume according to the volume creation data.
2. According to the volume creation method of the Openstack cloud platform based on mimicry defense according to claim 1, It is characterized in that In the case where the volume creation data is successfully written into the database by the cinder-schduler component, the method further includes: In the current first thread, executing an operation of returning the volume creation data to the service-side proxy unit through the rabbitmq component, and creating a second thread; In the second thread, an operation of sending an RPC Cast message carrying the volume creation data to the cinder-volume component through the rabbitmq component is executed.
3. According to the volume creation method of the Openstack cloud platform based on mimicry defense according to claim 1, It is characterized in that The volume creation data includes: the volume creation information and its corresponding identification information; the cinder-schduler component responds to the second request, and when determining that the number of volumes currently created does not exceed the preset total number of volume creations, writes the corresponding volume creation data in the database according to the volume creation information, including: The cinder-schduler component responds to the second request and detects whether the number of volumes currently created exceeds the total number of volumes created; The cinder-schduler component generates the identification information corresponding to the volume creation information when the number of volumes currently created does not exceed the preset total number of volume creations; The cinder-schduler component writes the volume creation information and the identification information into the database.
4. According to the volume creation method of the Openstack cloud platform based on mimicry defense according to claim 3, It is characterized in that After the cinder-schduler component writes the volume creation information and the identification information into the database, the method further includes: The cinder-schduler component writes the creation operation record of the target volume into the database.
5. According to the volume creation method of the Openstack cloud platform based on mimicry defense according to claim 3, It is characterized in that After the cinder-schduler component writes the volume creation information and the identification information into the database, the method further includes: The cinder-schduler component updates the volume resource information in the database; wherein the volume resource information includes: the number of created volumes.
6. The volume creation method of the Openstack cloud platform based on mimicry defense according to claim 1, It is characterized in that The volume information includes the following parameters: volume name, volume capacity, and volume type; the target cinder-api component verifies the volume information in the first request, including: The target cinder-api component extracts the volume name, volume capacity and volume type in the volume information, and determines whether the volume name, the volume capacity and the volume type are legal; If the volume name, the volume capacity and the volume type are legal, determining whether the volume capacity exceeds the current capacity to be configured; In the case where the volume capacity does not exceed the to-be-configured capacity, the verification passes; In the case where the volume capacity exceeds the current configurable capacity, the check fails and the current program is interrupted.
7. The volume creation method of the Openstack cloud platform based on mimicry defense according to claim 1, It is characterized in that The service-side proxy unit determines whether the information carried in the RPC Call synchronization message of all target cinder-api components is consistent, including: The service-side proxy unit determines whether the mimic tags in all the RPC Call synchronization messages are consistent; In the case that the mimic tags in all the RPC Call synchronization messages are consistent, the service-side proxy unit determines whether the volume creation information carried in the RPC Call synchronization messages of all the target cinder-api components is consistent.
8. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, It is characterized in that When the processor executes the program, the volume creation method of the Openstack cloud platform based on mimicry defense as described in any one of claims 1 to 7 is implemented.
9. A computer-readable storage medium having a computer program stored thereon, It is characterized in that When the computer program is executed by a processor, the volume creation method of the Openstack cloud platform based on mimicry defense as described in any one of claims 1 to 7 is implemented.
10. A computer program product comprising a computer program, It is characterized in that When the computer program is executed by a processor, the volume creation method of the Openstack cloud platform based on mimicry defense as described in any one of claims 1 to 7 is implemented.
Citation Information
Patent Citations
Cloud management platform construction method based on mimicry construction
CN110545260A
Security cloud management system construction method and device based on mimicry defense
CN110768966A
Cloud platform virtual machine recovery method and computer equipment
CN112732406A
Virtual machine creation method and device and storage medium
CN113051026A
Resource creation method and apparatus, and electronic device and storage medium
WO2023093139A1
