Resource change operation verification method and device, storage medium, and computer program product
By monitoring the real-time usage data of the virtual data center and combining the dual verification mechanism of formal tables and temporary tables, and using Binlog logs to synchronize resource data in real time, the problem of low quota verification and auditing efficiency of the cloud platform's virtual data center is solved, and accurate and efficient updates of resource quota data are achieved.
Patent Information
- Application Number
- CN202411112652.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-13
- Publication Date
- 2025-09-19
- Estimated Expiration
- 2044-08-13
AI Technical Summary
The quota verification and auditing efficiency of the cloud platform's virtual data center is low, resulting in problems such as inaccurate timing synchronization, multiple release or occupation of resources, and difficult-to-troubleshoot data inconsistencies.
By monitoring the real-time usage data of the virtual data center, calling the external interface to obtain quota data, combining formal tables and temporary tables for verification, and using Binlog logs to synchronize resource data in real time, we can avoid data inconsistencies caused by interface calls and adopt a double verification mechanism to ensure data accuracy and efficiency.
It achieves real-time and accurate synchronization of resource quota data, avoids data inconsistency problems caused by pre-occupancy or concurrent operations, and improves the efficiency of quota verification and audit processing in the cloud platform virtual data center.
Smart Images

Figure CN119292759B_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present application relate to the field of computers, and specifically, to a method and device for verifying resource change operations, a storage medium, and a computer program product. Background Art
[0002] In cloud computing scenarios, many services, such as creating virtual machines and cloud disks, require verifying and preserving quotas for related resources within a virtual data center (VDC). In the past, quota verification and quota data auditing in these scenarios were typically accomplished by directly calling quota APIs or by using a scheduled synchronization mechanism to synchronize VDC quota data. These traditional approaches often suffer from the following issues: Scheduled synchronizations have time intervals, which can lead to inaccurate quota data during these intervals. Besides ensuring real-time performance, scheduled synchronization can also cause issues with simultaneous synchronization and operations. Resource creation often requires preserving VDC quota. If synchronization is performed after preserving quotas, the quotas are synchronized back, resulting in inaccurate quota verification. Interface operations often result in multiple resource releases or preserving due to multiple operation scenarios, multiple operation entry points, concurrency, and unexpected program exceptions. Once data inconsistencies occur, it can be difficult to identify the offending scenario and operation. Furthermore, interface preserving can be problematic, causing inconsistencies between resource and quota data for a period of time after preserving quotas.
[0003] Regarding the related technologies, there is a problem of low efficiency in quota verification and auditing of cloud platform virtual data centers, and no effective solution has been proposed yet. Summary of the Invention
[0004] The embodiments of the present application provide a method and device for verifying resource change operations, so as to at least solve the problem of low processing efficiency of quota verification and auditing of cloud platform virtual data centers in existing methods.
[0005] According to an embodiment of the present application, a method for verifying a resource change operation is provided, comprising: monitoring real-time usage data when a current target user uses storage resources of a virtual data center; in a case where the real-time usage data indicates that the current target user needs to perform a resource change operation, calling an external interface to obtain quota data corresponding to the current virtual data center, wherein the quota data comprises: first quota information recording normal occupation and / or release of hard disk resources of the virtual data center through the interface, and second quota information updated by determining data changes in the real-time usage data; determining the amount of storage data stored in the target hard disk resources allowed for use based on the quota data, and comparing the amount of storage data with the amount of change required corresponding to the resource change; and verifying whether the resource change operation initiated by the current target user is a valid operation based on the comparison result.
[0006] In an exemplary embodiment, whether the resource change operation initiated by the current target user is a valid operation is verified based on the comparison result, including: when the comparison result is that the amount of stored data is greater than or equal to the amount of change required, determining that the verification result of the resource change operation initiated by the current target user is a valid operation; when the comparison result is that the amount of stored data is less than the amount of change required, determining that the verification result of the resource change operation initiated by the current target user is an invalid operation.
[0007] In an exemplary embodiment, when the comparison result is that the amount of stored data is greater than or equal to the amount required for change, after determining that the verification result of the resource change operation initiated by the current target user is a valid operation, the above method also includes: obtaining first sub-quota information and second sub-quota information corresponding to the amount of stored data; determining a first available remaining amount of the remaining quota corresponding to the first sub-quota information and a second available remaining amount of the remaining quota corresponding to the second sub-quota information; when it is determined that the first available remaining amount is greater than the second available remaining amount, determining to use the second sub-quota information to correspond to the first sub-quota information for data update; when it is determined that the first available remaining amount is less than or equal to the second available remaining amount, prohibiting the use of the second sub-quota information to correspond to the first sub-quota information for data update.
[0008] In an exemplary embodiment, determining the amount of storage data stored in the target hard disk resource that is allowed to be used based on quota data includes: determining a third available remaining amount corresponding to the first quota information in the quota data, and a fourth available remaining amount corresponding to the second quota information in the quota data; identifying the relative minimum amount between the third available remaining amount and the fourth available remaining amount to obtain the minimum available remaining amount; and determining the amount of storage data stored in the target hard disk resource that is allowed to be used based on the minimum available remaining amount.
[0009] In an exemplary embodiment, after verifying whether the resource change operation initiated by the current target user is a valid operation based on the comparison result, the method further includes: if it is determined that the resource change operation is a valid operation, executing the resource change operation and obtaining a change result corresponding to the resource change; updating the second quota information based on the change result to obtain third quota information, wherein the third quota information is the quota information after the second quota information is updated; updating the first quota information through an interface change to obtain fourth quota information; if the resource change operation is to increase the quota, comparing the fifth available remaining amount corresponding to the third quota information with the sixth available remaining amount corresponding to the fourth quota information; if the comparison result indicates that the fifth available remaining amount is less than the sixth available remaining amount, performing quota synchronization adjustment on the fourth quota information based on the third quota information; if the quota synchronization adjustment is completed, verifying the actual resource usage and the latest remaining amount of the storage resources of the virtual data center, wherein the sum of the actual resource usage and the latest remaining amount is equal to the total storage resource amount of the virtual data center; generating an update log for the virtual data center based on the verification result; and sending the update log to the current target user to confirm the verification result.
[0010] In an exemplary embodiment, the above-mentioned resource change operation includes at least one of the following: creation of storage resources under a virtual data center, modification of storage resources under a virtual data center, deletion of storage resources under a virtual data center, management of storage resources under a virtual data center, allocation of storage resources under a virtual data center, recycling of storage resources under a virtual data center, and movement of storage resources under a virtual data center.
[0011] In an exemplary embodiment, before monitoring the real-time usage data of the current target user when using the storage resources of the virtual data center, the above method also includes: turning on the log function of the virtual data center and setting the row mode corresponding to the log function; when the row mode setting is completed, loading the preset monitoring encoding package, and configuring the monitoring type and monitoring period, wherein the monitoring type includes at least one of the following: a write event type for the virtual data center, an update event type for the virtual data center, and a deletion event type for the virtual data center.
[0012] According to another embodiment of the present application, a verification device for resource change operations is also provided, including: a monitoring module for monitoring real-time usage data when the current target user uses the storage resources of the virtual data center; an acquisition module for calling an external interface to obtain quota data corresponding to the current virtual data center when the real-time usage data indicates that the current target user needs to perform a resource change operation, wherein the quota data includes: first quota information recording the normal occupation and / or release of the hard disk resources of the virtual data center through the interface, and second quota information updated by determining data changes in the real-time usage data; a determination module for determining the amount of storage data stored in the target hard disk resources allowed to be used based on the quota data, and comparing the size relationship between the storage data amount and the change requirement amount corresponding to the resource change; a verification module for verifying whether the resource change operation initiated by the current target user is a valid operation based on the comparison result.
[0013] According to another embodiment of the present application, a computer-readable storage medium is provided, in which a computer program is stored. The computer program is configured to execute the steps of any of the above method embodiments when running.
[0014] According to another embodiment of the present application, an electronic device is provided, including a memory and a processor, wherein a computer program is stored in the memory, and the processor is configured to run the computer program to execute the steps in any one of the above method embodiments.
[0015] According to another embodiment of the present application, a computer program product is provided, including a computer program, which implements the steps of any of the above method embodiments when executed by a processor.
[0016] Through this application, the real-time usage data of the current target user when using the storage resources of the virtual data center is monitored; when the real-time usage data indicates that the current target user needs to perform a resource change operation, an external interface is called to obtain the quota data corresponding to the current virtual data center, wherein the quota data includes: first quota information that records the normal occupation and / or release of the hard disk resources of the virtual data center through the interface, and second quota information that is updated by determining the data changes of the real-time usage data; based on the quota data, the amount of storage data stored in the target hard disk resources allowed to be used is determined, and the relationship between the amount of storage data and the change demand corresponding to the resource change is compared; based on the comparison result, whether the resource change operation initiated by the current target user is a valid operation is verified. Using the above technical solution, the first quota information and the second quota information are used for joint verification to avoid the scenario in which the resource data and the VDC quota data are inconsistent due to pre-occupancy or running tasks in the traditional method. At the same time, because the second quota information directly monitors the changes in the data table instead of using interface calls, it can achieve real-time and accurate synchronization of data. This avoids the data inconsistency problems caused by various combined operations, concurrency, etc. as a whole, and ensures the accuracy and efficiency of data update of resource quota data. This improves the efficiency of quota verification and auditing in the cloud platform virtual data center. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:
[0018] Figure 1 This is a hardware structure block diagram of a computer terminal according to a method for verifying a resource change operation according to an embodiment of the present application;
[0019] Figure 2 is a flow chart of a method for verifying a resource change operation according to an embodiment of the present application;
[0020] Figure 3 This is a schematic diagram of the structure of a business system for quota verification and auditing of VDC cloud hard disk quotas according to an embodiment of the present application;
[0021] Figure 4 This is a business diagram of quota verification and auditing of VDC cloud hard disk quotas according to an embodiment of the present application;
[0022] Figure 5 Schematic diagram of the quota verification process of the VDC cloud hard disk quota according to an embodiment of the present application;
[0023] Figure 6 is a schematic diagram of a formal table data synchronization process according to an embodiment of the present application;
[0024] Figure 7 This is a structural block diagram of a verification device for resource change operations according to an embodiment of the present application;
[0025] Figure 8 It is a schematic structural diagram of an optional electronic device according to an embodiment of the present application. DETAILED DESCRIPTION
[0026] The embodiments of the present application will be described in detail below with reference to the accompanying drawings and in combination with the embodiments.
[0027] It should be noted that the terms "first", "second", etc. in the description and claims of this application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence.
[0028] The verification method embodiment of the resource change operation provided in the embodiment of the present application can be executed in a computer terminal or similar computing device. Taking running on a computer terminal as an example, Figure 1 This is a hardware structure block diagram of a computer terminal for a verification method of a resource change operation according to an embodiment of the present application. Figure 1 As shown, the computer terminal may include one or more ( Figure 1 Only one is shown) a processor 102 (the processor 102 may include but is not limited to a microprocessor MCU or a programmable logic device FPGA) and a memory 104 for storing data. The computer terminal may also include a transmission device 106 and an input / output device 108 for communication functions. It will be understood by those skilled in the art that Figure 1 The structure shown is only for illustration and does not limit the structure of the above-mentioned computer terminal. For example, the computer terminal may also include Figure 1 More or fewer components than shown, or with Figure 1 Different configurations shown.
[0029] The memory 104 can be used to store computer programs, for example, software programs and modules of application software, such as the computer program corresponding to the task configuration method in the embodiment of the present application. The processor 102 executes various functional applications and data processing by running the computer program stored in the memory 104, that is, implementing the above-mentioned method. The memory 104 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some examples, the memory 104 may further include a memory remotely located relative to the processor 102, and these remote memories may be connected to the computer terminal via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0030] Transmission device 106 is used to receive or transmit data via a network. A specific example of the aforementioned network may include a wireless network provided by a computer terminal's communications provider. In one embodiment, transmission device 106 includes a network interface controller (NIC), which can be connected to other network devices via a base station to enable communication with the Internet. In another embodiment, transmission device 106 may be a radio frequency (RF) module, which is used to communicate with the Internet wirelessly.
[0031] In addition, in order to better understand the technical solution of this application, the relevant terms are explained, but this does not limit this application.
[0032] VDC: Virtual Data Center (VDC). A virtual data center is a new data center model that applies cloud computing concepts. Using virtualization technology, it abstracts and integrates physical resources (such as servers, storage, and networks) into a shared virtual resource pool, enabling dynamic resource allocation and scheduling. This allows data centers to automate deployment, reduce operating costs, and improve system efficiency, flexibility, and application availability and scalability.
[0033] Binlog: Binary log file in MySQL.
[0034] In this embodiment, a method for verifying a resource change operation is provided, including but not limited to being applied in a computer terminal. Figure 2 is a flow chart of a verification method for a resource change operation according to an embodiment of the present application, such as Figure 2 As shown, the process includes the following steps S202-S208:
[0035] Step S202: monitoring real-time usage data of the current target user when using storage resources of the virtual data center;
[0036] Step S204: When the real-time usage data indicates that the current target user needs to perform a resource change operation, an external interface is called to obtain quota data corresponding to the current virtual data center, where the quota data includes: first quota information recording normal occupation and / or release of hard disk resources of the virtual data center through the interface, and second quota information updated by determining data changes in the real-time usage data;
[0037] Step S206: determining the amount of storage data allowed to be stored in the target hard disk resource based on the quota data, and comparing the amount of storage data with the change requirement corresponding to the resource change;
[0038] Step S208: Verify whether the resource change operation initiated by the current target user is a valid operation based on the comparison result.
[0039] Through the above technical solution, the real-time usage data of the current target user when using the storage resources of the virtual data center is monitored; when the real-time usage data indicates that the current target user needs to perform a resource change operation, an external interface is called to obtain the quota data corresponding to the current virtual data center, wherein the quota data includes: first quota information that records the normal occupation and / or release of the hard disk resources of the virtual data center through the interface, and second quota information that is updated by determining the data changes of the real-time usage data; based on the quota data, the storage data volume of the target hard disk resources allowed to be used is determined, and the storage data volume is compared with the change demand corresponding to the resource change; based on the comparison result, whether the resource change operation initiated by the current target user is a valid operation is verified. Using the above technical solution, the first quota information and the second quota information are used for joint verification to avoid the scenario in which the resource data and the VDC quota data are inconsistent due to pre-occupancy or running tasks in the traditional method. At the same time, because the second quota information directly monitors the changes in the data table instead of using the interface call, the data can be synchronized in real time and accurately. This overall avoids the data inconsistency problems caused by various combined operations, concurrency, etc., and ensures the accurate and efficient data update of the resource quota data. This improves the efficiency of quota verification and auditing in the cloud platform virtual data center.
[0040] Optionally, the above step S208 also includes: when the comparison result is that the amount of stored data is greater than or equal to the amount of change required, determining that the verification result of the resource change operation initiated by the current target user is a valid operation; when the comparison result is that the amount of stored data is less than the amount of change required, determining that the verification result of the resource change operation initiated by the current target user is an invalid operation.
[0041] In summary, through the above implementation method, the size relationship between the storage data volume and the change requirement volume is compared to determine whether the resource volume required for the current resource change operation can be effectively provided, thereby avoiding the execution of abnormal resource change operations and improving the accuracy of the resource change process.
[0042] In an exemplary embodiment, when the comparison result is that the amount of stored data is greater than or equal to the amount required for change, after determining that the verification result of the resource change operation initiated by the current target user is a valid operation, the above method also includes: obtaining first sub-quota information and second sub-quota information corresponding to the amount of stored data; determining a first available remaining amount of the remaining quota corresponding to the first sub-quota information and a second available remaining amount of the remaining quota corresponding to the second sub-quota information; when it is determined that the first available remaining amount is greater than the second available remaining amount, determining to use the second sub-quota information to correspond to the first sub-quota information for data update; when it is determined that the first available remaining amount is less than or equal to the second available remaining amount, prohibiting the use of the second sub-quota information to correspond to the first sub-quota information for data update.
[0043] In summary, the above implementation method compares the first and second sub-quota information corresponding to the virtual data center after the verification result is determined. Because the first sub-quota information uses direct interface manipulation, it often encounters inconsistencies between the VDC quota data and the resource data within the VDC. Therefore, the second sub-quota information is used to audit and synchronize the data in the temporary table. This ensures the accuracy of the final quota data for the virtual data center.
[0044] In an exemplary embodiment, determining the amount of storage data stored in the target hard disk resource that is allowed to be used based on quota data includes: determining a third available remaining amount corresponding to the first quota information in the quota data, and a fourth available remaining amount corresponding to the second quota information in the quota data; identifying the relative minimum amount between the third available remaining amount and the fourth available remaining amount to obtain the minimum available remaining amount; and determining the amount of storage data stored in the target hard disk resource that is allowed to be used based on the minimum available remaining amount.
[0045] In summary, the above implementation combines the first quota information of the interface with the second quota information, while the second quota information is not. Verification is performed using a combination of the formal table (equivalent to the second quota information in the above embodiment) and the temporary table (equivalent to the first quota information in the above embodiment), taking the minimum remaining amount between the two. This improves quota verification efficiency.
[0046] In an exemplary embodiment, after verifying whether the resource change operation initiated by the current target user is a valid operation based on the comparison result, the method further includes: if it is determined that the resource change operation is a valid operation, executing the resource change operation and obtaining a change result corresponding to the resource change; updating the second quota information based on the change result to obtain third quota information, wherein the third quota information is the quota information after the second quota information is updated; updating the first quota information through an interface change to obtain fourth quota information; if the resource change operation is to increase the quota, comparing the fifth available remaining amount corresponding to the third quota information with the sixth available remaining amount corresponding to the fourth quota information; if the comparison result indicates that the fifth available remaining amount is less than the sixth available remaining amount, performing quota synchronization adjustment on the fourth quota information based on the third quota information; if the quota synchronization adjustment is completed, verifying the actual resource usage and the latest remaining amount of the storage resources of the virtual data center, wherein the sum of the actual resource usage and the latest remaining amount is equal to the total storage resource amount of the virtual data center; generating an update log for the virtual data center based on the verification result; and sending the update log to the current target user to confirm the verification result.
[0047] In summary, through the above implementation, log information is updated, and the corresponding update information value is sent to the target user to complete the feedback of the interface operation quota.
[0048] In an exemplary embodiment, the above-mentioned resource change operation includes at least one of the following: creation of storage resources under a virtual data center, modification of storage resources under a virtual data center, deletion of storage resources under a virtual data center, management of storage resources under a virtual data center, allocation of storage resources under a virtual data center, recycling of storage resources under a virtual data center, and movement of storage resources under a virtual data center.
[0049] In an exemplary embodiment, before monitoring the real-time usage data of the current target user when using the storage resources of the virtual data center, the above method also includes: turning on the log function of the virtual data center and setting the row mode corresponding to the log function; when the row mode setting is completed, loading the preset monitoring encoding package, and configuring the monitoring type and monitoring period, wherein the monitoring type includes at least one of the following: a write event type for the virtual data center, an update event type for the virtual data center, and a deletion event type for the virtual data center.
[0050] In summary, through the above implementation, the accuracy of monitoring is ensured by configuration before monitoring is performed, and the specific values before and after resource changes and the difference after the change can be clearly perceived, providing data support for subsequent quota verification.
[0051] Obviously, the embodiments described above are only part of the embodiments of the present invention, rather than all the embodiments. In order to better understand the above method, the above process is described below in conjunction with the embodiments, but it is not intended to limit the technical solutions of the embodiments of the present invention. Specifically:
[0052] In an exemplary embodiment, a Binlog-based quota verification and auditing method for a cloud platform virtual data center is proposed. This method monitors changes in core resource tables within VDC tenants and reports them to the VDC in real time for aggregation. Quota verification utilizes both temporary and official tables. This approach addresses issues such as data real-time availability and concurrency caused by scheduled synchronization. Because official table data is synchronized directly from the monitoring resource table database and is independent of business operations, it avoids data inconsistencies caused by multiple entry points and failure to roll back exceptions.
[0053] As an optional implementation, taking VDC cloud disk quotas as an example, the VDC quota table is designed to consist of two tables: a temporary table and a formal table. The fields in these two tables are identical, but the data sources are different. The temporary table is used for normal cloud disk business verification, and quotas are allocated and released normally through the interface. The formal table monitors cloud disk table data changes using Binlog logs and directly updates quota data. The data in the formal table is the standard. If the temporary table data is inconsistent with the formal table data, the formal table data is used as the reference for synchronization to the temporary table.
[0054] Optionally, the business system for quota verification and auditing of the above VDC cloud hard disk quota is implemented as follows: Figure 3 As shown, Figure 3 This is a schematic diagram of the structure of a business system for quota verification and auditing of VDC cloud hard disk quotas according to an embodiment of the present application; it includes:
[0055] VDC Data Verification Module 32: This module provides an external interface for business-side quota verification, quota allocation, and quota release. This interface operates on a temporary quota table, not the official table. Verification is performed using a combination of the official and temporary tables, with the minimum remaining value between the two being used for verification.
[0056] Binlog log monitoring and parsing module 34: responsible for monitoring changes in core resource data within the VDC, updating the formal table when operations such as creation, modification, and deletion are detected. The formal table data is always consistent with the resources within the VDC.
[0057] Auditing Module 36 for Official and Temporary Tables: Due to the direct interface operation used for temporary tables, inconsistencies between VDC quota data and VDC resource data are common. Therefore, formal tables are used to audit and synchronize temporary table data. Furthermore, formal table data is synchronized and compared periodically, creating a backup mechanism.
[0058] Optional, Figure 4 This is a data interaction diagram of a business system according to an embodiment of the present application, which specifically includes the following steps:
[0059] Step a: The target object initiates a request to the business system.
[0060] Step b: The business system initiates quota verification and verifies the quota through the relevant interface. Specifically, the available amount of the temporary table and the available amount of the formal table are determined through the interface, and the minimum value is taken for verification.
[0061] Step c: audit the temporary table; verify the temporary table data, and update the temporary table when it is determined that the available capacity of the formal table is less than that of the temporary table.
[0062] Step d, modifying the temporary table; completing the update of the temporary table in the database, and further updating the temporary table only when an increase in quota usage is detected.
[0063] Step e: When the verification is completed, the result is returned to the business system through the interface.
[0064] Step f: If there are tasks in the business system, the business is completed and resources are created and stored in the database; at the same time, the biglog log file corresponding to the resource is determined.
[0065] Step g: Use the monitoring and parsing log to modify the quota in the quota formal table to complete the update of the quota information.
[0066] Step h: Perform a temporary table audit on the temporary data table using the updated formal table to ensure accurate and consistent quota data.
[0067] Optional, Figure 5 : This is a schematic diagram of the quota verification process for the VDC cloud hard disk quota according to an embodiment of the present application. The specific verification process includes the following steps:
[0068] Step 1) The user initiates a resource change operation, such as create, modify, delete, manage, allocate, reclaim, move, etc. This includes all operations that cause changes to resources within the VDC, including but not limited to these.
[0069] Step 2) Call the VDC quota interface to verify whether the remaining quota meets the change requirements. Query the remaining quota data in the temporary and official tables for the resource and select the minimum value. Compare it with the resource change value to determine whether it meets the requirements.
[0070] Step 3) After the quota check passes, continue with the resource-related operations; if the quota check fails, terminate the resource change operation;
[0071] Step 4) Determine whether the quota data of the formal table is smaller than that of the temporary table. If the result is true, update the temporary table with the quota data of the formal table.
[0072] Optional, Figure 6 : is a schematic diagram of the formal table data synchronization process according to an embodiment of the present application. The formal table data synchronization process includes the following steps:
[0073] Step 501: A user operates a resource in a VDC, causing resource data to change.
[0074] Step 502: Monitor changes in the Binlog log, parse the log, and determine whether a resource quota needs to be changed.
[0075] Step 503: If a resource quota changes, update the quota formal table data.
[0076] Step 504: Determine whether the quota change is an increase. If it is an increase, and the quota data in the official table is not consistent with the quota data in the temporary table after the increase, update the quota in the temporary table.
[0077] Step 505: The scheduled task performs full query synchronization every few minutes. This is a backup mechanism.
[0078] It's important to note that the Binlog file, also known as the update log, is a crucial log file in MySQL and is closely related to operations and maintenance. It records all statements that update the database (such as DDL and DML statements) and stores them in binary format on disk. It excludes statements that don't modify any data (such as query statements like select and show).
[0079] Binlogs have three formats: statement, row, and mixed. The row format records the details of each data modification. Even if only a single field is updated, the Binlog records the data for all fields. This format has the advantage of not recording SQL statement context, but clearly recording the details of each data change. This format allows for a clear understanding of the specific values before and after a resource change, as well as the difference in value after the change.
[0080] In addition, the quota verification and auditing methods for the aforementioned cloud platform virtual data centers require the following prerequisites: 1. Data is stored in MySQL, and the MySQL version must be greater than 5.1.5. 2. MySQL must be configured with Binlog enabled.
[0081] Optional configuration information is as follows: Configure to enable binlog;
[0082] log-bin= / usr / local / mysql / data / binlog / mysql-bin;
[0083] Note that 5.7 and higher versions need to configure this item:
[0084] server-id=123454;
[0085] # (customized, guaranteed uniqueness);
[0086] #binlog format, there are 3 types: statement, row, mixed;
[0087] binlog-format=ROW;
[0088] #Indicates that each write is synchronized with the hard disk, which will affect performance. When it is 0, it means that MySQL does not flush the disk when the transaction is committed. Sync-binlog=1 is determined by the system.
[0089] Optionally, the specific implementation steps for Binlog monitoring and parsing are as follows:
[0090] Step 1: Enable the MySQL Binlog logging function and set the logging mode to row mode.
[0091] Step 2: The log monitoring parsing module relies on the log monitoring jar package. The specific code is as follows: <dependency>
[0092] <groupid> com.github.shyiko< / groupid>
[0093] <artifactid> mysql-binlog-connector-java< / artifactid>
[0094] <version> 0.21.0< / version>
[0095] < / dependency> ”.
[0096] Step 3: Configure application.yml. The specific code is as follows: # binlog listener
[0097] binlog:
[0098] datasource:
[0099] url: ${incloud.common.db.url}
[0100] username: ${incloud.iresource-common.db.username}
[0101] password: ${incloud.iresource-common.db.password}
[0102] dbTables: '{"iresource": "t_net_net, t_net_subnet"}'".
[0103] Step 4: Monitor and parse the logs. Determine whether the table is being monitored and the monitoring type. Monitor three main types of events: write events: PRE_GA_WRITE_ROWS, WRITE_ROWS, and EXT_WRITE_ROWS; update events: PRE_GA_UPDATE_ROWS, UPDATE_ROWS, and EXT_UPDATE_ROWS; and delete events: PRE_GA_DELETE_ROWS, DELETE_ROWS, and EXT_DELETE_ROWS.
[0104] Step 5: Update the resource table after monitoring the event in step 4. If it is a write event or an update event, the temporary table data must also be updated simultaneously.
[0105] Through the above implementation, quota verification is performed using both temporary and formal tables, without the need to pre-occupy quotas. Binlog is used to synchronize VDC resource data to VDC quotas in real time, solving the problem of multiple entries. In addition, VDC quota data verification uses both temporary and formal tables for dual verification; temporary table data auditing does not rely on scheduled tasks and has no time intervals. This optimizes and upgrades the VDC quota data verification and data auditing methods in cloud computing scenarios. It should be noted that the above-mentioned virtual data center data verification and synchronization method is not only applicable to cloud computing scenarios, but also to all similar scenarios. For example, in scenarios where secondary units like group companies report data in real time, synchronization and auditing can also utilize this solution. This application does not impose too many restrictions on this.
[0106] Through the description of the above embodiments, those skilled in the art can clearly understand that the methods according to the above embodiments can be implemented by means of software plus the necessary general hardware platform. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present application, or the part that contributes to the existing technology, can be embodied in the form of a software product. The computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk), and includes a number of instructions for enabling a terminal device (which can be a mobile phone, computer, server, or network device, etc.) to execute the methods described in each embodiment of the present application.
[0107] In this embodiment, a verification device for resource change operations is also provided to implement the above-mentioned embodiments and preferred embodiments. Details already described will not be repeated here. As used below, the term "module" may refer to a combination of software and / or hardware that implements a predetermined function. Although the modules described in the following embodiments are preferably implemented in software, implementation using hardware, or a combination of software and hardware, is also possible and contemplated.
[0108] Figure 7 This is a structural block diagram of a verification device for resource change operation according to an embodiment of the present application. Figure 7 As shown, the device includes:
[0109] A monitoring module 62 is used to monitor real-time usage data of the current target user when using the storage resources of the virtual data center;
[0110] an acquisition module 64 configured to, when the real-time usage data indicates that the current target user needs to perform a resource change operation, call an external interface to obtain quota data corresponding to the current virtual data center, wherein the quota data includes: first quota information recording normal occupation and / or release of hard disk resources of the virtual data center through the interface, and second quota information updated by determining data changes in the real-time usage data;
[0111] a determination module 66 for determining the amount of storage data allowed to be stored in the target hard disk resource based on the quota data, and comparing the amount of storage data with the amount of change required corresponding to the resource change;
[0112] The verification module 68 is configured to verify whether the resource change operation initiated by the current target user is a valid operation based on the comparison result.
[0113] The above-mentioned device monitors the real-time usage data of the storage resources of the virtual data center when the current target user uses the storage resources of the virtual data center; when the real-time usage data indicates that the current target user needs to perform a resource change operation, calls an external interface to obtain the quota data corresponding to the current virtual data center, wherein the quota data includes: first quota information that records the normal occupation and / or release of the hard disk resources of the virtual data center through the interface, and second quota information that is updated by determining the data changes in the real-time usage data; determines the storage data volume of the target hard disk resources allowed to be used based on the quota data, and compares the storage data volume with the change demand corresponding to the resource change; verifies whether the resource change operation initiated by the current target user is a valid operation based on the comparison result. Using the above-mentioned technical solution, the first quota information and the second quota information are used for joint verification to avoid the scenario in which the resource data and the VDC quota data are inconsistent due to pre-occupancy or running tasks in the traditional method. At the same time, because the second quota information directly monitors the changes in the data table instead of using the interface call, it can achieve real-time and accurate data synchronization. This overall avoids the data inconsistency problems caused by various combined operations, concurrency, etc., and ensures the accurate and efficient data update of resource quota data. This improves the efficiency of quota verification and auditing in the cloud platform virtual data center.
[0114] In an exemplary embodiment, the above-mentioned verification module is also used to determine that the verification result of the resource change operation initiated by the current target user is a valid operation when the comparison result is that the amount of stored data is greater than or equal to the amount of change required; and to determine that the verification result of the resource change operation initiated by the current target user is an invalid operation when the comparison result is that the amount of stored data is less than the amount of change required.
[0115] In an exemplary embodiment, the above-mentioned device also includes: an update module, which is used to obtain the first sub-quota information and the second sub-quota information corresponding to the storage data volume after determining that the verification result of the resource change operation initiated by the current target user is a valid operation when the comparison result is that the storage data volume is greater than or equal to the change requirement volume; determine the first available remaining amount of the remaining quota corresponding to the first sub-quota information and the second available remaining amount of the remaining quota corresponding to the second sub-quota information; when it is determined that the first available remaining amount is greater than the second available remaining amount, determine to use the second sub-quota information to update the data corresponding to the first sub-quota information; when it is determined that the first available remaining amount is less than or equal to the second available remaining amount, prohibit the use of the second sub-quota information to update the data corresponding to the first sub-quota information.
[0116] In an exemplary embodiment, the above-mentioned determination module is also used to determine the third available remaining amount corresponding to the first quota information in the quota data, and the fourth available remaining amount corresponding to the second quota information in the quota data; identify the relative minimum amount between the third available remaining amount and the fourth available remaining amount to obtain the minimum available remaining amount; and determine the amount of storage data stored in the target hard disk resource allowed to be used based on the minimum available remaining amount.
[0117] In an exemplary embodiment, the above-mentioned device further includes: a synchronization module, which is used to verify whether the resource change operation initiated by the current target user is a valid operation based on the comparison result, and if it is determined that the resource change operation is a valid operation, execute the resource change operation and obtain the change result corresponding to the resource change; update the second quota information based on the change result to obtain third quota information, wherein the third quota information is the quota information after the second quota information is updated; update the first quota information through interface changes to obtain fourth quota information; if the resource change operation is to increase the quota, compare the third quota information with the the fifth available remaining amount corresponding to the fourth quota information and the sixth available remaining amount corresponding to the fourth quota information; when the comparison result indicates that the fifth available remaining amount is less than the sixth available remaining amount, the fourth quota information is adjusted synchronously based on the third quota information; when the quota synchronization adjustment is completed, the actual resource usage and the latest remaining amount of the storage resources of the virtual data center are verified, wherein the sum of the actual resource usage and the latest remaining amount is equal to the total storage resource amount of the virtual data center; an update log of the virtual data center is generated according to the verification result; and the update log is sent to the current target user to determine the verification result.
[0118] In an exemplary embodiment, the above-mentioned resource change operation includes at least one of the following: creation of storage resources under the virtual data center, modification of storage resources under the virtual data center, deletion of storage resources under the virtual data center, management of storage resources under the virtual data center, allocation of storage resources under the virtual data center, recycling of storage resources under the virtual data center, and movement of storage resources under the virtual data center.
[0119] In an exemplary embodiment, the above-mentioned device also includes: a configuration module, which is used to enable the log function of the virtual data center and set the row mode corresponding to the log function before monitoring the real-time usage data of the current target user when using the storage resources of the virtual data center; after completing the row mode setting, load the preset monitoring encoding package, and configure the monitoring type and monitoring period, wherein the monitoring type includes at least one of the following: a write event type for the virtual data center, an update event type for the virtual data center, and a deletion event type for the virtual data center.
[0120] It should be noted that the above modules can be implemented through software or hardware. For the latter, it can be implemented in the following ways, but not limited to: the above modules are all located in the same processor; or the above modules are located in different processors in any combination.
[0121] An embodiment of the present application further provides a computer-readable storage medium, in which a computer program is stored. The computer program is configured to execute the steps of any of the above method embodiments when run.
[0122] Optionally, in this embodiment, the computer program may be configured to perform the following steps:
[0123] S1 monitors the real-time usage data of the current target user when using the storage resources of the virtual data center;
[0124] S2. When the real-time usage data indicates that the current target user needs to perform a resource change operation, calling an external interface to obtain quota data corresponding to the current virtual data center, wherein the quota data includes: first quota information recording normal occupation and / or release of hard disk resources of the virtual data center through the interface, and second quota information updated by determining data changes in the real-time usage data;
[0125] S3, determining the amount of storage data allowed to be stored in the target hard disk resource based on the quota data, and comparing the amount of storage data with the change requirement corresponding to the resource change;
[0126] S4: Verify whether the resource change operation initiated by the current target user is a valid operation based on the comparison result.
[0127] In an exemplary embodiment, the computer-readable storage medium may include, but is not limited to, various media that can store computer programs, such as a USB flash drive, a read-only memory (ROM), a random access memory (RAM), a mobile hard disk, a magnetic disk, or an optical disk.
[0128] The embodiment of the present application also provides an electronic device, such as Figure 8 As shown, the electronic device includes a memory 802 and a processor 804. The memory 802 stores a computer program, and the processor 804 is configured to execute the steps in any of the above method embodiments through the computer program.
[0129] Optionally, in this embodiment, the processor 804 may be configured to execute the following steps through a computer program:
[0130] S1 monitors the real-time usage data of the current target user when using the storage resources of the virtual data center;
[0131] S2. When the real-time usage data indicates that the current target user needs to perform a resource change operation, calling an external interface to obtain quota data corresponding to the current virtual data center, wherein the quota data includes: first quota information recording normal occupation and / or release of hard disk resources of the virtual data center through the interface, and second quota information updated by determining data changes in the real-time usage data;
[0132] S3, determining the amount of storage data allowed to be stored in the target hard disk resource based on the quota data, and comparing the amount of storage data with the change requirement corresponding to the resource change;
[0133] S4: Verify whether the resource change operation initiated by the current target user is a valid operation based on the comparison result.
[0134] For specific examples in this embodiment, reference may be made to the examples described in the above embodiments and exemplary implementation modes, and this embodiment will not be described in detail here.
[0135] Alternatively, those skilled in the art will appreciate that Figure 8 The structure shown is for illustration only. Figure 8 The structure of the electronic device is not limited. For example, the electronic device may also include Figure 8 More or fewer components (such as network interfaces, etc.) as shown in, or with Figure 8 Different configurations shown.
[0136] Among them, the memory 802 can be used to store software programs and modules, such as the program instructions / modules corresponding to the verification method and device for resource change operations in the embodiments of the present application. The processor 804 executes various functional applications and data processing by running the software programs and modules stored in the memory 802, that is, realizing the verification method for resource change operations mentioned above. The memory 802 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 802 may further include a memory remotely located relative to the processor 804, and these remote memories may be connected to the terminal via a network. Examples of the above-mentioned networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof. Among them, the memory 802 can be used specifically, but not limited to, to store information such as system configuration files. As an example, such as Figure 8 As shown, the memory 802 may include but is not limited to all modules in the above-mentioned verification device for resource change operation. In addition, it may also include but is not limited to other module units in the above-mentioned verification device for resource change operation, which will not be repeated in this example.
[0137] Optionally, the transmission device 806 is configured to receive or transmit data via a network. Specific examples of the aforementioned network may include wired networks and wireless networks. In one embodiment, the transmission device 806 includes a network interface controller (NIC), which can be connected to other network devices and a router via a network cable to enable communication with the Internet or a local area network. In one embodiment, the transmission device 806 is a radio frequency (RF) module configured to communicate with the Internet wirelessly.
[0138] In addition, the electronic device further includes: a display 808; and a connection bus 510 for connecting various module components in the electronic device.
[0139] An embodiment of the present application further provides a computer program product, which includes a computer program. When the computer program is executed by a processor, the steps in any one of the above method embodiments are implemented.
[0140] An embodiment of the present application further provides another computer program product, comprising a non-volatile computer-readable storage medium, wherein the non-volatile computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of any of the above method embodiments are implemented.
[0141] An embodiment of the present application also provides a computer program, which includes computer instructions stored in a computer-readable storage medium; a processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device performs the steps of any of the above method embodiments.
[0142] Obviously, those skilled in the art should understand that the modules or steps of the present application described above can be implemented using a general-purpose computing device, they can be concentrated on a single computing device, or distributed across a network composed of multiple computing devices, they can be implemented using program code executable by the computing device, and thus, they can be stored in a storage device and executed by the computing device, and in some cases, the steps shown or described can be performed in a different order than herein, or they can be fabricated into separate integrated circuit modules, or multiple modules or steps can be fabricated into a single integrated circuit module for implementation. Thus, the present application is not limited to any specific combination of hardware and software.
[0143] The above description is merely a preferred embodiment of the present application and is not intended to limit the present application. Various modifications and variations are possible for those skilled in the art. Any modifications, equivalent substitutions, improvements, etc. made within the principles of the present application shall be included within the scope of protection of the present application.
Claims
1. A method for verifying a resource change operation, characterized in that: include: Monitor the real-time usage data of the current target user when using the storage resources of the virtual data center; In a case where the real-time usage data indicates that the current target user needs to perform a resource change operation, calling an external interface to obtain quota data corresponding to the current virtual data center, wherein the quota data includes: first quota information recording normal occupation and / or release of hard disk resources of the virtual data center through the interface, and second quota information updated by determining data changes in the real-time usage data; Determining the amount of storage data allowed to be stored in the target hard disk resource based on the quota data, and comparing the amount of storage data with the change requirement corresponding to the resource change; Verifying whether the resource change operation initiated by the current target user is a valid operation based on the comparison result; wherein, verifying whether the resource change operation initiated by the current target user is a valid operation according to the comparison result includes: if the comparison result shows that the amount of stored data is greater than or equal to the amount required for change, determining that the verification result of the resource change operation initiated by the current target user is a valid operation; if the comparison result shows that the amount of stored data is less than the amount required for change, determining that the verification result of the resource change operation initiated by the current target user is an invalid operation; Among them, determining the amount of storage data stored in the target hard disk resource that is allowed to be used based on the quota data includes: determining the third available remaining amount corresponding to the first quota information in the quota data, and the fourth available remaining amount corresponding to the second quota information in the quota data; identifying the relative minimum amount between the third available remaining amount and the fourth available remaining amount to obtain the minimum available remaining amount; and determining the amount of storage data stored in the target hard disk resource that is allowed to be used based on the minimum available remaining amount.
2. The method according to claim 1, characterized in that If the comparison result shows that the amount of stored data is greater than or equal to the amount of change required, after determining that the verification result of the resource change operation initiated by the current target user is a valid operation, the method further includes: Obtaining first sub-quota information and second sub-quota information corresponding to the storage data amount; Determine a first available remaining amount of the remaining quota corresponding to the first sub-quota information and a second available remaining amount of the remaining quota corresponding to the second sub-quota information; If it is determined that the first available remaining amount is greater than the second available remaining amount, determining to use the second sub-quota information to perform data update corresponding to the first sub-quota information; If it is determined that the first available remaining amount is less than or equal to the second available remaining amount, it is prohibited to use the second sub-quota information to update data corresponding to the first sub-quota information.
3. The method according to claim 1, characterized in that After verifying whether the resource change operation initiated by the current target user is a valid operation based on the comparison result, the method further includes: If the resource change operation is determined to be a valid operation, executing the resource change operation and obtaining a change result corresponding to the resource change; updating the second quota information based on the change result to obtain third quota information, wherein the third quota information is quota information after the second quota information is updated; updating the first quota information through an interface change to obtain fourth quota information; In a case where the resource change operation is to increase a quota, comparing a fifth available remaining amount corresponding to the third quota information with a sixth available remaining amount corresponding to the fourth quota information; If the comparison result indicates that the fifth available remaining amount is less than the sixth available remaining amount, performing quota synchronization adjustment on the fourth quota information based on the third quota information; When the quota synchronization adjustment is completed, verifying the actual resource usage and the latest remaining amount of the storage resources of the virtual data center, wherein the sum of the actual resource usage and the latest remaining amount is equal to the total storage resource amount of the virtual data center; Generate an update log of the virtual data center according to the verification result; The update log is sent to the current target user to determine the verification result.
4. The method according to claim 1, wherein The resource change operation includes at least one of the following: Creation of storage resources under the virtual data center, modification of storage resources under the virtual data center, deletion of storage resources under the virtual data center, management of storage resources under the virtual data center, allocation of storage resources under the virtual data center, recycling of storage resources under the virtual data center, and movement of storage resources under the virtual data center.
5. The method according to claim 1, wherein Before monitoring the real-time usage data of the current target user when using the storage resources of the virtual data center, the method further includes: Enable the logging function of the virtual data center and set the row mode corresponding to the logging function; When the row mode setting is completed, the preset monitoring coding package is loaded, and the monitoring type and monitoring period are configured, wherein the monitoring type includes at least one of the following: a write event type for the virtual data center, an update event type for the virtual data center, and a deletion event type for the virtual data center.
6. A verification device for resource change operation, characterized in that: include: A monitoring module is used to monitor the real-time usage data of the current target user when using the storage resources of the virtual data center; an acquisition module configured to, when the real-time usage data indicates that the current target user needs to perform a resource change operation, call an external interface to obtain quota data corresponding to the current virtual data center, wherein the quota data includes: first quota information recording normal occupation and / or release of hard disk resources of the virtual data center through the interface, and second quota information updated by determining data changes in the real-time usage data; a determination module, configured to determine the amount of storage data allowed to be stored in the target hard disk resource based on the quota data, and compare the amount of storage data with the amount of change required corresponding to the resource change; A verification module, configured to verify whether the resource change operation initiated by the current target user is a valid operation based on the comparison result; The verification module is further configured to, if the comparison result shows that the amount of stored data is greater than or equal to the amount of change required, determine that the verification result of the resource change operation initiated by the current target user is a valid operation; if the comparison result shows that the amount of stored data is less than the amount of change required, determine that the verification result of the resource change operation initiated by the current target user is an invalid operation; The determination module is further used to determine a third available remaining amount corresponding to the first quota information in the quota data, and a fourth available remaining amount corresponding to the second quota information in the quota data; identify the relative minimum amount between the third available remaining amount and the fourth available remaining amount to obtain a minimum available remaining amount; and determine the amount of storage data stored in the target hard disk resource allowed to be used based on the minimum available remaining amount.
7. A computer-readable storage medium, characterized in that The computer-readable storage medium stores a computer program, wherein the computer program implements the steps of the method described in any one of claims 1 to 5 when executed by a processor.
8. A computer program product comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 5 are implemented.
Citation Information
Patent Citations
Method and device for regulating cloud computing resources
CN107040479A
Resource quota method and device, equipment and storage medium
CN116775267A