Resource change operation verification method and device, storage medium and computer program product
By monitoring real-time usage data of the virtual data center and employing a dual verification mechanism, the problem of low efficiency in quota verification and auditing of the platform's virtual data center has been solved, achieving real-time, accurate synchronization and efficient updating of resource quota data.
Patent Information
- Application Number
- CN202411112652.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-13
- Publication Date
- 2025-01-10
- Estimated Expiration
- 2044-08-13
AI Technical Summary
In existing technologies, the quota verification and auditing processes of platform virtual data centers are inefficient, and there are problems such as inaccurate timed synchronization, multiple releases or occupations of resources, and difficulty in troubleshooting data inconsistencies.
By monitoring real-time usage data of the virtual data center, calling external interfaces to obtain quota data, comparing the relationship between the amount of stored data and the amount of change requirements, using both formal and temporary tables for dual verification, and utilizing Binlog logs to synchronize resource data in real time, data inconsistency is avoided.
It achieves real-time and accurate synchronization of resource quota data, avoids data inconsistency issues, and improves the processing efficiency of quota verification and auditing.
Smart Images

Figure CN119292759A_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present application relate to the computer field, and specifically, to a verification method and device for a resource change operation, a storage medium, and a computer program product. Background Art
[0002] In computing scenarios, many services, such as creating virtual machines and hard disks, require verification and pre-occupancy of quotas for related resources in the VDC (Virtual Data Center, referred to as VDC). In the past, quota verification and quota data auditing in such scenarios were often completed by calling quota interfaces directly or using a scheduled synchronization mechanism to synchronize VDC quota data regularly. Traditional methods often have the following problems: scheduled synchronization has a time interval, and quota data is inaccurate during the interval. In addition to real-time performance, scheduled synchronization also has the problem of synchronization and operation being executed simultaneously. Often, it is necessary to pre-occupy VDC quotas when creating resources. If the synchronization task is executed after pre-occupancy, the quota will be synchronized back at this time, resulting in inaccurate quota verification. Interface operations often cause a resource to be released or occupied multiple times due to multiple operation scenarios, multiple operation entries, concurrency, unknown program exceptions, and other problems. Once the data is inconsistent, it is often difficult to identify the problematic scenario and operation. In addition, interface pre-occupancy can also have problems, resulting in inconsistencies between resource data and quota data for a period of time after pre-occupancy.
[0003] In view of the problem of low processing efficiency of quota verification and auditing in platform virtual data centers in related technologies, no effective solution has been proposed so far. Summary of the invention
[0004] The embodiments of the present application provide a verification method and device for resource change operations, so as to at least solve the problem of low processing efficiency of quota verification and auditing in platform virtual data centers in the 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; 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 comprises: first quota information recording normal occupation and / or release of hard disk resources of the virtual data center through an 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 to be used 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, a verification is performed on whether the resource change operation initiated by the current target user is a valid operation 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 of change demanded, after determining that the verification result of the resource change operation initiated by the current target user is a valid operation, the above method further 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 update 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, prohibiting the use of the second sub-quota information to update data corresponding to the first sub-quota information.
[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 the 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 according to 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 interface changes to obtain fourth quota information; and if the resource change operation is to increase the quota, comparing the third quota information corresponding to the third quota information with the first quota information corresponding to the third quota information. The first available remaining amount is equal to the sixth available remaining amount corresponding to the fourth quota information; when the comparison result indicates that the first 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.
[0010] 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, recovery of storage resources under the virtual data center, and movement of storage resources under the 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: starting the log function of the virtual data center and setting the row mode corresponding to the log function; after completing the row mode setting, loading a preset monitoring encoding package, and configuring the monitoring type and the 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, used to monitor the real-time usage data when the current target user uses the storage resources of the virtual data center; an acquisition module, used to call an external interface to obtain the 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 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 updated by determining the data change of the real-time usage data; a determination module, used to determine the amount of storage data stored in the target hard disk resources allowed to be used based on the quota data, and compare the size relationship between the storage data amount and the change demand amount corresponding to the resource change; a verification module, used to verify whether the resource change operation initiated by the current target user is a valid operation according to 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, wherein the computer program is configured to execute the steps of any of the above method embodiments when run.
[0014] According to another embodiment of the present application, an electronic device is provided, including a memory and a processor, wherein the memory stores a computer program, 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, and when the computer program is executed by a processor, the steps in any of the above method embodiments are implemented.
[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, the external interface is called to obtain the quota data corresponding to the current virtual data center, wherein the quota data includes: the 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 the second quota information updated by determining the data change 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 amount of change required corresponding to the resource change is compared; according to the comparison result, whether the resource change operation initiated by the current target user is a valid operation is verified, and the above technical solution is adopted, and 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, real-time and accurate synchronization of data can be achieved. This avoids data inconsistency problems caused by various combination operations and concurrency, and ensures accurate and efficient data updates of resource quota data, thereby improving the efficiency of quota verification and auditing in the 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 It is a hardware structure block diagram of a computer terminal according to a resource change operation verification method of an embodiment of the present application;
[0019] Figure 2 is a flow chart of a verification method for a resource change operation according to an embodiment of the present application;
[0020] Figure 3 It is a structural diagram of a business system for quota verification and auditing of hard disk quotas by VDC according to an embodiment of the present application;
[0021] Figure 4 It is a business diagram of quota verification and auditing of hard disk quota by VDC according to an embodiment of the present application;
[0022] Figure 5 It is a schematic diagram of a quota verification process of a VDC and a 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 is a structural block diagram of a verification device for resource change operation according to an embodiment of the present application;
[0025] Figure 8 It is a schematic diagram of the structure 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 specification 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 resource change operation verification method embodiment provided in the embodiment of the present application can be executed in a computer terminal or a similar computing device. Taking running on a computer terminal as an example, Figure 1 1 is a hardware structure block diagram of a computer terminal of a resource change operation verification method according to an embodiment of the present application. Figure 1 As shown, the computer terminal may include one or more ( Figure 1 The computer terminal includes a processor 102 (only one is shown in the figure) (the processor 102 may include but is not limited to a processing device such as a microprocessor MCU or a programmable logic device FPGA) and a memory 104 for storing data, wherein the computer terminal may also include a transmission device 106 and an input / output device 108 for communication functions. It can 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. Figure 1 More or fewer components than shown, or with different Figure 1 Different configurations are 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, to implement the above 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 set relative to the processor 102 process, and these process 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] The transmission device 106 is used to receive or send data via a network. The specific example of the above network may include a wireless network provided by a communication provider of a computer terminal. In one example, the transmission device 106 includes a network adapter (Network Interface Controller, referred to as NIC), which can be connected to other network devices through a base station so as to communicate through the network. In one example, the transmission device 106 can be a radio frequency (RF) module, which is used to communicate through the network wirelessly.
[0031] In addition, in order to better understand the technical solution of the present application, the relevant terms are explained, but they do not limit the present application.
[0032] VDC: Virtual Data Center. A virtual data center is a new type of data center that applies computing concepts to data centers. It uses virtualization technology to abstract and integrate physical resources (such as servers, storage, and networks) to form a shared virtual resource pool and realize dynamic allocation and scheduling of resources. In this way, data centers can achieve automated deployment, reduce operating costs, and improve system efficiency, flexibility, and the availability and scalability of application software.
[0033] Binlog: Binary log file in MySQL.
[0034] In this embodiment, a verification method for resource change operation is provided, including but not limited to application 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 the real-time usage data of the current target user when using the 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, 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 of the real-time usage data;
[0037] Step S206: determining the amount of storage data that is 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;
[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, the external interface is called to obtain the quota data corresponding to the current virtual data center, wherein the quota data includes: the 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 the second quota information updated by determining the data change 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 relationship between the storage data volume and the change demand volume corresponding to the resource change is compared; according to the comparison result, whether the resource change operation initiated by the current target user is a valid operation is verified, and the above technical solution is adopted to use the first quota information and the second quota information 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 real-time and accurate synchronization of data can be achieved. This avoids data inconsistency problems caused by various combination operations and concurrency, and ensures accurate and efficient data updates of resource quota data, thereby improving the efficiency of quota verification and auditing in the 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, the size relationship between the storage data volume and the unchanged demand 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 of change demanded, after determining that the verification result of the resource change operation initiated by the current target user is a valid operation, the above method further 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 update 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, prohibiting the use of the second sub-quota information to update data corresponding to the first sub-quota information.
[0043] In summary, through the above implementation, after determining the verification result, the first sub-quota information and the second sub-quota information corresponding to the virtual data center are compared. Since the first sub-quota information uses the interface direct operation method, it often encounters the scenario where the VDC quota data and the resource data in the VDC are inconsistent, so it is necessary to rely on the second sub-quota information to audit the data of the synchronization temporary table to ensure the accuracy of the final quota data of 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 the 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, through the above implementation, the first quota information of the quota is combined with the interface operation quota, and the second quota information is not operated. The verification adopts 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) to combine the verification, and the minimum remaining amount between the two is verified. Improve the verification efficiency for quotas.
[0046] In an exemplary embodiment, after verifying whether the resource change operation initiated by the current target user is a valid operation according to 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 interface changes to obtain fourth quota information; and if the resource change operation is to increase the quota, comparing the third quota information corresponding to the third quota information with the first quota information corresponding to the third quota information. The first available remaining amount is equal to the sixth available remaining amount corresponding to the fourth quota information; when the comparison result indicates that the first 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.
[0047] In summary, through the above implementation method, the log information is updated, and the corresponding update information 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 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, recovery of storage resources under the virtual data center, and movement of storage resources under the 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: starting the log function of the virtual data center and setting the row mode corresponding to the log function; after completing the row mode setting, loading a preset monitoring encoding package, and configuring the monitoring type and the 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, so that the specific values before and after the resource change and the difference after the change can be clearly perceived, providing data support for subsequent quota verification.
[0051] Obviously, the above-described embodiments are only a 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 combination with the embodiments, but the technical solutions of the embodiments of the present invention are not limited thereto. Specifically:
[0052] In an exemplary embodiment, a quota verification and auditing method for a platform virtual data center based on Binlog logs is proposed. This method uses the core resource table data changes in the monitoring VDC tenant to be reported to the VDC for summary in real time. At the same time, the quota verification adopts the method of joint verification of temporary tables and formal tables. This method solves the problems of data real-time and concurrency caused by the timed synchronization method. Because the formal table data is directly synchronized by the monitoring resource table database, it is irrelevant to business operations, thus avoiding data inconsistency scenarios caused by multiple business entries, abnormalities not rolled back, etc.
[0053] As an optional implementation, taking VDC hard disk quota as an example, the VDC quota table is designed with two tables, a temporary table and a formal table. The fields of the two tables are exactly the same. However, the data sources are inconsistent. The temporary table is used for normal hard disk business verification, and the quota is normally occupied and released through the interface. The formal table monitors the changes in the hard disk table data through the Binlog log and directly updates the quota data. The data is based on the formal table. When the temporary table data is inconsistent with the formal table data, the formal table data is used as the benchmark and synchronized to the temporary table.
[0054] Optionally, the business system for quota verification and auditing of the above VDC on hard disk quota is implemented as follows: Figure 3 As shown, Figure 3 It is a structural diagram of a business system for quota verification and auditing of hard disk quotas by VDC according to an embodiment of the present application; it includes:
[0055] VDC data verification module 32: responsible for providing an interface for external use, which is used by the business side for quota verification, occupation, and quota release. The interface operates the quota temporary table, not the formal table. The verification adopts the combination of the formal table and the temporary table, and the minimum remaining amount verification between the two.
[0056] Binlog log monitoring and parsing module 34: responsible for monitoring the changes in the core resource data in the VDC, and updating the formal table when monitoring the creation, modification, deletion and other operations. The formal table data is always consistent with the resources in the VDC.
[0057] Formal table and temporary table audit module 36: For temporary tables, due to the direct interface operation method, there will often be scenarios where the VDC quota data and the resource data in the VDC are inconsistent, so it is necessary to rely on formal tables to audit and synchronize the data of temporary tables. At the same time, the formal table data will also be synchronized and compared once every period of time, that is, the bottom-up mechanism.
[0058] Optional, Figure 4 Schematic diagram of data exchange of a business system according to an embodiment of the present application, which specifically includes the following steps:
[0059] Step a: The target object sends a request to the business system.
[0060] Step b: The business system initiates quota verification and verifies the quota through relevant interfaces. 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 verified.
[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 through the updated formal table to achieve accurate and consistent quota data.
[0067] Optional, Figure 5 : is a schematic diagram of a quota verification process of a VDC and a 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 creation, modification, deletion, management, allocation, recycling, and migration. This includes all operations that cause resource changes within the VDC, including but not limited to these.
[0069] Step 2) Call the VDC quota interface to check whether the remaining quota meets the change requirements. Query the quota remaining data of the temporary table and the formal table of the resource, and select the minimum value. Compare 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 in the formal table is smaller than the temporary table. If the result is true, update the temporary table with the quota data in the formal table.
[0072] Optional, Figure 6 : is a schematic diagram of a 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 resources 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 in quota. If it is an increase in quota, and the quota data of the formal table is inconsistent with the quota data of the temporary table after the increase, update the quota of the temporary table.
[0077] Step 505: The scheduled task performs full query synchronization every few minutes.
[0078] It should be noted that the above Binlog is a binary log, a binary log file, also called an update log, which is a relatively important log in MySQL and is closely related to operation and maintenance. It records all statements that update the database (such as DDL and DML statements) and saves them in a binary form on the disk, but does not include statements that do not modify any data (such as data query statements select, show, etc.).
[0079] Binlog has three formats: statement, row, and mixed. The row mode records the details of each data modification. Even if only one field is updated, the Binlog will record the data of all fields. The advantage of this mode is that it does not record the context information of the SQL statement, and the log content will clearly record the detailed change details of each data. Using this mode, you can clearly perceive the specific values before and after the resource change and the difference after the change.
[0080] In addition, the quota verification and auditing method for the platform virtual data center mentioned above requires the following prerequisites: 1. The data is stored in MySQL, and the MySQL version must be greater than 5.1.5. 2. MySQL needs to be configured with Binlog enabled.
[0081] Optional, the 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]
[0085]
[0086] #Indicates that each write operation will not be 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.
[0087] Optionally, the specific implementation steps of Binlog monitoring and parsing are as follows:
[0088] Step 1: Enable the MySQL Binlog logging function and set the logging mode to row mode.
[0089] Step 2: The log monitoring parsing module depends on the log monitoring jar package. The specific code is as follows: <dependency>
[0090]
[0091] Step 3: Configure application.yml. The specific code is as follows: "#binlog listener
[0092]
[0093] Step 4: Monitor and parse the logs. Determine whether it is the monitored table and the monitoring type. Mainly monitor three categories of events: write event types: PRE_GA_WRITE_ROWS, WRITE_ROWS, EXT_WRITE_ROWS; update event types: PRE_GA_UPDATE_ROWS, UPDATE_ROWS, EXT_UPDATE_ROWS; delete event types: PRE_GA_DELETE_ROWS, DELETE_ROWS, EXT_DELETE_ROWS.
[0094] Step 4: Update the resource formal table after listening to the event in step 4. If it is a write event or an update event, the temporary table data needs to be updated synchronously.
[0095] Through the above implementation, quota verification is performed by double checking the temporary table and the formal table, without pre-occupying the quota. Binlog is used to synchronize VDC resource data to VDC quota in real time to solve the problem of multiple entries. In addition, VDC quota data verification uses double checking of temporary tables and formal tables; temporary table data auditing does not rely on scheduled tasks and has no time intervals. Thus, the optimization and upgrade of VDC quota data verification and data auditing methods in computing scenarios is realized. It should be noted that the above-mentioned virtual data center data verification and synchronization method is not only applicable to computing scenarios, but also to all similar scenarios. For example, in the scenario where secondary units like group companies report data in real time, synchronization and auditing can also use this solution. In this regard, the present application does not make too many restrictions.
[0096] Through the description of the above implementation methods, those skilled in the art can clearly understand that the method according to the above embodiment can be implemented by software plus a necessary general hardware platform, or by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk), and includes a number of instructions for 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.
[0097] In this embodiment, a verification device for resource change operation is also provided, which is used to implement the above-mentioned embodiments and preferred implementation modes, and the descriptions that have been made are not repeated here. As used below, the term "module" can implement a combination of software and / or hardware for a predetermined function. Although the modules described in the following embodiments are preferably implemented in software, the implementation in hardware, or a combination of software and hardware, is also possible and conceivable.
[0098] Figure 7 is a structural block diagram of a verification device for resource change operation according to an embodiment of the present application, such as Figure 7 As shown, the device comprises:
[0099] A monitoring module 62, used to monitor the real-time usage data of the current target user when using the storage resources of the virtual data center;
[0100] The acquisition module 64 is used to call the external interface to acquire the 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 the data change of the real-time usage data;
[0101] A determination module 66, configured to determine the amount of storage data that is allowed to be stored in the target hard disk resource based on the quota data, and compare the relationship between the amount of storage data and the amount of change required corresponding to the resource change;
[0102] The verification module 68 is used to verify whether the resource change operation initiated by the current target user is a valid operation according to the comparison result.
[0103] The above device monitors the real-time usage data of the storage resources of the virtual data center when the current target user uses them; when the real-time usage data indicates that the current target user needs to perform a resource change operation, the external interface is called to obtain the quota data corresponding to the current virtual data center, 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 the data change 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 amount of change required corresponding to the resource change is compared; according to the comparison result, whether the resource change operation initiated by the current target user is a valid operation is verified, and the above technical solution is adopted to use the first quota information and the second quota information 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 real-time and accurate synchronization of data can be achieved. This avoids data inconsistency problems caused by various combination operations and concurrency, and ensures accurate and efficient data updates of resource quota data, thereby improving the efficiency of quota verification and auditing in the platform virtual data center.
[0104] 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 storage data volume is greater than or equal to the change demand volume; 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 storage data volume is less than the change demand volume.
[0105] 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 demand 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.
[0106] 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.
[0107] In an exemplary embodiment, the above-mentioned device also includes: a synchronization module, which is used to verify whether the resource change operation initiated by the current target user is a valid operation according to 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 the 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 the fourth quota information; if the resource change operation is to increase the quota, compare the third quota information with the The first available remaining amount corresponding to the fourth quota information is compared with the sixth available remaining amount corresponding to the fourth quota information; when the comparison result indicates that the first 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.
[0108] 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, recovery of storage resources under the virtual data center, and movement of storage resources under the virtual data center.
[0109] 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 the 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.
[0110] It should be noted that the above modules can be implemented by software or hardware. For the latter, it can be implemented in the following ways, but not limited to this: the above modules are all located in the same processor; or, the above modules are located in different processors in any combination.
[0111] An embodiment of the present application further provides a computer-readable storage medium, in which a computer program is stored, wherein the computer program is configured to execute the steps of any of the above method embodiments when running.
[0112] Optionally, in this embodiment, the computer program may be configured to perform the following steps by means of the computer program:
[0113] S1, monitors the real-time usage data of the current target user when using the storage resources of the virtual data center;
[0114] 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 of the real-time usage data;
[0115] S3, determining the amount of storage data that is 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;
[0116] S4: Verify whether the resource change operation initiated by the current target user is a valid operation based on the comparison result.
[0117] In an exemplary embodiment, the computer-readable storage medium may include but is not limited to: 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, and other media that can store computer programs.
[0118] 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.
[0119] Optionally, in this embodiment, the processor 804 may be configured to perform the following steps through a computer program:
[0120] S1, monitors the real-time usage data of the current target user when using the storage resources of the virtual data center;
[0121] 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 of the real-time usage data;
[0122] S3, determining the amount of storage data that is 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;
[0123] S4, verifying whether the resource change operation initiated by the current target user is a valid operation according to the comparison result. The specific examples in this embodiment can refer to the examples described in the above embodiments and exemplary implementations, and this embodiment will not be repeated here.
[0124] Alternatively, a person skilled in the art may understand 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.) shown in the figure, or with different Figure 8 Different configurations are shown.
[0125] 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, to implement 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 set relative to the processor 804 process, and these process 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 intranet, local area network, mobile communication network and combinations thereof. Among them, the memory 802 can specifically be used for, but is not limited to, storing 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.
[0126] Optionally, the transmission device 806 is used to receive or send data via a network. Specific examples of the network may include a wired network and a wireless network. In one example, the transmission device 806 includes a network adapter (Network Interface Controller, NIC), which can be connected to other network devices and routers via a network cable so as to communicate with the Internet or a local area network. In one example, the transmission device 806 is a radio frequency (RF) module, which is used to communicate with the Internet wirelessly.
[0127] In addition, the electronic device further includes: a display 808; and a connection bus 510, which is used to connect various module components in the electronic device.
[0128] 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.
[0129] An embodiment of the present application further provides another computer program product, including 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 in any of the above method embodiments are implemented.
[0130] The embodiments of the present application also provide 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 in any one of the above method embodiments.
[0131] Obviously, those skilled in the art should understand that the above modules or steps of the present application can be implemented by a general computing device, they can be concentrated on a single computing device, or distributed on a network composed of multiple computing devices, they can be implemented by a program code executable by a computing device, so that 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 executed in a different order than here, or they can be made into individual integrated circuit modules, or multiple modules or steps therein can be made into a single integrated circuit module for implementation. In this way, the present application is not limited to any specific combination of hardware and software.
[0132] The above description is only the preferred embodiment of the present application and is not intended to limit the present application. For those skilled in the art, the present application may have various modifications and variations. Any modification, equivalent substitution, improvement, etc. made within the principles of the present application shall be included in the protection scope of the present application.< / dependency>
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 the 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 that the hard disk resources of the virtual data center are normally occupied and / or released through the interface, and second quota information updated by determining data changes of the real-time usage data; Determine the amount of storage data stored in the target hard disk resource that is allowed to be used based on the quota data, and compare the relationship between the amount of storage data and the amount of change required corresponding to the resource change; Whether the resource change operation initiated by the current target user is a valid operation is verified according to the comparison result.
2. The method according to claim 1, characterized in that 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 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 required for change, it is determined that the verification result of the resource change operation initiated by the current target user is an invalid operation.
3. The method according to claim 1, characterized in that When the comparison result is that the amount of stored data is greater than or equal to the amount of change demanded, 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: Acquire 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; In a case where 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; When 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.
4. The method according to claim 1, characterized in that: Determining the amount of storage data that is allowed to be stored in the target hard disk resource based on the quota data includes: 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 relatively smallest amount between the third available remaining amount and the fourth available remaining amount to obtain the smallest available remaining amount; and determine the amount of storage data that can be stored in the target hard disk resource based on the smallest available remaining amount.
5. 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 according to the comparison result, the method further includes: In the case where 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 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; When 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, 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; 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.
6. The method according to claim 1, characterized in that 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.
7. The method according to claim 1, characterized in that 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 the 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.
8. 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 acquire quota data corresponding to the current virtual data center, wherein the quota data includes: first quota information recording that the hard disk resources of the virtual data center are normally occupied and / or released through the interface, and second quota information updated by determining data changes of the real-time usage data; A determination module, configured to determine the amount of storage data stored in the target hard disk resource that is allowed to be used based on the quota data, and compare the relationship between the amount of storage data and the amount of change required corresponding to the resource change; The verification module is used to verify whether the resource change operation initiated by the current target user is a valid operation according to the comparison result.
9. 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 7 when executed by a processor.
10. 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 described in any one of claims 1 to 7 are implemented.
Citation Information
Patent Citations
Method and device for regulating cloud computing resources
CN107040479A
Quota application method and system
CN107506242A
Cloud rendering resource scheduling method and device, electronic equipment and storage medium
CN111061560A
Resource quota management method and device, computer equipment and storage medium
CN115118612A
Resource quota method and device, equipment and storage medium
CN116775267A