Storage capacity verification method, device and computer equipment
By deploying container groups on the main node of the K8s cluster, obtaining storage operation requests and limiting storage capacity, and determining the verification results of storage capacity, the problem of high storage capacity verification cost at the K8s cluster level is solved, and efficient and accurate verification results are achieved.
Patent Information
- Application Number
- CN202410345716.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-03-25
- Publication Date
- 2025-03-14
- Estimated Expiration
- 2044-03-25
AI Technical Summary
In the prior art, when checking the storage capacity at the K8s cluster level, there is a problem of high verification cost.
A storage capacity verification method is provided. By deploying a container group on the main node in the cluster, obtaining the storage operation requests of the resources to be run and the storage capacity limit of the cluster, determining the verification result of the storage capacity, and reducing the verification cost.
This method can effectively reduce the cost of storage capacity verification at the K8s cluster level, improve verification efficiency and accuracy, and reduce the amount and complexity of processing data.
Smart Images

Figure CN118332588B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a storage capacity verification method, device and computer equipment. Background Art
[0002] With the development of cloud-native technologies, Kubernetes (K8s) clusters are widely used in various fields to achieve high availability of applications.
[0003] In actual applications, different resources can be deployed in a K8s cluster, such as containers, Pods, and namespaces, and the data generated when different resources are running will be stored in the storage system of the K8s cluster to ensure that data is never lost. Usually, in order to ensure that each resource can run normally on the K8s cluster, the storage capacity of the storage system of the K8s cluster needs to be verified before each resource runs.
[0004] However, in the related art, verifying the storage capacity corresponding to the K8s cluster will have the problem of high verification cost. Summary of the invention
[0005] Based on this, it is necessary to provide a storage capacity verification method, device and computer equipment to address the above technical problems, which can reduce the verification cost required for verifying the storage capacity corresponding to the K8s cluster.
[0006] In a first aspect, an embodiment of the present application provides a storage capacity verification method, which is applied to a container group deployed on a master node in a cluster, and the method includes:
[0007] Obtain each storage operation request corresponding to at least one resource to be run, and obtain the limited storage capacity of the storage system corresponding to the cluster at the current moment;
[0008] According to each storage operation request and the limited storage capacity, the verification result of the storage capacity of the storage system at the current moment when running each resource is determined.
[0009] In one embodiment, determining the verification result of the storage capacity of the storage system at the current moment when running each resource according to each storage operation request and the limited storage capacity includes:
[0010] Determine, according to each storage operation request, the request type of each storage operation request and the required storage capacity of the cluster when running each resource;
[0011] Based on the request type, required storage capacity and limited storage capacity of each storage operation request, a verification result of the storage capacity at the current moment is determined.
[0012] In one embodiment, based on the request type, required storage capacity and limited storage capacity of each storage operation request, determining the verification result of the storage capacity at the current moment includes:
[0013] Obtain the used storage capacity of the storage system at the current moment;
[0014] Determine a target storage capacity of the storage system according to a request type, a used storage capacity, and a required storage capacity of each storage operation request;
[0015] The storage capacity is verified according to the target storage capacity and the limited storage capacity to obtain a verification result of the storage capacity at the current moment.
[0016] In one embodiment, obtaining the used storage capacity of the storage system at the current moment includes:
[0017] Get the used information of the storage system at the current moment;
[0018] The used information is decrypted to obtain the used storage capacity of the storage system at the current moment.
[0019] In one embodiment, determining a target storage capacity of a storage system according to a request type, a used storage capacity, and a required storage capacity of each storage operation request includes:
[0020] For any resource, if the request type of the storage operation request is to increase the storage volume, the used storage capacity and the required storage capacity are added to obtain the target storage capacity;
[0021] If the request type of the storage operation request is to delete a storage volume, the used storage capacity is subtracted from the required storage capacity to obtain the target storage capacity.
[0022] In one embodiment, the storage capacity is verified according to the target storage capacity and the limited storage capacity to obtain a verification result of the storage capacity at the current moment, including:
[0023] If the target storage capacity does not exceed the limited storage capacity, then determining that the storage capacity has passed the verification at the current moment;
[0024] If the target storage capacity exceeds the limited storage capacity, it is determined that the storage capacity verification has failed at the current moment.
[0025] In one embodiment, the method further comprises:
[0026] When the storage capacity verification passes, the target storage capacity is encrypted to obtain the encrypted target storage capacity, and the encrypted target storage capacity is used as new used information.
[0027] In one embodiment, the method further comprises:
[0028] When the storage capacity verification passes, the capacity verification flag of the storage capacity is updated to a verified flag.
[0029] In one embodiment, obtaining each storage operation request corresponding to at least one resource to be executed at a current moment includes:
[0030] Get each operation request sent by the user at the current moment;
[0031] At least one storage operation request is acquired according to the operation request of the storage operation in each operation request.
[0032] In one embodiment, obtaining the limited storage capacity of the storage system corresponding to the cluster at the current moment includes:
[0033] Get the current limit information of the storage system corresponding to the cluster;
[0034] The restriction information is decrypted to obtain the restricted storage capacity of the storage system at the current moment.
[0035] In a second aspect, an embodiment of the present application provides a storage capacity verification device, the device comprising:
[0036] A request acquisition module, used to acquire each storage operation request corresponding to at least one resource to be run, and to acquire the limited storage capacity of the storage system corresponding to the cluster at the current moment;
[0037] The verification result determination module is used to determine the verification result of the storage capacity of the storage system at the current moment when running each resource according to each storage operation request and the limited storage capacity.
[0038] In a third aspect, an embodiment of the present application further provides a computer device, comprising a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of the method of any one of the embodiments of the first aspect when executing the computer program.
[0039] In a fourth aspect, an embodiment of the present application further provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the steps of the method of any embodiment in the above-mentioned first aspect are implemented.
[0040] In a fifth aspect, an embodiment of the present application further provides a computer program product, the computer program product comprising a computer program, which, when executed by a processor, implements the steps of the method of any embodiment of the first aspect above.
[0041] The above description is only an overview of the technical solution of the present application. In order to more clearly understand the technical means of the present application, it can be implemented in accordance with the contents of the specification. In order to make the above and other purposes, features and advantages of the present application more obvious and easy to understand, the specific implementation methods of the present application are listed below. BRIEF DESCRIPTION OF THE DRAWINGS
[0042] Figure 1 A schematic diagram of a storage capacity verification method according to an embodiment of the present invention;
[0043] Figure 2 is a flow chart of a storage capacity verification method in another embodiment;
[0044] Figure 3 is a flow chart of a storage capacity verification method in another embodiment;
[0045] Figure 4 is a flow chart of a storage capacity verification method in another embodiment;
[0046] Figure 5 is a flow chart of a storage capacity verification method in another embodiment;
[0047] Figure 6 is a flow chart of a storage capacity verification method in another embodiment;
[0048] Figure 7 is a structural block diagram of a storage capacity verification device in one embodiment;
[0049] Figure 8 FIG. 4 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION
[0050] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0051] In cloud native technology, K8s clusters are widely used in various fields, mainly deploying applications on multiple nodes in K8s clusters to achieve high availability of applications. In practical applications, different resources can be deployed in K8s clusters, such as containers, Pods, and namespaces, and the data generated when different resources are running will be stored in the storage system of the K8s cluster to achieve the purpose of permanent data loss. Usually, in order to ensure that each resource can run normally on the K8s cluster, it is necessary to verify the storage capacity of the storage system of the K8s cluster before each resource runs. In the related art, the storage capacity of different resources to be run on the K8s cluster is mainly verified and controlled separately from the fine-grained level, and then the verification control of the storage capacity at the K8s cluster level is realized through a series of processing based on the verification control results of each resource. However, in the related art, the storage capacity corresponding to the K8s cluster level is verified, and there is a problem of high verification cost. Based on this, the embodiment of the present application provides a storage capacity verification method that can reduce the verification cost of the storage capacity corresponding to the K8s cluster level.
[0052] The storage capacity verification method provided in the embodiment of the present application can be applied to a K8s cluster, which includes a scheduling system, a control node and a working node, and the control node includes a master node and a slave node. Optionally, the scheduling system, the master node and the slave node can all be computer devices, and can also be servers. The embodiment of the present application does not limit the specific form of the scheduling system, the master node and the slave node. Optionally, the above-mentioned computer device can be an electronic device such as a personal computer, a tablet computer, a smart phone, etc.
[0053] In practical applications, the above storage capacity verification method can implement the verification process by running the deployed container group. Optionally, the container group can be deployed on a corresponding node outside the cluster, and when the container group is deployed outside the cluster, the cluster certificate can be obtained through the cluster configuration file before each container group is run to authorize the storage capacity verification access request, thereby executing the above storage capacity verification method.
[0054] The following embodiment of the present application introduces the specific process of the storage capacity verification method by applying the storage capacity verification method to the container group (Pod) deployed on the master node in the cluster as the execution subject. Among them, the above container group can be deployed using a controller deployment or daemonset, which is not limited in the embodiment of the present application. In the embodiment of the present application, the storage capacity verification program can be deployed in the container group through the extended function of the K8s validating admission controller (validating admission webhook) to execute the above storage capacity verification method.
[0055] like Figure 1As shown, it is a flow chart of the storage capacity verification method provided in an embodiment of the present application. The method is applied to a container group deployed on a master node in a cluster. The method can be implemented by the following steps:
[0056] S100: Acquire each storage operation request corresponding to at least one resource to be run, and acquire the limited storage capacity of the storage system corresponding to the cluster at the current moment.
[0057] The cluster may be a container cluster, which may be a Swarm cluster, a Mesos cluster, etc. However, in the embodiment of the present application, the cluster is described as a K8s cluster. In the embodiment of the present application, the resources that can be run on the cluster may include containers, Pods, and / or namespaces, etc.
[0058] It should be noted here that at least one container can be deployed on each node in the cluster, and one application (such as chat, drawing, database, management system, etc.) can be deployed in each container. The applications deployed in multiple containers deployed on multiple nodes can be the same. In addition, multiple containers on the same node can be encapsulated into the same Pod, and the types of applications deployed in multiple containers in the same Pod can be the same, and different containers in the same Pod can share the Pod's network, memory, central processing unit (CPU) and other computing resources; the number of Pods on each node can be greater than or equal to 0. At the same time, multiple Pods can be defined as a namespace.
[0059] In actual applications, a user terminal outside the cluster can directly send to the master node of the cluster various storage operation requests corresponding to at least one resource to be run on at least one working node of the cluster. Correspondingly, after the container group deployed on the master node in the cluster is running, it can directly receive various storage operation requests. Optionally, the storage operation request corresponding to the resource can be understood as a request for the relevant storage operation that needs to be performed when running the resource on the corresponding node in the cluster.
[0060] In addition, the user can directly input various storage operation requests corresponding to at least one resource to be run on at least one working node of the cluster to the master node in the cluster through voice, gestures, buttons, keyboards, etc.
[0061] At the same time, after the container group deployed on the master node in the cluster is running, it can obtain the limited storage capacity of the storage system corresponding to the cluster at the current moment from local, cloud, disk, hard disk and other storage locations.
[0062] It should be noted here that the cluster requires the required storage capacity when running various resources. In actual applications, the storage system can provide storage functions for the cluster and can also provide storage functions for the cluster and other processing clusters at the same time.
[0063] In an embodiment of the present application, the limited storage capacity of the storage system corresponding to the cluster can be pre-set to ensure the reasonable use of the storage capacity of the storage system, so as to avoid the cluster from using the storage capacity of the storage system without restriction and avoid the cluster crash when the cluster runs various resources.
[0064] Optionally, the above-mentioned limited storage capacity can be understood as the maximum storage capacity that the storage system can provide for the cluster. In the embodiment of the present application, since the storage capacity used by different clusters is constantly changing, the limited storage capacity provided by the storage system to the cluster may be equal or unequal at different times.
[0065] In practical applications, in order to improve the accuracy of storage capacity verification results, the limited storage capacity of the storage system corresponding to the cluster at the current moment can be obtained to provide basic information for further verification of storage capacity at the cluster level.
[0066] S200: Determine the verification result of the storage capacity of the storage system at the current moment when running each resource according to each storage operation request and the limited storage capacity.
[0067] Optionally, the above verification result may be that the storage capacity verification of the storage system passes when the cluster runs each resource, or may be that the storage capacity verification of the storage system fails when the cluster runs each resource. In actual applications, only when the storage capacity verification of the storage system passes when the cluster runs each resource can subsequent processing be performed on each storage operation request to allow the cluster to respond to each storage operation request.
[0068] Specifically, after the container group deployed on the master node in the cluster is running, an algorithm model can be pre-trained, and then the information carried in each storage operation request and the storage system's limited storage capacity at the current moment are input into the algorithm model, and the algorithm model outputs the verification result of the storage capacity of the storage system at the current moment when running each resource. Optionally, the information carried in the above storage operation request may include the required storage capacity for running the corresponding resource, the storage operation type, the visitor information, the visitor role, the visitor authority, the storage operation type, the requested resource type, and the storage configuration information.
[0069] In addition, after the container group deployed on the master node in the cluster is running, the information carried in each storage operation request and the limited storage capacity can be found in the mapping relationship, and the verification results corresponding to the information carried in each storage operation request and the limited storage capacity found in the mapping relationship can be determined as the verification results of the storage capacity of the storage system at the current moment when running each resource.
[0070] Optionally, the above mapping relationship may include the relationship between information carried in different storage operation requests, different restricted storage capacities, and different verification results.
[0071] It should be noted here that the steps in S100 - S200 above may be executed periodically to ensure the success rate of the cluster running different resources at different times.
[0072] In actual applications, before executing the steps in S200 above, each storage operation request can be analyzed and processed to obtain the information carried in each storage operation request, and then the visitor role and visitor authority in the carried information can be verified and authorized. After the visitor role and visitor authority are verified and authorized, the storage configuration information is modified according to actual needs, and then the information format of the modified storage configuration information is verified. After the information format verification is passed, the steps in S200 above are executed.
[0073] Furthermore, if the storage capacity verification passes, each storage operation request can be stored in the distributed key value (Extended Distributed Key Value, ETCD) database in the cluster to instruct the cluster to respond to each storage operation request to run the corresponding resources. This can ensure that the storage system can increase the required storage capacity when the cluster runs the corresponding resources, prevent the storage capacity of the storage system from being exhausted, and further improve the performance of the cluster and the reliability of the cluster when running various resources.
[0074] The technical solution in the embodiment of the present application is applied to a container group deployed on a master node in a cluster, and each storage operation request corresponding to at least one resource to be run is obtained, and the limited storage capacity of the storage system corresponding to the cluster at the current moment is obtained, and the verification result of the storage capacity of the storage system at the current moment when running each resource is determined according to each storage operation request and the limited storage capacity; the above method does not need to perform storage capacity verification from fine-grained resources, which can not only save the human resource cost required for the verification process, but also can directly verify the storage capacity of the storage system corresponding to the cluster when the cluster runs each resource from the cluster level through the limited storage capacity of the storage system corresponding to the cluster at the current moment, thereby reducing the amount of data processed in the storage capacity verification process at the cluster level, further reducing the complexity of the storage capacity verification process at the cluster level, speeding up the verification speed, and improving the verification efficiency; at the same time, the above method can be executed by the master node inside the cluster, and does not require the verification device outside the cluster to perform auxiliary verification, that is, verification without external dependence, thereby saving verification costs, improving the wide applicability of the storage capacity verification method at the cluster level, and also does not require the cluster to send each received storage operation request to the verification device outside the cluster, which can avoid information transmission errors, thereby improving the accuracy of the storage capacity verification result at the cluster level.
[0075] The following is an explanation of the process of determining the verification result of the storage capacity of the storage system at the current moment when running each resource according to each storage operation request and the limited storage capacity. Figure 2 As shown, the steps in S200 above can be implemented in the following manner:
[0076] S210: Determine, according to each storage operation request, a request type of each storage operation request and a required storage capacity of the cluster when running each resource.
[0077] Specifically, after the container group deployed on the master node in the cluster is running, each storage operation request can be analyzed and processed to obtain the request type of each storage operation request and the required storage capacity of the cluster when running each resource.
[0078] In addition, after the container group deployed on the master node in the cluster is running, it can also extract the information carried in each storage operation request, obtain the required storage capacity of the cluster when running each resource, and each storage operation type, and determine the request type of each storage operation request based on each storage operation type.
[0079] Among them, if the storage operation type is to create a new storage volume or modify a storage volume, the request type of the corresponding storage operation request can be to add a storage volume; if the storage operation type is to delete a storage volume, the request type of the corresponding storage operation request can be to delete a storage volume.
[0080] It should be noted here that the above storage volume can also be a persistent volume (PersistentVolume, PV) corresponding to the cluster.
[0081] S220: Determine a verification result of the storage capacity at the current moment based on the request type, required storage capacity, and limited storage capacity of each storage operation request.
[0082] In actual applications, after the container group deployed on the master node in the cluster is running, a verification model can be pre-trained, and then the request type, required storage capacity and limited storage capacity of each storage operation request are input into the verification model, and the verification model outputs the verification result of the storage capacity at the current moment.
[0083] Optionally, the verification model can be a combination of at least one of a convolutional neural network model, a recurrent neural network model, a long short-term memory neural network model, and a fully connected neural network model.
[0084] The technical solution in the embodiment of the present application determines the request type of each storage operation request and the required storage capacity of the cluster when running each resource according to each storage operation request, and determines the verification result of the storage capacity at the current moment based on the request type of each storage operation request, the required storage capacity and the limited storage capacity; the above method verifies the storage capacity of the storage system corresponding to the cluster when the cluster runs each resource directly from the cluster level through the limited storage capacity of the storage system corresponding to the cluster at the current moment, thereby reducing the amount of data processed in the storage capacity verification process at the cluster level, further reducing the complexity of the storage capacity verification process at the cluster level, speeding up the verification speed, and improving the verification efficiency; at the same time, the above method does not require the participation of complex algorithms, which can reduce the amount of data processed in the verification process, thereby greatly speeding up the verification speed and improving the verification efficiency; further, the above method can also verify the storage capacity at the cluster level when the cluster runs each resource through the limited storage capacity of the storage system of the cluster, ensuring that the cluster can run each resource normally, avoiding the problem of cluster crash during the cluster running each resource, thereby improving the performance of the cluster and the reliability of the cluster running each resource.
[0085] In one embodiment, if Figure 3 As shown, the step of determining the verification result of the storage capacity at the current moment based on the request type, required storage capacity and limited storage capacity of each storage operation request in S220 above can be implemented in the following manner:
[0086] S221. Obtain the used storage capacity of the storage system at the current moment.
[0087] In actual applications, the storage system is constantly providing storage functions to the outside world. Therefore, the used storage capacity of the storage system is also constantly changing. In order to improve the accuracy of the verification results, the used storage capacity of the storage system at the current moment can be obtained to provide accurate basic information for subsequent processing.
[0088] S222: Determine the target storage capacity of the storage system according to the request type, used storage capacity, and required storage capacity of each storage operation request.
[0089] Specifically, the corresponding arithmetic processing method can be determined according to the request type of each storage operation request, and then the used storage capacity and the required storage capacity are processed with corresponding arithmetic operations according to the arithmetic processing method to obtain the target storage capacity of the storage system.
[0090] Optionally, the arithmetic operation may be at least one of addition, subtraction, multiplication, logarithm and division.
[0091] In one embodiment, the steps in S222 above may include: for any resource, if the request type of the storage operation request is to add a storage volume, then the used storage capacity and the required storage capacity are added to obtain the target storage capacity; if the request type of the storage operation request is to delete a storage volume, then the used storage capacity and the required storage capacity are subtracted to obtain the target storage capacity.
[0092] The technical solution in the embodiment of the present application can obtain the target storage capacity of the storage system corresponding to the cluster to provide basic information for the subsequent storage capacity verification of the cluster. The processing process is relatively simple and does not require the participation of complex algorithms, thereby reducing the amount of data processed in the target storage capacity acquisition process and further improving the efficiency of acquiring the target storage capacity.
[0093] S223. Verify the storage capacity according to the target storage capacity and the limited storage capacity to obtain a verification result of the storage capacity at the current moment.
[0094] Among them, a verification algorithm can be used to verify the storage capacity according to the target storage capacity and the limited storage capacity to obtain the verification result of the storage capacity at the current moment. Optionally, the verification algorithm can be a parity check method, a cyclic redundancy check method, an XOR check method, etc.
[0095] In one embodiment, the steps in S223 above may include: if the target storage capacity does not exceed the limited storage capacity, determining that the storage capacity has passed the verification at the current moment; if the target storage capacity exceeds the limited storage capacity, determining that the storage capacity has not passed the verification at the current moment.
[0096] This embodiment can determine the verification result of the storage capacity corresponding to the cluster at the current moment by the relationship between the target storage capacity of the storage system corresponding to the cluster and the limited storage capacity of the storage system at the current moment. The processing process is relatively simple and does not require the participation of complex algorithms, thereby reducing the amount of data for cluster-level storage capacity verification and further improving the efficiency of cluster-level storage capacity verification.
[0097] The technical solution in the embodiment of the present application obtains the used storage capacity of the storage system at the current moment, determines the target storage capacity of the storage system according to the request type, used storage capacity and required storage capacity of each storage operation request, and verifies the storage capacity according to the target storage capacity and the limited storage capacity to obtain the verification result of the storage capacity at the current moment; the above method does not require the participation of complex algorithms, and can reduce the amount of data processed in the verification process, thereby greatly speeding up the verification speed and improving the verification efficiency; at the same time, the above method does not require human participation, and can reduce human participation errors, thereby improving the accuracy of the verification.
[0098] In some scenarios, in order to prevent the pre-stored used storage capacity from being modified at will, the used storage capacity can be encrypted before being stored, so as to obtain the accurate used storage capacity during the verification process. Based on this, the obtained used storage capacity is the result obtained after the decryption process. The process of obtaining the used storage capacity is described below. In one embodiment, Figure 4 As shown, the step of obtaining the used storage capacity of the storage system at the current moment in the above S221 can be implemented in the following manner:
[0099] S2211. Obtain the usage information of the storage system at the current moment.
[0100] Specifically, after the container group deployed on the master node in the cluster is running, the pre-stored storage system usage information at the current moment can be obtained from the storage classes corresponding to the cluster. Optionally, the usage information can be encrypted used storage capacity, encrypted used storage capacity, encrypted used storage location, and other information.
[0101] S2212. Decrypt the used information to obtain the used storage capacity of the storage system at the current moment.
[0102] Among them, a decryption algorithm can be used to decrypt the used information to obtain the used storage capacity of the storage system at the current moment.
[0103] Optionally, the above-mentioned decryption algorithm corresponds to the encryption algorithm of the used storage capacity, and can be a symmetric decryption algorithm or an asymmetric decryption algorithm, which is not limited in the embodiments of the present application.
[0104] The technical solution in the embodiment of the present application obtains the used information of the storage system at the current moment, and decrypts the used information to obtain the used storage capacity of the storage system at the current moment; the above method does not directly obtain the used storage capacity of the storage system at the current moment, but obtains the used storage capacity of the storage system at the current moment by decrypting the used information. Since the used information is the encrypted used storage capacity, the problem of the used storage capacity being modified during the storage process is avoided, the security of the used storage capacity is guaranteed, and the used storage capacity obtained after decryption is more accurate.
[0105] In some scenarios, the used storage capacity of the storage system changes dynamically. Naturally, the used storage capacity of the storage system before and after the cluster runs each resource is different. Based on this, the used storage capacity of the corresponding storage system can be updated after each cluster runs each resource to prepare for the next accurate verification of the storage capacity at the cluster level. In one embodiment, after the step in S200 is executed, the method may further include: if the storage capacity verification passes, encrypting the target storage capacity to obtain the encrypted target storage capacity, and using the encrypted target storage capacity as the new used information.
[0106] In an embodiment of the present application, when the storage capacity verification at the cluster level is passed, an encryption algorithm can be used to encrypt the target storage capacity to obtain the encrypted target storage capacity, and the encrypted target storage capacity can be stored as new used information in the storage class corresponding to the cluster, that is, the old used information is overwritten by the new used information.
[0107] The target storage capacity can be understood as the used storage capacity of the corresponding storage system after the cluster runs various resources. Optionally, the encryption algorithm can be a symmetric encryption algorithm or an asymmetric encryption algorithm, which is not limited in the embodiments of the present application.
[0108] It should be noted here that the purpose of encrypting the target storage capacity is to obtain the accurate used storage capacity of the storage system when verifying the storage capacity at the cluster level next time.
[0109] In order to prevent abnormal updates of used information due to network jitter, cluster failure, etc., a periodic scanning and update mechanism can be scheduled to ensure that the used information currently stored in the storage class is the latest used information.
[0110] In addition, if the storage capacity check at the cluster level fails, the cluster's master node can return error-related information to the user end to remind the user that the cluster cannot respond to various storage operation requests, and at the same time, refuse to update the stored capacity and capacity check flag.
[0111] The technical solution in the embodiment of the present application, when the storage capacity verification passes, encrypts the target storage capacity to obtain the encrypted target storage capacity, and uses the encrypted target storage capacity as the new used information; the above method can update the used storage capacity of the storage system corresponding to the cluster, and encrypts and stores the new used storage capacity, that is, the target storage capacity, which can provide accurate reference information for subsequent cluster-level storage capacity verification.
[0112] In some scenarios, in order to avoid distinguishing whether the storage capacity at the cluster level has been verified and to avoid performing repeated verification processes, the verification process of the storage capacity can be identified. Based on this, the process of identifying the verification process of the storage capacity is described below. In one embodiment, after the step in S200 is executed, the method may further include: if the storage capacity verification passes, updating the capacity verification mark of the storage capacity to a verified mark.
[0113] In actual application, when the storage capacity verification at the cluster level passes, the capacity verification flag of the storage capacity at the cluster level can be updated to a verified flag. In the embodiment of the present application, the capacity verification flag can be understood as the version information of the storage capacity verification process.
[0114] Among them, the method of updating the capacity verification flag of the storage capacity at the cluster level to the verified flag may be to add 1 to the capacity verification flag in the last verification cycle. In this case, the capacity verification flag may be represented by a number.
[0115] In addition, the capacity verification flag of the storage capacity at the cluster level may be updated to a verified flag by changing the capacity verification flag in the current verification cycle from N to Y. N represents the unverified flag of the storage capacity, and Y represents the verified flag of the storage capacity.
[0116] At the same time, in order to prevent abnormal capacity verification mark updates caused by network jitter, cluster failure, etc., a periodic scanning and update mechanism can be scheduled to ensure that the capacity verification mark currently stored in the storage class is the latest capacity verification mark.
[0117] The technical solution in the embodiment of the present application is to update the capacity verification flag of the storage capacity to a verified flag when the storage capacity verification passes; the above method can mark the verification process of the storage capacity to distinguish whether the verification process has been successfully executed in each verification cycle, so as to avoid re-executing the verification process in the same verification cycle.
[0118] In one embodiment, if Figure 5As shown, the step of obtaining each storage operation request corresponding to at least one resource to be run at the current moment in the above S100 may include:
[0119] S110: Acquire each operation request sent by the user terminal at the current moment.
[0120] Specifically, the master node in the cluster may receive each operation request sent by the user terminal at the current moment. Optionally, multiple operation requests may be sent by the same user terminal or multiple user terminals, which is not limited in the embodiment of the present application.
[0121] S120. Obtain at least one storage operation request according to the operation request for the storage operation in each operation request.
[0122] Among them, after the container group deployed on the master node in the cluster is running, it can analyze all received operation requests, intercept operation requests for storage operations from each operation request, and determine the intercepted operation requests for storage operations as at least one storage operation request.
[0123] The technical solution in the embodiment of the present application obtains each operation request sent by the user terminal at the current moment, and obtains at least one storage operation request based on the operation request of the storage operation in each operation request; the above method can filter out the storage operation request from all the received operation requests, so that only the storage operation request is processed during the storage capacity verification process, avoiding the processing of requests related to non-storage operations, thereby reducing the amount of data processed during the verification process and improving the verification speed. At the same time, it can also reduce the complexity of the verification process and further improve the accuracy of the verification result.
[0124] In one embodiment, Figure 6 As shown, the step of obtaining the limited storage capacity of the storage system corresponding to the cluster at the current moment in the above S100 can be implemented in the following way:
[0125] S130: Obtain restriction information of the storage system corresponding to the cluster at the current moment.
[0126] Specifically, after the container group deployed on the master node in the cluster is running, the pre-stored storage system restriction information at the current moment can be obtained from the storage class corresponding to the cluster. Optionally, the restriction information can be encrypted restricted storage capacity, encrypted restricted storage capacity, encrypted restricted storage location, and other information.
[0127] S140: Decrypt the restriction information to obtain the restricted storage capacity of the storage system at the current moment.
[0128] The restriction information may be decrypted by using a decryption algorithm to obtain the restricted storage capacity of the storage system at the current moment.
[0129] Optionally, the above-mentioned decryption algorithm corresponds to an encryption algorithm that limits storage capacity, and can be a symmetric decryption algorithm or an asymmetric decryption algorithm, which is not limited in the embodiments of the present application.
[0130] The technical solution in the embodiment of the present application obtains the restriction information of the storage system corresponding to the cluster at the current moment, and decrypts the restriction information to obtain the restricted storage capacity of the storage system at the current moment; the above method does not directly obtain the restricted storage capacity of the storage system at the current moment, but obtains the restricted storage capacity of the storage system at the current moment by decrypting the restriction information. Since the restriction information is the encrypted restricted storage capacity, the problem of the restricted storage capacity being modified during the storage process is avoided, the security of the restricted storage capacity is guaranteed, and the restricted storage capacity obtained after decryption is more accurate.
[0131] In one embodiment, the present application also provides a storage capacity verification method, which is applied to a container group deployed on a master node in a cluster. The method includes the following process:
[0132] (1) Obtain each operation request sent by the user at the current moment.
[0133] (2) Obtain at least one storage operation request according to the operation request of the storage operation in each operation request.
[0134] (3) Obtain the current limit information of the storage system corresponding to the cluster.
[0135] (4) Decrypt the restriction information to obtain the restricted storage capacity of the storage system at the current moment.
[0136] (5) Based on each storage operation request, determine the request type of each storage operation request and the required storage capacity of the cluster when running each resource.
[0137] (6) Obtain the usage information of the storage system at the current moment.
[0138] (7) Decrypt the used information to obtain the used storage capacity of the storage system at the current moment.
[0139] (8) For any resource, if the request type of the storage operation request is to increase the storage volume, the used storage capacity and the required storage capacity are added together to obtain the target storage capacity.
[0140] (9) If the storage operation request type is to delete a storage volume, the used storage capacity is subtracted from the required storage capacity to obtain the target storage capacity.
[0141] (10) If the target storage capacity does not exceed the limited storage capacity, it is determined that the storage capacity has passed the verification at the current moment.
[0142] (11) If the target storage capacity exceeds the limited storage capacity, it is determined that the storage capacity verification has failed at the current moment.
[0143] (12) When the storage capacity verification passes, the target storage capacity is encrypted to obtain the encrypted target storage capacity, and the encrypted target storage capacity is used as the new used information, and the capacity verification flag of the storage capacity is updated to the verified flag.
[0144] The execution process of the above (1) to (12) can be specifically referred to the description of the above embodiment. The implementation principle and technical effect are similar and will not be repeated here.
[0145] It should be understood that, although the steps in the flowcharts involved in the above embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps is not strictly limited in order, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above embodiments may include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.
[0146] Based on the same inventive concept, the embodiment of the present application also provides a storage capacity verification device for implementing the storage capacity verification method involved above. The implementation scheme for solving the problem provided by the device is similar to the implementation scheme recorded in the above method, so the specific limitations in one or more storage capacity verification device embodiments provided below can refer to the limitations of the storage capacity verification method above, and will not be repeated here.
[0147] In one embodiment, Figure 7 This is a schematic diagram of the structure of a storage capacity verification device in one embodiment of the present application. The storage capacity verification device provided in the embodiment of the present application can be applied to a container group deployed on a master node in a cluster. Figure 7 As shown, the storage capacity verification device of the embodiment of the present application may include: a request obtaining module 11 and a verification result determining module 12, wherein:
[0148] The request acquisition module 11 is used to acquire each storage operation request corresponding to at least one resource to be run, and acquire the limited storage capacity of the storage system corresponding to the cluster at the current moment;
[0149] The verification result determination module 12 is used to determine the verification result of the storage capacity of the storage system at the current moment when running each resource according to each storage operation request and the limited storage capacity.
[0150] The storage capacity verification device provided in the embodiment of the present application can be used to execute the technical solution in the above-mentioned storage capacity verification method embodiment of the present application. Its implementation principle and technical effect are similar and will not be repeated here.
[0151] In one embodiment, the verification result determination module 12 includes: a first determination unit and a second determination unit, wherein:
[0152] A first determining unit, configured to determine, according to each storage operation request, a request type of each storage operation request and a required storage capacity of the cluster when running each resource;
[0153] The second determining unit is used to determine the verification result of the storage capacity at the current moment based on the request type, the required storage capacity and the limited storage capacity of each storage operation request.
[0154] The storage capacity verification device provided in the embodiment of the present application can be used to execute the technical solution in the above-mentioned storage capacity verification method embodiment of the present application. Its implementation principle and technical effect are similar and will not be repeated here.
[0155] In one embodiment, the second determining unit includes: an acquiring subunit, a determining subunit and a verifying subunit, wherein:
[0156] An acquisition subunit, used to acquire the used storage capacity of the storage system at the current moment;
[0157] A determination subunit, configured to determine a target storage capacity of the storage system according to a request type, a used storage capacity, and a required storage capacity of each storage operation request;
[0158] The verification subunit is used to verify the storage capacity according to the target storage capacity and the limited storage capacity to obtain the verification result of the storage capacity at the current moment.
[0159] The storage capacity verification device provided in the embodiment of the present application can be used to execute the technical solution in the above-mentioned storage capacity verification method embodiment of the present application. Its implementation principle and technical effect are similar and will not be repeated here.
[0160] In one embodiment, the acquisition subunit is specifically used for:
[0161] Get the used information of the storage system at the current moment;
[0162] The used information is decrypted to obtain the used storage capacity of the storage system at the current moment.
[0163] The storage capacity verification device provided in the embodiment of the present application can be used to execute the technical solution in the above-mentioned storage capacity verification method embodiment of the present application. Its implementation principle and technical effect are similar and will not be repeated here.
[0164] In one embodiment, the determining subunit is specifically configured to:
[0165] For any resource, if the request type of the storage operation request is to increase the storage volume, the used storage capacity and the required storage capacity are added to obtain the target storage capacity;
[0166] If the request type of the storage operation request is to delete a storage volume, the used storage capacity is subtracted from the required storage capacity to obtain the target storage capacity.
[0167] The storage capacity verification device provided in the embodiment of the present application can be used to execute the technical solution in the above-mentioned storage capacity verification method embodiment of the present application. Its implementation principle and technical effect are similar and will not be repeated here.
[0168] In one embodiment, the check subunit is specifically used for:
[0169] If the target storage capacity does not exceed the limited storage capacity, then determining that the storage capacity has passed the verification at the current moment;
[0170] If the target storage capacity exceeds the limited storage capacity, it is determined that the storage capacity verification has failed at the current moment.
[0171] The storage capacity verification device provided in the embodiment of the present application can be used to execute the technical solution in the above-mentioned storage capacity verification method embodiment of the present application. Its implementation principle and technical effect are similar and will not be repeated here.
[0172] In one embodiment, the storage capacity verification device further includes: an encryption module, wherein:
[0173] The encryption module is used to encrypt the target storage capacity to obtain the encrypted target storage capacity when the storage capacity verification passes, and use the encrypted target storage capacity as new used information.
[0174] The storage capacity verification device provided in the embodiment of the present application can be used to execute the technical solution in the above-mentioned storage capacity verification method embodiment of the present application. Its implementation principle and technical effect are similar and will not be repeated here.
[0175] In one embodiment, the storage capacity verification device further includes: an identification updating module, wherein:
[0176] The identification updating module is used to update the capacity verification identification of the storage capacity to a verified identification when the storage capacity verification passes.
[0177] The storage capacity verification device provided in the embodiment of the present application can be used to execute the technical solution in the above-mentioned storage capacity verification method embodiment of the present application. Its implementation principle and technical effect are similar and will not be repeated here.
[0178] In one embodiment, the request acquisition module 11 includes: a first acquisition unit and a second acquisition unit, wherein:
[0179] A first acquisition unit, used to acquire each operation request sent by the user terminal at the current moment;
[0180] The second acquiring unit is configured to acquire at least one storage operation request according to the operation request of the storage operation in each operation request.
[0181] The storage capacity verification device provided in the embodiment of the present application can be used to execute the technical solution in the above-mentioned storage capacity verification method embodiment of the present application. Its implementation principle and technical effect are similar and will not be repeated here.
[0182] In one embodiment, the request acquisition module 11 includes: a third acquisition unit and a decryption unit, wherein:
[0183] A third acquisition unit is used to acquire the restriction information of the storage system corresponding to the cluster at the current moment;
[0184] The decryption unit is used to decrypt the restriction information to obtain the restricted storage capacity of the storage system at the current moment.
[0185] The storage capacity verification device provided in the embodiment of the present application can be used to execute the technical solution in the above-mentioned storage capacity verification method embodiment of the present application. Its implementation principle and technical effect are similar and will not be repeated here.
[0186] For the specific definition of the storage capacity verification device, please refer to the definition of the storage capacity verification method above, which will not be repeated here. Each module in the above storage capacity verification device can be implemented in whole or in part by software, hardware and a combination thereof. The above modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory of the computer device in the form of software, so that the processor can call and execute the operations corresponding to the above modules.
[0187] In one embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as follows: Figure 8As shown. The computer device includes a processor, a memory and a network interface connected through a system bus. Among them, the processor of the computer device is used to provide processing power. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used for various storage operation requests. The network interface of the computer device is used to communicate with an external endpoint through a network connection. When the computer program is executed by the processor, a storage capacity verification method is implemented.
[0188] Those skilled in the art will understand that Figure 8 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0189] In one embodiment, a computer device is also provided, including a memory and a processor, wherein a computer program is stored in the memory, and when the processor executes the computer program, the technical solution in the above-mentioned storage capacity verification method embodiment of the present application is implemented. The implementation principle and technical effect are similar and will not be repeated here.
[0190] In one embodiment, a computer-readable storage medium is also provided, on which a computer program is stored. When the computer program is executed by a processor, the technical solution of the above-mentioned storage capacity verification method of the present application is implemented. The implementation principle and technical effect are similar and will not be repeated here.
[0191] In one embodiment, a computer program product is also provided, including a computer program. When the computer program is executed by a processor, the technical solution of the storage capacity verification method mentioned above in the present application is implemented. The implementation principle and technical effect are similar and will not be repeated here.
[0192] Those of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by signaling related hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), tape, floppy disk, flash memory or optical memory, etc. Volatile memory can include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM).
[0193] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0194] The above-mentioned embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the invention patent. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the patent of the present application shall be subject to the attached claims.
Claims
1. A storage capacity verification method, characterized in that: Applied to a container group deployed on a master node in a cluster, the method includes: Obtaining each storage operation request corresponding to at least one resource to be run, and obtaining a limited storage capacity of a storage system corresponding to the cluster at a current moment; Determining, according to each of the storage operation requests, a request type of each of the storage operation requests and a required storage capacity of the cluster when running each of the resources; For any resource, if the request type of the storage operation request is to add a storage volume, the used storage capacity of the storage system and the required storage capacity are added to obtain the target storage capacity of the storage system; if the request type of the storage operation request is to delete a storage volume, the used storage capacity and the required storage capacity are subtracted to obtain the target storage capacity of the storage system; The storage capacity is verified according to the target storage capacity and the limited storage capacity to obtain a verification result of the storage capacity at the current moment.
2. The method according to claim 1, characterized in that The method further comprises: The used storage capacity of the storage system at the current moment is obtained.
3. The method according to claim 2, characterized in that The obtaining of the used storage capacity of the storage system at the current moment includes: Obtaining usage information of the storage system at the current moment; The used information is decrypted to obtain the used storage capacity of the storage system at the current moment.
4. The method according to any one of claims 1 to 3, characterized in that The verifying the storage capacity according to the target storage capacity and the limited storage capacity to obtain a verification result of the storage capacity at the current moment includes: If the target storage capacity does not exceed the limited storage capacity, determining that the storage capacity has passed the verification at the current moment; If the target storage capacity exceeds the limited storage capacity, it is determined that the storage capacity verification has failed at the current moment.
5. The method according to any one of claims 1 to 3, characterized in that: The method further comprises: In the case where the storage capacity verification passes, the target storage capacity is encrypted to obtain an encrypted target storage capacity, and the encrypted target storage capacity is used as new used information.
6. The method according to any one of claims 1 to 3, characterized in that The obtaining the limited storage capacity of the storage system corresponding to the cluster at the current moment includes: Obtain restriction information of the storage system corresponding to the cluster at the current moment; The restriction information is decrypted to obtain the restricted storage capacity of the storage system at the current moment.
7. A storage capacity verification device, characterized in that: The device comprises: A request acquisition module, used to acquire each storage operation request corresponding to at least one resource to be run, and to acquire the limited storage capacity of the storage system corresponding to the cluster at the current moment; A verification result determination module, configured to determine, according to each of the storage operation requests and the limited storage capacity, a verification result of the storage capacity of the storage system at the current moment when each of the resources is operated; Wherein, the verification result determination module includes: A first determining unit, configured to determine, according to each of the storage operation requests, a request type of each of the storage operation requests and a required storage capacity of the cluster when running each of the resources; a determination subunit, configured to, for any resource, if the request type of the storage operation request is to add a storage volume, add the used storage capacity of the storage system and the required storage capacity to obtain a target storage capacity of the storage system; if the request type of the storage operation request is to delete a storage volume, subtract the used storage capacity from the required storage capacity to obtain a target storage capacity of the storage system; The verification subunit is used to verify the storage capacity according to the target storage capacity and the limited storage capacity to obtain a verification result of the storage capacity at the current moment.
8. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 6 are implemented.
9. A readable storage medium having a computer program stored thereon, 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 6 are implemented.
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 according to any one of claims 1 to 6 are implemented.
Citation Information
Patent Citations
Storage resource configuration method, storage resource controller and scheduling system
CN112835524A
Method for dynamically supplying local volume based on disk type in cluster
CN115756320A