Storage resource management method, device, electronic device and storage medium
By obtaining the PVC and PV list in the Kubernetes cluster, prioritizing processing and binding according to the weight value and matching score, the problem of persistent volume declaration and persistent volume binding relationship is solved, ensuring that the application's persistent storage access is normal and reducing failures. and performance impact.
Patent Information
- Application Number
- CN202410474372.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-04-19
- Publication Date
- 2024-09-20
- Estimated Expiration
- 2044-04-19
AI Technical Summary
In a complex Kubernetes cluster, problems may occur in the binding relationship between the persistent volume declaration and the persistent volume, causing the application to be unable to properly access the required persistent storage, affecting the reliability and performance of the application.
By obtaining the persistent volume declaration PVC list and the persistent volume PV list, determine the weight value and matching score of the PVC, give priority to the PVC with the highest weight value and the PV with the highest matching score, and bind it when the matching score is greater than the threshold. Binding, dynamically adjust the capacity and weight value of PV to ensure the correct binding relationship.
Ensure that each PVC can be bound as soon as possible, ensure that applications can normally access the required persistent storage resources, and reduce potential failures and performance issues.
Smart Images

Figure CN118069072B
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of storage resource management, and in particular to a storage resource management method, device, electronic equipment and storage medium. Background Art
[0002] As a container orchestration platform, Kubernetes is widely used in the deployment and management of modern cloud-native applications. In Kubernetes, Persistent Volume (PV) and Persistent Volume Claim (PVC) are used to implement persistent storage of containers, where PVC refers to the user's request for PV, and PV refers to the actual storage resource. PVC meets the application's demand for persistent storage through a binding relationship with PV.
[0003] In the prior art, when a PVC is created, Kubernetes will automatically select a suitable PV for binding based on the specifications and storage class of the PVC. For example, specific binding can be performed through labels, or PV with appropriate capacity can be automatically selected for binding.
[0004] However, in a complex Kubernetes cluster, problems may arise in the binding relationship between persistent volume declarations and persistent volumes. For example, there may be multiple persistent volume declarations trying to bind to the same persistent volume, or the properties of the persistent volume declaration may not match the properties of the persistent volume. These problems may prevent applications from accessing the required persistent storage properly, thus affecting the reliability and performance of the application. Summary of the invention
[0005] The present invention provides a storage resource management method, device, electronic device and storage medium, which are used to solve the problem that the binding method in the prior art will cause an application program to be unable to normally access the required persistent storage.
[0006] The present invention provides a storage resource management method, comprising: obtaining a persistent volume declaration PVC list and a persistent volume PV list, wherein one PVC corresponds to one weight value; determining a first PVC with the highest weight value from the PVC list, and determining a matching score between the first PVC and each PV in the PV list; determining a first PV with the highest matching score with the first PVC from the PV list; and binding the first PVC to the first PV when the matching score of the first PV is greater than a first threshold; wherein the weight value is used to indicate a priority for binding the PVC, the higher the weight value of the PVC, the greater the corresponding matching difficulty, and the matching score is used to indicate a degree of adaptation between the PV and the PVC.
[0007] According to a storage resource management method provided by the present invention, before obtaining the persistent volume declaration PVC list and the persistent volume PV list, the method further includes: determining a weight value of each PVC in the PVC list according to the storage requirements and access mode of the PVC.
[0008] According to a storage resource management method provided by the present invention, determining the matching score between the first PVC and each PV in the PV list includes: determining the matching score between the first PVC and each PV in the PV list by comparing the available capacity, storage class, and access mode of the first PVC.
[0009] According to a storage resource management method provided by the present invention, the method further includes: when the matching score of the first PV is less than or equal to the first threshold and the first PVC meets a first preset condition, reducing the weight value of the first PVC; wherein the first preset condition includes at least one of the following: the waiting time of the first PVC is greater than a second threshold and the resource utilization rate of the first PVC is less than a third threshold.
[0010] According to a storage resource management method provided by the present invention, the method further includes: when the matching score of the first PV is less than or equal to the first threshold, dynamically adjusting the capacity of the first PV according to the storage demand of the first PVC.
[0011] According to a storage resource management method provided by the present invention, the determining of the matching score between the first PVC and each PV in the PV list includes: screening out PVs whose access mode and storage class match the first PVC, and determining the matching score of the PVs whose access mode and storage class do not match the first PVC as a first score; screening out PVs whose resource size is greater than or equal to the requested size of the first PVC among the PVs whose access mode and storage class match the first PVC, and determining the matching score of the PVs whose resource size is less than the requested size of the first PVC as a second score; determining the matching score of the PV whose resource size is closest to the requested size of the first PVC as a third score; wherein the third score is greater than the second score, and the second score is greater than the first score.
[0012] The present invention also provides a storage resource management device, including: an acquisition module and a processing module; the acquisition module is used to acquire a persistent volume declaration PVC list and a persistent volume PV list, one PVC corresponds to a weight value; the processing module is used to determine the first PVC with the highest weight value from the PVC list, and determine the matching score between the first PVC and each PV in the PV list; determine the first PV with the highest matching score with the first PVC from the PV list; when the matching score of the first PV is greater than a first threshold, bind the first PVC to the first PV; wherein the weight value is used to indicate the priority of binding processing for the PVC, the higher the weight value of the PVC, the greater the corresponding matching difficulty, and the matching score is used to indicate the degree of adaptation between the PV and the PVC.
[0013] According to the storage resource management device provided by the present invention, the processing module is used to determine the weight value of each PVC in the PVC list according to the storage demand and access mode of the PVC.
[0014] According to a storage resource management device provided by the present invention, the processing module is used to determine the matching score between the first PVC and each PV in the PV list by comparing the available capacity, storage class and access mode of the first PVC.
[0015] According to a storage resource management device provided by the present invention, the processing module is used to reduce the weight value of the first PVC when the matching score of the first PV is less than or equal to the first threshold and the first PVC meets a first preset condition; wherein the first preset condition includes at least one of the following: the waiting time of the first PVC is greater than a second threshold and the resource utilization rate of the first PVC is less than a third threshold.
[0016] According to a storage resource management device provided by the present invention, the processing module is used to dynamically adjust the capacity of the first PV according to the storage demand of the first PVC when the matching score of the first PV is less than or equal to the first threshold.
[0017] According to a storage resource management device provided by the present invention, the processing module is used to screen out PVs whose access mode and storage class match the first PVC, and determine the matching score of the PVs whose access mode and storage class do not match the first PVC as a first score; among the PVs whose access mode and storage class match the first PVC, screen out PVs whose resource size is greater than or equal to the first PVC request size, and determine the matching score of the PVs whose resource size is less than the first PVC request size as a second score; determine the matching score of the PV whose resource size is closest to the first PVC request size as a third score; wherein the third score is greater than the second score, and the second score is greater than the first score.
[0018] The present invention also provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of any of the above-mentioned storage resource management methods when executing the program.
[0019] The present invention also provides a non-transitory computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, the steps of any of the above-mentioned storage resource management methods are implemented.
[0020] The storage resource management method, device, electronic device and storage medium provided by the present invention can obtain a persistent volume declaration PVC list and a persistent volume PV list, where one PVC corresponds to a weight value; determine the first PVC with the highest weight value from the PVC list, and determine the matching score between the first PVC and each PV in the PV list; determine the first PV with the highest matching score with the first PVC from the PV list; bind the first PVC to the first PV when the matching score of the first PV is greater than a first threshold; wherein the weight value is used to indicate the priority of binding processing for the PVC, the higher the weight value of the PVC, the greater the corresponding matching difficulty, and the matching score is used to indicate the degree of adaptation between the PV and the PVC. Through this solution, on the one hand, the PVCs in the PVC list can be bound in turn according to the weight values. Since the higher the weight value of the PVC, the greater the corresponding matching difficulty, and the number of PVs in the PV list will decrease as the matching progresses, therefore, PVCs with high matching difficulty are processed first to ensure that each PVC can be bound as soon as possible; on the other hand, the first PV with the highest matching score with the first PVC can be determined from the PV list for binding. Since the matching score is used to indicate the degree of adaptation between the PV and the PVC, binding the first PVC with the first PV can ensure the correct binding relationship, so that the application can normally access the required persistent storage resources and reduce potential failures and performance issues. BRIEF DESCRIPTION OF THE DRAWINGS
[0021] In order to more clearly illustrate the technical solutions in the present invention or the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0022] Figure 1 It is one of the flow charts of the storage resource management method provided by the present invention;
[0023] Figure 2 This is the second flow chart of the storage resource management method provided by the present invention;
[0024] Figure 3 It is a structural schematic diagram of the storage resource management device provided by the present invention;
[0025] Figure 4 It is a structural schematic diagram of the electronic device provided by the present invention. DETAILED DESCRIPTION
[0026] In order to make the purpose, technical solution and advantages of the present invention clearer, the technical solution of the present invention will be clearly and completely described below in conjunction with the drawings of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0027] It should be noted that, in the embodiments of the present invention, words such as "exemplary" or "for example" are used to indicate examples, illustrations or descriptions. Any embodiment or design described as "exemplary" or "for example" in the embodiments of the present invention should not be interpreted as being more preferred or more advantageous than other embodiments or designs. Specifically, the use of words such as "exemplary" or "for example" is intended to present related concepts in a specific way.
[0028] It should be noted that, in this article, the terms "comprise", "include" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the sentence "comprises a ..." does not exclude the presence of other identical elements in the process, method, article or device including the element. In addition, it should be pointed out that the scope of the method and device in the embodiment of the present invention is not limited to performing functions in the order shown or discussed, and may also include performing functions in a substantially simultaneous manner or in reverse order according to the functions involved, for example, the described method may be performed in an order different from that described, and various steps may also be added, omitted, or combined. In addition, the features described with reference to certain examples may be combined in other examples.
[0029] In order to clearly describe the technical solutions of the embodiments of the present invention, in the embodiments of the present invention, the words "first", "second", etc. are used to distinguish between the same items or similar items with basically the same functions and effects. Those skilled in the art can understand that the words "first", "second", etc. are not limiting the quantity and execution order.
[0030] The embodiments of the present invention describe some exemplary embodiments for the purpose of explanation. It should be understood that the present invention can be implemented in other ways that are not specifically shown in the drawings.
[0031] First, the technical terms involved in the embodiments of the present application are explained as follows:
[0032] Kubernetes: K8s for short, is an open source container orchestration engine from Google that supports automated deployment, large-scale scalability, and containerized application management. When deploying an application in a production environment, you usually need to deploy multiple instances of the application to load balance application requests. In Kubernetes, you can create multiple containers, each of which runs an application instance, and then use the built-in load balancing strategy to manage, discover, and access this group of application instances, without requiring the operation and maintenance personnel to perform complex manual configuration and processing for these details.
[0033] Pod: In Kubernetes, Pod is the smallest unit that can be created and managed. It is also the smallest resource object model created or deployed by users in the resource object model, and it is also the resource object for running containerized applications on Kubernetes. Other resource objects are used to support or extend the functions of Pod objects, such as controller objects are used to control Pod objects, Service or Ingress resource objects are used to expose Pod reference objects, and PersistentVolume resource objects are used to provide storage for Pods.
[0034] PV: In Kubernetes, PV is an abstract concept that represents a persistent storage resource that can be used by Pods. PV is a resource object in the cluster that exists independently of Pods and can therefore be shared between Pods. PV can be any type of persistent storage, such as local disks, network storage, cloud storage, and so on. When creating a PV, you need to specify information such as the storage type, size, and access mode. PV can be shared by multiple Pods, but can only be used by one Pod at a time. Before using PV, you need to create a PV object first and then reference the PV in the Pod's configuration file. When the Pod is scheduled to a node, Kubernetes will mount the PV to the Pod's container so that the Pod can access the persistent storage.
[0035] PVC: In Kubernetes, PVC is a description of a Pod's storage requirements. It applies for certain storage resources and specifies some attributes, such as access mode, size, storage category, etc.
[0036] The above implementation is described in detail below with reference to specific embodiments and drawings.
[0037] like Figure 1 As shown, an embodiment of the present invention provides a storage resource management method, which can be applied to a storage resource management device. The storage resource management method may include S101-S104:
[0038] S101. The storage resource management device obtains a persistent volume declaration PVC list and a persistent volume PV list.
[0039] Optionally, the PVC list may include at least one PVC to which storage resources are to be bound, and the PV list may include at least one PV to be allocated.
[0040] Alternatively, if Figure 2As shown, after creating the PVC list, the storage resource management device can first determine the weight value of each PVC in the PVC list according to the storage requirements and access mode of the PVC. One PVC corresponds to one weight value, and the weight value is used to indicate the priority of binding processing for the PVC. The higher the weight value of the PVC, the greater the corresponding matching difficulty and the corresponding binding processing priority, that is, the PVC with high matching difficulty can be processed first.
[0041] Optionally, after creating the PVC list, the storage resource management device can also match PVs for the PVCs through an intelligent recommendation mechanism, that is, in the existing PV list, select a suitable PV for binding based on the historical usage and performance of the PV. For example, specific binding can be performed through tags, or PVs with suitable parameters such as capacity size can be automatically selected for binding without tags.
[0042] Optionally, the storage resource management device may determine the weight value of each PVC in the PVC list according to the storage requirements and access modes of the PVCs when the intelligent recommendation mechanism is not selected for binding.
[0043] Based on the above solution, since you can choose the intelligent recommendation mechanism for binding or the method of determining the weight value for binding, the diversity and selectivity of the PVC and PV binding methods are improved.
[0044] S102: The storage resource management device determines a first PVC with the highest weight value from the PVC list, and determines a matching score between the first PVC and each PV in the PV list.
[0045] Optionally, since the weight value is used to indicate the priority of binding processing for PVC, the storage resource management device may preferentially select the first PVC with the highest weight value from the PVC list for processing.
[0046] Optionally, the PVCs in the PVC list may be arranged in descending order according to weight values, and the storage resource management device may select the first PVC for processing.
[0047] Alternatively, if Figure 2 As shown, after determining the first PVC, the storage resource management device can determine the matching score between the first PVC and each PV in the PV list by comparing the available capacity, storage class, and access mode of the first PVC. The matching score is used to indicate the degree of adaptation between the PV and the PVC. The higher the matching score, the higher the corresponding degree of adaptation.
[0048] Optionally, when determining the matching score between the first PVC and each PV in the PV list, the storage resource management device may screen out PVs whose access mode and storage class match the first PVC, and determine the matching score of PVs whose access mode and storage class do not match the first PVC as the first score; among the PVs whose access mode and storage class match the first PVC, screen out PVs whose resource size is greater than or equal to the size requested by the first PVC, and determine the matching score of PVs whose resource size is less than the size requested by the first PVC as the second score; determine the matching score of the PV whose resource size is closest to the size requested by the first PVC as the third score; wherein the third score is greater than the second score, and the second score is greater than the first score.
[0049] Specifically, the process of determining the matching score by the storage resource management device may include the following steps:
[0050] Step 1: Filter out PVs whose access mode and storage class match the first PVC;
[0051] For a PV whose access mode and storage class do not match the first PVC, the storage resource management device may determine its matching score as the first score;
[0052] Step 2: Among the PVs that meet the access mode and storage class matching, select the PVs whose resource size is greater than or equal to the size requested by the first PVC;
[0053] For a PV whose resource size is smaller than the size requested by the first PVC, the storage resource management device may determine its matching score as the second score;
[0054] Step 3: Filter out the PV whose resource size is closest to the size requested by the first PVC, and determine its matching score as the third score;
[0055] The third score is greater than the second score, and the second score is greater than the first score.
[0056] S103: The storage resource management device determines a first PV having the highest matching score with the first PVC from the PV list.
[0057] Optionally, when there are multiple PVs with the same matching score as the first PVC in the PV list, the storage resource management device may randomly determine a PV from the multiple PVs with the same matching score as the first PV.
[0058] S104: When the matching score of the first PV is greater than a first threshold, the storage resource management device binds the first PVC to the first PV.
[0059] Optionally, after determining the first PV, the storage resource management device may first determine whether the matching score of the first PV is greater than a first threshold; if the matching score of the first PV is greater than the first threshold, the storage resource management device may directly bind the first PVC to the first PV.
[0060] Optionally, when matching PVC and PV, the storage resource management device may adopt a parallel processing method to consider multiple possible matching results at the same time, thereby improving the mounting efficiency.
[0061] Based on the above solution, since the binding requests of multiple PVCs and PVs can be processed in parallel, the processing capacity of the system can be improved, thereby supporting larger-scale deployment and applications.
[0062] Optionally, when a PV is about to be released, the storage resource management device may bind it to a suitable PVC in advance according to the matching score, thereby reducing waiting time and improving resource utilization.
[0063] Alternatively, if Figure 2 As shown, when the matching score of the first PV is less than or equal to the first threshold and the first PVC satisfies a first preset condition, the storage resource management device may reduce the weight value of the first PVC; wherein the first preset condition includes at least one of the following: the waiting time of the first PVC is greater than the second threshold, and the resource utilization rate of the first PVC is less than the third threshold.
[0064] It should be noted that the reduced weight value of the first PVC is smaller than the weight value of at least one PVC in the PVC list.
[0065] Specifically, when the weight value of a certain PVC is too high, the PVC may wait for a suitable PV for a long time. Therefore, the present application introduces a dynamic adjustment mechanism. When the matching score of the first PV is less than or equal to the first threshold, if the waiting time of the first PVC is greater than the second threshold or the resource utilization rate of the first PVC is less than the third threshold, the storage resource management device can dynamically reduce the weight value of the first PVC according to the waiting time and resource utilization rate of the first PVC. In other words, the storage resource management device can place the first PVC at the back of the queue of the PVC list by adjusting the weight value, that is, temporarily not processing the first PVC.
[0066] Optionally, after the storage resource management device reduces the weight value of the first PVC, the storage resource management device may reselect a PVC with the largest weight value from the PVC list for binding.
[0067] Based on the above solution, since the binding process can be accelerated by adjusting the weight value of the first PVC, the binding process of the PVC and the PV can be accelerated, the waiting time can be reduced, and the response speed of the system can be improved.
[0068] Alternatively, if Figure 2 As shown, when the matching score of the first PV is less than or equal to the first threshold, the storage resource management device can also dynamically adjust the capacity of the first PV according to the storage demand of the first PVC, that is, dynamically expand or reduce the capacity of the first PV to meet the capacity demand of the first PVC.
[0069] Based on the above solution, since the binding process can be accelerated by adjusting the capacity of the first PV when the matching score of the first PV is less than or equal to the first threshold, the needs of the first PVC can be quickly met, thereby avoiding the system crash due to insufficient resources, thereby enhancing the stability of the system.
[0070] In the embodiment of the present invention, on the one hand, the PVCs in the PVC list can be bound in sequence according to the weight values. Since the higher the weight value of the PVC is, the greater the corresponding matching difficulty is, and the number of PVs in the PV list will decrease as the matching progresses, therefore, PVCs with high matching difficulty are processed first to ensure that each PVC can be bound as soon as possible; on the other hand, the first PV with the highest matching score with the first PVC can be determined from the PV list for binding. Since the matching score is used to indicate the degree of adaptation between the PV and the PVC, binding the first PVC with the first PV can ensure a correct binding relationship, so that the application can normally access the required persistent storage resources, reducing potential failures and performance issues.
[0071] The above mainly introduces the solution provided by the embodiment of the present invention from the perspective of the method. In order to achieve the above functions, it includes hardware structures and / or software modules corresponding to the execution of each function. Those skilled in the art should easily realize that, in combination with the units and algorithm steps of each example described in the embodiment disclosed in this article, the embodiment of the present invention can be implemented in the form of hardware or a combination of hardware and computer software. Whether a function is executed in the form of hardware or computer software driving hardware depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to exceed the scope of the present invention.
[0072] The storage resource management method provided in the embodiment of the present invention can be executed by a storage resource management device or a control module for storage resource management in the storage resource management device. The storage resource management device provided in the embodiment of the present invention is described by taking the storage resource management device executing the storage resource management method as an example.
[0073] It should be noted that the embodiment of the present invention can divide the storage resource management device into functional modules according to the above method example. For example, each functional module can be divided according to each function, or two or more functions can be integrated into one processing module. The above integrated module can be implemented in the form of hardware or in the form of software functional modules. Optionally, the division of modules in the embodiment of the present invention is schematic and is only a logical functional division. There may be other division methods in actual implementation.
[0074] like Figure 3 As shown, an embodiment of the present invention provides a storage resource management device 300. The storage resource management device 300 includes: an acquisition module 301 and a processing module 302. The acquisition module 301 is used to obtain a persistent volume declaration PVC list and a persistent volume PV list, one PVC corresponds to a weight value; the processing module 302 is used to determine the first PVC with the highest weight value from the PVC list, and determine the matching score between the first PVC and each PV in the PV list; determine the first PV with the highest matching score with the first PVC from the PV list; when the matching score of the first PV is greater than a first threshold, bind the first PVC to the first PV; wherein the weight value is used to indicate the priority of binding processing for the PVC, the higher the weight value of the PVC, the greater the corresponding matching difficulty, and the matching score is used to indicate the degree of adaptation between the PV and the PVC.
[0075] Optionally, the processing module 302 is configured to determine a weight value of each PVC in the PVC list according to a storage requirement and an access mode of the PVC.
[0076] Optionally, the processing module 302 is configured to determine a matching score between the first PVC and each PV in the PV list by comparing the available capacity, storage class, and access mode of the first PVC.
[0077] Optionally, the processing module 302 is used to reduce the weight value of the first PVC when the matching score of the first PV is less than or equal to the first threshold and the first PVC satisfies a first preset condition; wherein the first preset condition includes at least one of the following: the waiting time of the first PVC is greater than a second threshold and the resource utilization of the first PVC is less than a third threshold.
[0078] Optionally, the processing module 302 is configured to dynamically adjust the capacity of the first PV according to a storage requirement of the first PVC when the matching score of the first PV is less than or equal to the first threshold.
[0079] Optionally, the processing module 302 is used to screen out PVs whose access mode and storage class match the first PVC, and determine the matching score of the PVs whose access mode and storage class do not match the first PVC as a first score; among the PVs whose access mode and storage class match the first PVC, screen out PVs whose resource size is greater than or equal to the size requested by the first PVC, and determine the matching score of the PVs whose resource size is less than the size requested by the first PVC as a second score; determine the matching score of the PV whose resource size is closest to the size requested by the first PVC as a third score; wherein the third score is greater than the second score, and the second score is greater than the first score.
[0080] In the embodiment of the present invention, on the one hand, the PVCs in the PVC list can be bound in sequence according to the weight values. Since the higher the weight value of the PVC is, the greater the corresponding matching difficulty is, and the number of PVs in the PV list will decrease as the matching progresses, therefore, PVCs with high matching difficulty are processed first to ensure that each PVC can be bound as soon as possible; on the other hand, the first PV with the highest matching score with the first PVC can be determined from the PV list for binding. Since the matching score is used to indicate the degree of adaptation between the PV and the PVC, binding the first PVC with the first PV can ensure a correct binding relationship, so that the application can normally access the required persistent storage resources, reducing potential failures and performance issues.
[0081] Figure 4 An example of a physical structure diagram of an electronic device is shown in FIG. Figure 4As shown, the electronic device may include: a processor 410, a communication interface 420, a memory 430 and a communication bus 440, wherein the processor 410, the communication interface 420 and the memory 430 complete mutual communication through the communication bus 440. The processor 410 may call the logic instructions in the memory 430 to execute the storage resource management method, which includes: obtaining a list of persistent volume declaration PVCs and a list of persistent volume PVs, one PVC corresponding to one weight value; determining the first PVC with the highest weight value from the PVC list, and determining the matching score of the first PVC with each PV in the PV list; determining the first PV with the highest matching score with the first PVC from the PV list; when the matching score of the first PV is greater than the first threshold, binding the first PVC with the first PV; wherein the weight value is used to indicate the priority of binding the PVC, the higher the weight value of the PVC, the greater the corresponding matching difficulty, and the matching score is used to indicate the degree of adaptation between the PV and the PVC.
[0082] In addition, the logic instructions in the above-mentioned memory 430 can be implemented in the form of a software functional unit and can be stored in a computer-readable storage medium when it is sold or used as an independent product. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, etc. Various media that can store program codes.
[0083] On the other hand, the present invention also provides a computer program product, which includes a computer program stored on a non-transitory computer-readable storage medium, and the computer program includes program instructions. When the program instructions are executed by a computer, the computer can execute the storage resource management method provided by the above methods, and the method includes: obtaining a persistent volume declaration PVC list and a persistent volume PV list, one PVC corresponding to a weight value; determining a first PVC with the highest weight value from the PVC list, and determining a matching score between the first PVC and each PV in the PV list; determining a first PV with the highest matching score with the first PVC from the PV list; when the matching score of the first PV is greater than a first threshold, binding the first PVC to the first PV; wherein the weight value is used to indicate the priority of binding processing for the PVC, the higher the weight value of the PVC, the greater the corresponding matching difficulty, and the matching score is used to indicate the degree of adaptation between the PV and the PVC.
[0084] On the other hand, the present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which is implemented when the processor executes the above-mentioned storage resource management method, the method comprising: obtaining a persistent volume declaration PVC list and a persistent volume PV list, one PVC corresponding to a weight value; determining a first PVC with the highest weight value from the PVC list, and determining a matching score between the first PVC and each PV in the PV list; determining a first PV with the highest matching score with the first PVC from the PV list; binding the first PVC to the first PV when the matching score of the first PV is greater than a first threshold; wherein the weight value is used to indicate the priority of binding processing for the PVC, the higher the weight value of the PVC, the greater the corresponding matching difficulty, and the matching score is used to indicate the degree of adaptation between the PV and the PVC.
[0085] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without paying creative labor.
[0086] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a necessary general hardware platform, and of course, can also be implemented by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.
[0087] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A storage resource management method, It is characterized in that include: Get the persistent volume declaration PVC list and persistent volume PV list. One PVC corresponds to one weight value. Determine a first PVC with the highest weight value from the PVC list, and determine a matching score between the first PVC and each PV in the PV list; Determine, from the PV list, a first PV having a highest matching score with the first PVC; When the matching score of the first PV is greater than a first threshold, binding the first PVC to the first PV; The weight value is used to indicate the priority of binding the PVC. The higher the weight value of the PVC, the greater the corresponding matching difficulty. The matching score is used to indicate the degree of adaptation between the PV and the PVC. Before obtaining the persistent volume declaration PVC list and the persistent volume PV list, the method further includes: Determine a weight value of each PVC in the PVC list according to the storage requirements and access mode of the PVC; The determining of the matching score between the first PVC and each PV in the PV list includes: Filter out PVs whose access mode and storage class match the first PVC, and determine the matching scores of PVs whose access mode and storage class do not match the first PVC as the first score; Filter out PVs whose resource sizes are greater than or equal to the size requested by the first PVC from among the PVs whose access modes and storage classes match the first PVC, and determine the matching scores of the PVs whose resource sizes are less than the size requested by the first PVC as the second score; Determine the matching score of the PV whose resource size is closest to the size requested by the first PVC as the third score; The third score is greater than the second score, and the second score is greater than the first score.
2. The storage resource management method according to claim 1, It is characterized in that The method further comprises: When the matching score of the first PV is less than or equal to the first threshold and the first PVC meets a first preset condition, reducing the weight value of the first PVC; The first preset condition includes at least one of the following: the waiting time of the first PVC is greater than a second threshold, and the resource utilization rate of the first PVC is less than a third threshold.
3. The storage resource management method according to claim 1, It is characterized in that The method further comprises: When the matching score of the first PV is less than or equal to the first threshold, the capacity of the first PV is dynamically adjusted according to the storage demand of the first PVC.
4. A storage resource management device, It is characterized in that include: Acquisition module and processing module; The acquisition module is used to obtain a list of persistent volume declarations (PVCs) and a list of persistent volume PVs, where one PVC corresponds to one weight value. The processing module is configured to determine a first PVC with the highest weight value from the PVC list, and determine a matching score between the first PVC and each PV in the PV list; Determine a first PV having the highest matching score with the first PVC from the PV list; if the matching score of the first PV is greater than a first threshold, bind the first PVC to the first PV; The weight value is used to indicate the priority of binding the PVC. The higher the weight value of the PVC, the greater the corresponding matching difficulty. The matching score is used to indicate the degree of adaptation between the PV and the PVC. The processing module is used to determine the weight value of each PVC in the PVC list according to the storage requirement and access mode of the PVC; The processing module is used to screen out PVs whose access mode and storage class match the first PVC, and determine the matching score of the PVs whose access mode and storage class do not match the first PVC as the first score; Filter out PVs whose resource sizes are greater than or equal to the size requested by the first PVC from among the PVs whose access modes and storage classes match the first PVC, and determine the matching scores of the PVs whose resource sizes are less than the size requested by the first PVC as the second score; Determine the matching score of the PV whose resource size is closest to the size requested by the first PVC as the third score; The third score is greater than the second score, and the second score is greater than the first score.
5. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, It is characterized in that When the processor executes the program, the steps in the storage resource management method according to any one of claims 1 to 3 are implemented.
6. A non-transitory computer-readable storage medium having a computer program stored thereon, It is characterized in that When the computer program is executed by a processor, the steps in the storage resource management method according to any one of claims 1 to 3 are implemented.
