Storage space detection method and device, electronic equipment and storage medium
By classifying the storage volumes in the storage device and differently detecting the capacity, the problem of inaccurate storage space detection on the cloud platform is solved, and the creation efficiency of business virtual machines and the utilization of storage space are improved.
Patent Information
- Application Number
- CN202411999149.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-30
- Publication Date
- 2025-05-02
AI Technical Summary
On the cloud platform, the storage space detection results of storage devices are inaccurate because the virtual capacity of the snapshot volume is counted into the used space, which affects the creation efficiency of the business virtual machine.
By obtaining the configuration information of all storage volumes in the storage device, the service volume and non-service volume are classified and determined, where the non-service volume at least includes a snapshot volume, respectively, the virtual capacity of the service volume and the real capacity of the non-service volume are detected, the allocated capacity of the storage device is obtained, and the storage space detection result is determined based on the total capacity and the allocated capacity.
Improve the accuracy of storage space detection results, ensure the efficiency of creating business virtual machines, and make full use of storage space, reducing user usage costs.
Smart Images

Figure CN119917216A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of storage technology, and in particular to a storage space detection method, device, electronic device and storage medium. Background Art
[0002] With the continuous development of cloud computing technology, virtual machine technology has received attention as a key technology in cloud computing, and how to create business virtual machines on cloud platforms has become a hot research topic.
[0003] In the related art, since the system disk or data disk of a business virtual machine is essentially a volume in the storage, during business virtualization, the storage space of the storage device is first detected to determine whether the remaining storage space of the storage device meets the creation requirements of the business virtual machine.
[0004] However, when the business virtual machine created on the cloud platform has a snapshot function, the business virtual machine not only has a business volume on the storage device, but also has a corresponding snapshot volume. In the process of detecting the storage space of the storage device, the virtual capacity of the snapshot volume is often included in the used space, resulting in inaccurate storage space detection results, which is not conducive to ensuring the creation efficiency of the business virtual machine. Summary of the invention
[0005] The present application provides a storage space detection method, device, electronic device and storage medium to solve the defects of related technologies that reduce the accuracy of storage space detection results and are not conducive to ensuring the efficiency of creating business virtual machines.
[0006] The first aspect of the present application provides a storage space detection method, comprising:
[0007] Get the configuration information of all storage volumes in the storage device;
[0008] Classifying the storage volumes of the storage device according to the configuration information of each storage volume to respectively determine business volumes and non-business volumes; wherein the non-business volumes at least include snapshot volumes;
[0009] Respectively detecting the virtual capacity of each of the business volumes and the real capacity of each of the non-business volumes to obtain the allocated capacity of the storage device; wherein the real capacity is smaller than the virtual capacity;
[0010] A storage space detection result of the storage device is determined according to the total capacity of the storage device and the allocated capacity.
[0011] In an optional implementation, classifying the storage volumes of the storage device according to the configuration information of each storage volume to respectively determine the business volume and the non-business volume includes:
[0012] For any of the storage volumes, judging whether the storage volume is configured as a first target volume according to the local replication configuration item of the storage volume; wherein a local replication relationship is established between the first target volume and the source volume;
[0013] In the case where it is determined that the storage volume is configured as the first target volume, judging whether the local replication relationship of the storage volume belongs to a business relationship according to the background copy rate of the storage volume;
[0014] In the case where it is determined that the local replication relationship of the storage volume does not belong to a business relationship, judging whether the storage volume is configured as a second target volume according to the remote replication configuration item of the storage volume; wherein no remote replication relationship is established between the first target volume and the source volume;
[0015] In the case of determining that the storage volume is configured as the second target volume, judging whether the storage volume is mounted on the host according to the mounting configuration item of the storage volume;
[0016] When it is determined that the storage volume is not mounted on the host, determining that the storage volume is a non-business volume;
[0017] The configuration information of the storage volume includes the local replication configuration item, the background copy rate, the remote replication configuration item and the mount configuration item.
[0018] In an optional embodiment, the method further includes:
[0019] When it is determined that the storage volume is mounted on a host, determining that the storage volume is a business volume;
[0020] The host is used to perform read and write operations on the storage volume.
[0021] In an optional embodiment, the method further includes:
[0022] In the case of determining that the storage volume is not configured as the first target volume, determining that the storage volume is an application volume;
[0023] In the case where it is determined that the local replication relationship of the storage volume belongs to a business relationship, determining that the storage volume is a clone volume;
[0024] In the case where it is determined that the storage volume is not configured as the second target volume, determining that the storage volume is a remote replication volume;
[0025] The business volume includes the application volume, clone volume and remote replication volume.
[0026] In an optional implementation manner, respectively detecting the virtual capacity of each of the business volumes and the real capacity of each of the non-business volumes to obtain the allocated capacity of the storage device includes:
[0027] Detecting the virtual capacity of each of the business volumes to obtain the total virtual capacity of the business volumes in the storage device;
[0028] Detecting the actual capacity of each of the non-business volumes to obtain the actual total capacity of the non-business volumes in the storage device;
[0029] The virtual total capacity and the real total capacity are accumulated to obtain the allocated capacity of the storage device.
[0030] In an optional implementation manner, determining the storage space detection result of the storage device according to the total capacity of the storage device and the allocated capacity includes:
[0031] Determine remaining service virtual machine creation resources of the storage device according to the total capacity of the storage device and the allocated capacity;
[0032] The storage space detection result includes remaining business virtual machine creation resources of the storage device.
[0033] In an optional implementation, determining the remaining service virtual machine creation resources of the storage device according to the total capacity of the storage device and the allocated capacity includes:
[0034] The remaining service virtual machine creation resources of the storage device are determined based on the following formula:
[0035] A=T×r–P
[0036] Among them, A represents the remaining business virtual machine creation resources of the storage device, T represents the total capacity of the storage device, r represents the preset super-resolution parameter, and P represents the allocated capacity of the storage device.
[0037] A second aspect of the present application provides a storage space detection device, including:
[0038] The acquisition module is used to obtain the configuration information of all storage volumes in the storage device;
[0039] A classification module, used for classifying storage volumes of the storage device according to the configuration information of each storage volume, so as to respectively determine business volumes and non-business volumes; wherein the non-business volumes at least include snapshot volumes;
[0040] A detection module, used to detect the virtual capacity of each business volume and the real capacity of each non-business volume respectively, to obtain the allocated capacity of the storage device; wherein the real capacity is smaller than the virtual capacity;
[0041] The determination module is used to determine the storage space detection result of the storage device according to the total capacity of the storage device and the allocated capacity.
[0042] A third aspect of the present application provides an electronic device, comprising: at least one processor and a memory;
[0043] The memory stores computer-executable instructions;
[0044] The at least one processor executes the computer-executable instructions stored in the memory, so that the at least one processor performs the method described in the first aspect and various possible designs of the first aspect.
[0045] A fourth aspect of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores computer-executable instructions. When a processor executes the computer-executable instructions, the method described in the first aspect and various possible designs of the first aspect are implemented.
[0046] A fifth aspect of the present application provides a computer program product, including computer instructions, which are used to enable a computer to execute the method described in the first aspect and various possible designs of the first aspect.
[0047] The technical solution of this application has the following advantages:
[0048] The present application provides a storage space detection method, device, electronic device and storage medium, the method comprising: obtaining configuration information of all storage volumes in a storage device; classifying the storage volumes of the storage device according to the configuration information of each storage volume to respectively determine business volumes and non-business volumes; wherein the non-business volumes include at least snapshot volumes; respectively detecting the virtual capacity of each business volume and the real capacity of each non-business volume to obtain the allocated capacity of the storage device; wherein the real capacity is less than the virtual capacity; determining the storage space detection result of the storage device according to the total capacity and the allocated capacity of the storage device. The method provided by the above scheme improves the accuracy of the storage space detection result finally obtained by classifying the storage volumes in the storage device and performing differential capacity detection according to the classification results, laying a foundation for improving the efficiency of creating business virtual machines. BRIEF DESCRIPTION OF THE DRAWINGS
[0049] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the related technologies, the following is a brief introduction to the drawings required for use in the embodiments or the related technical descriptions. Obviously, the drawings described below are some embodiments of the present application, and a person skilled in the art can also obtain other drawings based on these drawings.
[0050] Figure 1 A schematic diagram of the storage snapshot principle provided in an embodiment of the present application;
[0051] Figure 2A schematic diagram of the structure of a storage space detection system based on an embodiment of the present application;
[0052] Figure 3 A flowchart of a storage space detection method provided in an embodiment of the present application;
[0053] Figure 4 A schematic diagram of a storage volume classification process provided in an embodiment of the present application;
[0054] Figure 5 A schematic diagram of the topological structure of a snapshot scenario provided in an embodiment of the present application;
[0055] Figure 6 A schematic diagram of the topological structure of a cloning scenario provided in an embodiment of the present application;
[0056] Figure 7 A schematic diagram of the topological structure of a snapshot rollback scenario provided in an embodiment of the present application;
[0057] Figure 8 A schematic diagram of the topology structure of a remote replication / active-active scenario provided in an embodiment of the present application;
[0058] Fig. 9 A schematic diagram of the topological structure of a scenario in which the snapshot volume provided in the embodiment of the present application is a remote replication or active-active primary volume;
[0059] Fig.10 A schematic diagram of the topological structure of a scenario in which the clone volume provided in the embodiment of the present application is a remote replication or active-active primary volume;
[0060] Fig.11 A schematic diagram of the topological structure of a snapshot mounting host scenario provided in an embodiment of the present application;
[0061] Fig.12 A schematic diagram of the overall process of the storage space detection method provided in an embodiment of the present application;
[0062] Fig.13 A schematic diagram of the structure of a storage space detection device provided in an embodiment of the present application;
[0063] Fig.14 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application.
[0064] The above drawings have shown clear embodiments of the present application, which will be described in more detail below. These drawings and text descriptions are not intended to limit the scope of the present disclosure in any way, but to illustrate the concepts of the present application to those skilled in the art by referring to specific embodiments. DETAILED DESCRIPTION
[0065] In order to make the purpose, technical solution and advantages of the embodiments of the present application clearer, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0066] In addition, the terms "first", "second", etc. are used for descriptive purposes only and should not be understood as indicating or implying relative importance or implicitly indicating the number of technical features indicated. In the description of the following embodiments, the meaning of "multiple" is more than two, unless otherwise clearly and specifically defined.
[0067] Currently, more and more enterprise users are deploying their services on virtual machines created on private cloud platforms. At the same time, in order to ensure the security and availability of business data, enterprise-level storage platforms are usually connected to cloud platforms, and volumes and virtual machines in the cloud platforms are created in storage devices, and storage is used and managed through Cinder drivers.
[0068] To ensure data security in virtual machines, cloud platforms provide the function of virtual machine snapshots. Cloud platforms usually create a large number of snapshots for virtual machines. Since the system disk or data disk of a virtual machine is essentially a volume in the storage, when the cloud platform creates a snapshot for a virtual machine, it will eventually create a snapshot of the storage volume on the storage through the driver.
[0069] Among them, Figure 1 As shown, it is a schematic diagram of the storage snapshot principle provided by an embodiment of the present application. Currently, most storage snapshots are COW (Copy On Write) snapshots, that is, copy-on-write. The principle is that after a snapshot is created for a volume, if the data on the source volume changes, the data before the change will be written to the corresponding position in the snapshot volume, and then the new data will be written to the source volume for overwriting. In this way, the snapshot volume saves the state of the source volume data at the time of creating the snapshot. For example, replace 1, 5, 9 in the source volume with a, b, c. First, copy 1, 5, 9 in the source volume to the snapshot volume, and then use a, b, c to overwrite 1, 5, 9 in the source volume.
[0070] In order to know how much free space is available on the storage to create a volume, the cloud platform obtains the total capacity and allocated capacity of the storage pool through the Cinder driver at regular intervals. The storage pool consists of multiple storage devices. Before creating a new volume or virtual machine, the cloud platform calculates the remaining capacity of the storage pool. If the remaining capacity is less than the size of the new volume to be created, the volume or virtual machine creation fails.
[0071] However, when calculating the allocated capacity of the storage pool, the size of the snapshot volume is taken into account, rather than the actual used capacity of the snapshot volume. As more and more snapshot volumes are created, the allocated capacity of the storage pool will become larger and larger, causing the cloud platform to believe that the available capacity of the storage pool will decrease rapidly, making it impossible to create more virtual machines. For example, if a snapshot is created for a 100G source volume in the storage, the allocated capacity of the storage pool will increase by 100G, even if there is no data in the snapshot volume. Then the cloud platform cannot use this 100G space to create more volumes, resulting in a large amount of storage space being wasted.
[0072] In response to the above problems, the embodiments of the present application provide a storage space detection method, device, electronic device and storage medium, the method comprising: obtaining configuration information of all storage volumes in a storage device; classifying the storage volumes of the storage device according to the configuration information of each storage volume to respectively determine business volumes and non-business volumes; wherein the non-business volumes include at least snapshot volumes; respectively detecting the virtual capacity of each business volume and the real capacity of each non-business volume to obtain the allocated capacity of the storage device; wherein the real capacity is less than the virtual capacity; determining the storage space detection result of the storage device according to the total capacity and the allocated capacity of the storage device. The method provided by the above scheme improves the accuracy of the storage space detection result finally obtained by classifying the storage volumes in the storage device and performing differential capacity detection according to the classification results, laying a foundation for improving the efficiency of creating business virtual machines.
[0073] The following specific embodiments may be combined with each other, and the same or similar concepts or processes may not be described in detail in some embodiments. The embodiments of the present invention will be described below in conjunction with the accompanying drawings.
[0074] First, the structure of the storage space detection system on which this application is based is described:
[0075] The storage space detection method, device, electronic device, and storage medium provided in the embodiments of the present application are suitable for performing storage space detection on each storage device in the storage pool of the cloud platform. Figure 2 The figure is a schematic diagram of the structure of the storage space detection system based on the embodiment of the present application, which mainly includes a storage device, a data acquisition device and a storage space detection device. The data acquisition device is used to collect configuration information of all storage volumes in the storage device and send the collected information to the storage space detection device. The storage space detection device performs corresponding storage space detection operations on the storage device based on the obtained information to obtain the storage space detection result of the storage device.
[0076] The embodiment of the present application provides a storage space detection method for performing storage space detection on each storage device in a storage pool of a cloud platform. The execution subject of the embodiment of the present application is an electronic device, such as a server, a desktop computer, a laptop computer, a tablet computer, and other electronic devices that can be used to perform storage space detection on each storage device in a storage pool of a cloud platform.
[0077] like Figure 3 FIG. 1 is a flow chart of a storage space detection method provided in an embodiment of the present application, the method comprising:
[0078] Step 301: Obtain configuration information of all storage volumes in a storage device.
[0079] Specifically, the configuration information of all storage volumes in the storage device can be obtained through the communication interface with the storage device, wherein the configuration information of the storage volume includes the volume unique identifier, volume size, creation time and storage configuration items.
[0080] Step 302: Classify the storage volumes of the storage device according to the configuration information of each storage volume to respectively determine the business volume and the non-business volume.
[0081] The non-business volume at least includes a snapshot volume.
[0082] Specifically, the storage volumes represented by the configuration information and having normal read and write permissions can be used as business volumes, such as the operating system storage volumes and application storage volumes of the cloud platform, and the snapshot volumes that do not have normal read and write permissions can be used as non-business volumes.
[0083] Step 303: Detect the virtual capacity of each business volume and the real capacity of each non-business volume respectively to obtain the allocated capacity of the storage device.
[0084] Among them, the real capacity is smaller than the virtual capacity.
[0085] It should be noted that virtual capacity is the volume size, that is, virtual capacity is the storage size allocated to the storage volume. Real capacity is the capacity actually occupied by the storage volume to store data. Real capacity is usually smaller than virtual capacity. When the storage volume is full of data, its real capacity is equal to virtual capacity.
[0086] Step 304: Determine the storage space detection result of the storage device according to the total capacity and the allocated capacity of the storage device.
[0087] Specifically, the remaining space of the storage device may be determined according to the difference between the total capacity and the allocated capacity of the storage device, and the storage space detection result includes the remaining space of the storage device.
[0088] Furthermore, when the cloud platform is preparing to create a business virtual machine on the storage device, it can determine whether the storage device meets the conditions for creating the business virtual machine based on the remaining space of the storage device. When the remaining space of the storage device is not less than the space requirement of the business virtual machine, it is determined that the storage device meets the conditions for creating the business virtual machine.
[0089] On the basis of the above embodiments, since the configuration information of the storage volumes in the cloud platform storage pool is diverse, the application scenarios of the storage volumes are also diverse. In order to further improve the accuracy of the storage space detection result, as an implementable method, in one embodiment, according to the configuration information of each storage volume, the storage device is classified into storage volumes to respectively determine the business volume and the non-business volume, including:
[0090] Step 3021: for any storage volume, judging whether the storage volume is configured as a first target volume according to the local replication configuration item of the storage volume; wherein a local replication relationship is established between the first target volume and the source volume;
[0091] Step 3022: when it is determined that the storage volume is configured as the first target volume, judging whether the local replication relationship of the storage volume belongs to a business relationship according to the background copy rate of the storage volume;
[0092] Step 3023, when it is determined that the local replication relationship of the storage volume does not belong to the business relationship, judging whether the storage volume is configured as a second target volume according to the remote replication configuration item of the storage volume; wherein no remote replication relationship is established between the first target volume and the source volume;
[0093] Step 3024: when it is determined that the storage volume is configured as the second target volume, determine whether the storage volume is mounted on the host according to the mount configuration item of the storage volume;
[0094] Step 3025: When it is determined that the storage volume is not mounted on the host, determine that the storage volume is a non-business volume.
[0095] The configuration information of the storage volume includes local replication configuration items, background copy rate, remote replication configuration items, and mount configuration items.
[0096] Accordingly, in one embodiment, when it is determined that the storage volume is mounted on a host, the storage volume is determined to be a business volume.
[0097] The host is used to perform read and write operations on the storage volume.
[0098] Specifically, Figure 4As shown, it is a schematic diagram of the classification process of the storage volume provided by the embodiment of the present application, and the entire classification process can be implemented based on a preset classifier. For any storage volume, first check its local replication configuration item to determine whether the storage volume has a local replication relationship established between the target volume and other storage volumes (source volumes) according to its local replication configuration item, that is, determine whether the storage volume is configured as the first target volume. After determining that the storage volume is the first target volume, further check its background copy rate, and determine whether the local replication relationship of the storage volume belongs to a business relationship according to the background copy rate. Among them, if the background copy rate is 0, it indicates that its local replication relationship does not belong to a business relationship, and if the background copy rate is greater than 0, it indicates that its local replication relationship belongs to a business relationship. Among them, the business relationship includes real-time data backup, etc. To ensure business continuity. When it is determined that the local replication relationship of the storage volume does not belong to a business relationship, further check its remote replication configuration item to determine whether the storage volume has a remote replication relationship established between it and other storage volumes (source volumes). If there is no remote replication relationship, that is, there is only a non-business local replication relationship, then it is determined that the storage volume is configured as the second target volume. Then check its mount configuration item to determine whether the storage volume is mounted on the host. If it is determined that the storage volume is not mounted on the host, it is determined that the storage volume does not participate in the read and write operations of the host, so it is determined that the storage volume is a non-business volume. On the contrary, if it is found that the storage volume is mounted on the host when checking the mount configuration item, it is determined that the storage volume is a business volume.
[0099] Specifically, in one embodiment, when it is determined that the storage volume is not configured as the first target volume, the storage volume is determined to be an application volume; when it is determined that the local replication relationship of the storage volume belongs to a business relationship, the storage volume is determined to be a clone volume; when it is determined that the storage volume is not configured as the second target volume, the storage volume is determined to be a remote replication volume.
[0100] Business volumes include application volumes, clone volumes, and remote replication volumes. Application volumes include the source volumes for creating snapshots, such as the storage volumes of created application virtual machines, and remote replication volumes refer to the primary volumes of active-active volumes or replication volumes.
[0101] It should be noted that the storage volume has a variety of topological structures in application scenarios in the storage pool. In practice, it can be determined whether it is a business volume or a non-business volume based on the topological structure represented by the configuration information.
[0102] For example, Figure 5As shown, it is a schematic diagram of the topological structure of the snapshot scenario provided in the embodiment of the present application. The cloud platform creates a snapshot of storage volume A. In this scenario, a target volume B will be created in the storage, and a snapshot relationship between source volume A and target volume B will be established, that is, target volume B is configured as the first target volume, and storage volume A is not configured as the first target volume. At this time, volume A is used as a business volume, and its virtual capacity needs to be calculated. Target volume B is used as a non-business volume, and its real capacity needs to be calculated.
[0103] For example, Figure 6 As shown, it is a schematic diagram of the topological structure of the cloning scenario provided in the embodiment of the present application. The cloud platform clones the storage volume A. In this scenario, a target volume B will be created in the storage pool, and a clone relationship between the source volume A and the target volume B will be established, that is, the local replication relationship between the target volume B and the storage volume A belongs to the business relationship (clone relationship), and the storage volume is determined to be a clone volume. At this time, both volumes A and B are used as business volumes, and their virtual capacities need to be calculated.
[0104] For example, Figure 7 As shown, it is a schematic diagram of the topological structure of the snapshot rollback scenario provided by the embodiment of the present application. The cloud platform creates a snapshot of storage volume A. In this scenario, a target volume B will be created in the storage pool, and a snapshot relationship between source volume A and target volume B will be established. At the same time, the cloud platform performs the snapshot rollback action, and a clone relationship between target volume B and storage volume A will be established in the storage pool. At this time, although the target volume B has a clone relationship with storage volume A, it is essentially a snapshot volume, so it is still a non-business volume. Storage volume A is a business volume, and its virtual capacity needs to be calculated. For target volume B, its real capacity needs to be calculated.
[0105] For example, Figure 8 As shown, it is a schematic diagram of the topological structure of the remote replication / active-active scenario provided in the embodiment of the present application. The cloud platform creates an active-active volume or a replication volume on the storage pool through the Cinder driver. In this scenario, four volumes will be created in the storage pool, namely, the primary volume A, the secondary volume B, the primary change volume C, and the secondary change volume D. At the same time, a remote replication relationship between the primary volume A and the secondary volume B will be established, that is, the secondary volume B is a remote replication volume, a snapshot relationship between the primary volume A and the primary change volume C will be established, and a snapshot relationship between the secondary volume B and the secondary change volume D will be established. Accordingly, the primary volume A and the secondary volume B are used as business volumes, and the primary change volume C and the secondary change volume D are used as non-business volumes. At this time, for volumes A and B, their virtual capacity needs to be calculated, and for volumes C and D, their real capacity needs to be calculated.
[0106] Among them, the remote replication volume copies the locally stored data to the remote storage device through the network, so that the remote storage device has a data copy that is the same or similar to the local data. Active-active is not a simple data backup and recovery mechanism, but allows two or more storage volumes to be in business status at the same time and can process business at the same time. The active-active volume is displayed as a storage device to the outside, but it is composed of four volumes inside the storage, including the primary volume, the secondary volume, the primary change volume, and the secondary change volume. There is a snapshot relationship between the primary volume and the primary change volume, and there is a snapshot relationship between the secondary volume and the secondary change volume. Generally, no data is stored in the primary change volume and the secondary change volume. However, when the storage calculates the allocated capacity of the storage pool, the size of the primary and secondary change volumes is included in the calculation.
[0107] For example, Fig. 9 As shown, the topological structure diagram of the snapshot volume provided in the embodiment of the present application is a remote replication or dual-active primary volume scenario, such as Fig.10 FIG. 1 is a schematic diagram of a topological structure of a scenario in which a clone volume provided in an embodiment of the present application is a remote replication or active-active primary volume. Fig. 9 and Fig.10 The scene shown is similar to Figure 8 The topological structures shown are similar, except that the primary volume of the remote replication volume or active-active is also a snapshot volume or clone volume of another storage volume. Since the primary volume A has a snapshot volume (primary change volume C) and a remote replication volume (auxiliary volume B), and it is itself the primary volume of the replication volume, even if it is a snapshot volume, it is also used as a business volume, that is, Fig. 9 and Fig.10 The topology shown is similar to Figure 8 The classification results of each storage volume in the topology shown are the same, and the capacity calculation method is also the same.
[0108] For example, Fig.11 As shown, it is a schematic diagram of the topological structure of the snapshot mounting host scenario provided by the embodiment of the present application. The cloud platform creates a snapshot of volume A, that is, the target volume B, and then mounts the snapshot (target volume B) to the virtual machine (cloud virtual host) for read and write operations. In this topological scenario, both volumes A and B are used as business volumes, that is, their virtual capacities are calculated.
[0109] Based on the above embodiment, as an implementable manner, in one embodiment, the virtual capacity of each business volume and the real capacity of each non-business volume are detected respectively to obtain the allocated capacity of the storage device, including:
[0110] Step 3031, detecting the virtual capacity of each service volume to obtain the total virtual capacity of the service volumes in the storage device;
[0111] Step 3032, detecting the real capacity of each non-business volume to obtain the real total capacity of the non-business volumes in the storage device;
[0112] Step 3033: Add the virtual total capacity and the real total capacity to obtain the allocated capacity of the storage device.
[0113] Specifically, the virtual capacity of each business volume and the real capacity of each non-business volume may be obtained by calling a command.
[0114] Specifically, Fig.12 As shown, it is a schematic diagram of the overall process of the storage space detection method provided in an embodiment of the present application. First, all storage volumes of each storage device in the storage pool are obtained, and each storage volume is traversed to classify based on the classifier to determine whether each storage volume is a business volume. In the case where the storage volume is a business volume, its virtual capacity is obtained, otherwise, its real capacity is obtained. Finally, the total virtual capacity and the total real capacity are accumulated to obtain the allocated capacity of each storage device, that is, the allocated capacity of the storage pool.
[0115] Based on the above embodiment, as an implementable manner, in one embodiment, determining the storage space detection result of the storage device according to the total capacity and the allocated capacity of the storage device includes:
[0116] Step 3041, determining the remaining service virtual machine creation resources of the storage device according to the total capacity and the allocated capacity of the storage device;
[0117] The storage space detection result includes the remaining business virtual machine creation resources of the storage device.
[0118] Specifically, in one embodiment, the remaining service virtual machine creation resources of the storage device may be determined based on the following formula:
[0119] A=T×r–P
[0120] Wherein, A represents the remaining service virtual machine creation resources of the storage device, T represents the total capacity of the storage device, r represents the preset super-resolution parameter, and P represents the allocated capacity of the storage device.
[0121] It should be noted that the remaining business virtual machine creation resources determined based on the preset super-resolution parameters can make the total storage resources that can be allocated to the cloud platform to create business virtual machines greater than the total number of physical resources actually available. Since the storage resources that a storage device can actually provide are often greater than its calibrated rated storage resources (the total capacity T of the storage device), the embodiment of the present application uses super-resolution computing to enable the cloud platform to create more volumes or virtual machines.
[0122] Among them, when the preset super-resolution parameters are set unreasonably, it may indeed cause virtual machine creation failures. For example, if the preset super-resolution parameters are too high and exceed the actual limit that the storage device can bear, when multiple virtual machines are created at the same time, there may be insufficient storage space, resulting in the inability to create or run the virtual machines normally.
[0123] Specifically, in order to solve the above technical problems, the performance test of the storage device can be carried out, including sequential read and write test, random read and write test, etc., to obtain the performance index of the storage device. For example, through professional storage performance test tools, the parameters such as read and write speed and IOPS of the storage device under different loads are measured. Then, according to the performance test results, the preset super-resolution parameters are determined to ensure that the preset super-resolution parameters used are proportional to the performance of the storage device, so that the preset super-resolution parameters are dynamically adjusted with the actual performance of the storage device, so as to ensure the reliability of the determination result of the remaining business virtual machine creation resources of the storage device.
[0124] The storage space detection method provided in the embodiment of the present application obtains the configuration information of all storage volumes in the storage device; classifies the storage volumes of the storage device according to the configuration information of each storage volume to respectively determine the business volume and the non-business volume; wherein the non-business volume includes at least a snapshot volume; respectively detects the virtual capacity of each business volume and the real capacity of each non-business volume to obtain the allocated capacity of the storage device; wherein the real capacity is less than the virtual capacity; and determines the storage space detection result of the storage device according to the total capacity and the allocated capacity of the storage device. The method provided by the above scheme improves the accuracy of the storage space detection result obtained in the end by classifying the storage volumes in the storage device and performing differential capacity detection according to the classification results, laying a foundation for improving the efficiency of creating business virtual machines. In addition, through a more refined storage space calculation method with multiple dimensions, the cloud platform can create more volume resources in the storage pool to make more effective use of the storage space, thereby reducing the usage cost of cloud platform users.
[0125] An embodiment of the present application provides a storage space detection device, which is used to execute the storage space detection method provided in the above embodiment.
[0126] like Fig.13 , which is a schematic diagram of the structure of a storage space detection device provided in an embodiment of the present application. The storage space detection device 130 comprises: an acquisition module 1301 , a classification module 1302 , a detection module 1303 and a determination module 1304 .
[0127] Among them, the acquisition module is used to obtain the configuration information of all storage volumes in the storage device; the classification module is used to classify the storage volumes of the storage device according to the configuration information of each storage volume, so as to respectively determine the business volume and the non-business volume; wherein the non-business volume at least includes the snapshot volume; the detection module is used to respectively detect the virtual capacity of each business volume and the real capacity of each non-business volume to obtain the allocated capacity of the storage device; wherein the real capacity is smaller than the virtual capacity; the determination module is used to determine the storage space detection result of the storage device according to the total capacity and the allocated capacity of the storage device.
[0128] Regarding the storage space detection device in this embodiment, the specific manner in which each module performs operations has been described in detail in the embodiment of the method, and will not be elaborated here.
[0129] The storage space detection device provided in the embodiment of the present application is used to execute the storage space detection method provided in the above embodiment. Its implementation method and principle are the same and will not be repeated here.
[0130] An embodiment of the present application provides an electronic device for executing the storage space detection method provided in the above embodiment.
[0131] like Fig.14 1 is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application. The electronic device 140 includes: at least one processor 1401 and a memory 1402.
[0132] The memory stores computer-executable instructions; at least one processor executes the computer-executable instructions stored in the memory, so that the at least one processor executes the storage space detection method provided in the above embodiment.
[0133] The electronic device provided in the embodiment of the present application is used to execute the storage space detection method provided in the above embodiment. Its implementation method and principle are the same and will not be repeated here.
[0134] An embodiment of the present application provides a computer-readable storage medium, in which computer-executable instructions are stored. When a processor executes the computer-executable instructions, the storage space detection method provided in any of the above embodiments is implemented.
[0135] The storage medium containing computer executable instructions provided in the embodiments of the present application can be used to store computer executable instructions of the storage space detection method provided in the aforementioned embodiments. The implementation method and principle are the same and will not be repeated here.
[0136] An embodiment of the present application provides a computer program product, including computer instructions, which are used to enable a computer to execute the storage space detection method provided in the aforementioned embodiment.
[0137] The embodiments of the present application provide a computer program product that can be used to execute computer instructions of the storage space detection method provided in the aforementioned embodiments. The implementation method and principle are the same and will not be repeated here.
[0138] In the several embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0139] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0140] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of hardware plus software functional units.
[0141] The above-mentioned integrated unit implemented in the form of a software functional unit can be stored in a computer-readable storage medium. The above-mentioned software functional unit 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.) or a processor to perform some steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM), random access memory (RAM), disk or optical disk and other media that can store program code.
[0142] A part of the present application may be applied as a computer program product, such as a computer program instruction, which, when executed by a computer, can call or provide the method and / or technical solution according to the present invention through the operation of the computer. Those skilled in the art should understand that the existence of computer program instructions in computer-readable media includes, but is not limited to, source files, executable files, installation package files, etc., and accordingly, the way in which computer program instructions are executed by a computer includes, but is not limited to: the computer directly executes the instruction, or the computer compiles the instruction and then executes the corresponding compiled program, or the computer reads and executes the instruction, or the computer reads and installs the instruction and then executes the corresponding installed program. Here, the computer-readable medium can be any available computer-readable storage medium or communication medium accessible to the computer.
[0143] Those skilled in the art can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional modules is used as an example for illustration. In actual applications, the above-mentioned functions can be assigned to different functional modules as needed, that is, the internal structure of the device is divided into different functional modules to complete all or part of the functions described above. The specific working process of the device described above can refer to the corresponding process in the aforementioned method embodiment, and will not be repeated here.
[0144] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit it. Although the present application 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 replace some or all of the technical features therein with equivalents. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present application.
Claims
1. A storage space detection method, characterized in that: include: Get the configuration information of all storage volumes in the storage device; Classifying the storage volumes of the storage device according to the configuration information of each storage volume to respectively determine business volumes and non-business volumes; wherein the non-business volumes at least include snapshot volumes; Respectively detecting the virtual capacity of each of the business volumes and the real capacity of each of the non-business volumes to obtain the allocated capacity of the storage device; wherein the real capacity is smaller than the virtual capacity; A storage space detection result of the storage device is determined according to the total capacity of the storage device and the allocated capacity.
2. The method according to claim 1, characterized in that The classifying the storage volumes of the storage device according to the configuration information of each storage volume to respectively determine the business volume and the non-business volume includes: For any of the storage volumes, judging whether the storage volume is configured as a first target volume according to the local replication configuration item of the storage volume; wherein a local replication relationship is established between the first target volume and the source volume; In the case where it is determined that the storage volume is configured as the first target volume, judging whether the local replication relationship of the storage volume belongs to a business relationship according to the background copy rate of the storage volume; In the case where it is determined that the local replication relationship of the storage volume does not belong to a business relationship, judging whether the storage volume is configured as a second target volume according to the remote replication configuration item of the storage volume; wherein no remote replication relationship is established between the first target volume and the source volume; In the case of determining that the storage volume is configured as the second target volume, judging whether the storage volume is mounted on the host according to the mounting configuration item of the storage volume; When it is determined that the storage volume is not mounted on the host, determining that the storage volume is a non-business volume; The configuration information of the storage volume includes the local replication configuration item, the background copy rate, the remote replication configuration item and the mount configuration item.
3. The method according to claim 2, characterized in that The method further comprises: When it is determined that the storage volume is mounted on a host, determining that the storage volume is a business volume; The host is used to perform read and write operations on the storage volume.
4. The method according to claim 2, characterized in that: The method further comprises: In the case of determining that the storage volume is not configured as the first target volume, determining that the storage volume is an application volume; In the case where it is determined that the local replication relationship of the storage volume belongs to a business relationship, determining that the storage volume is a clone volume; In the case where it is determined that the storage volume is not configured as the second target volume, determining that the storage volume is a remote replication volume; The business volume includes the application volume, clone volume and remote replication volume.
5. The method according to claim 1, characterized in that: The detecting the virtual capacity of each of the business volumes and the real capacity of each of the non-business volumes respectively to obtain the allocated capacity of the storage device includes: Detecting the virtual capacity of each of the business volumes to obtain the total virtual capacity of the business volumes in the storage device; Detecting the actual capacity of each of the non-business volumes to obtain the actual total capacity of the non-business volumes in the storage device; The virtual total capacity and the real total capacity are accumulated to obtain the allocated capacity of the storage device.
6. The method according to claim 1, characterized in that The step of determining the storage space detection result of the storage device according to the total capacity of the storage device and the allocated capacity includes: Determine remaining service virtual machine creation resources of the storage device according to the total capacity of the storage device and the allocated capacity; The storage space detection result includes remaining business virtual machine creation resources of the storage device.
7. The method according to claim 6, characterized in that The determining, according to the total capacity of the storage device and the allocated capacity, remaining service virtual machine creation resources of the storage device includes: The remaining service virtual machine creation resources of the storage device are determined based on the following formula: A=T×r–P Among them, A represents the remaining business virtual machine creation resources of the storage device, T represents the total capacity of the storage device, r represents the preset super-resolution parameter, and P represents the allocated capacity of the storage device.
8. A storage space detection device, characterized in that: include: The acquisition module is used to obtain the configuration information of all storage volumes in the storage device; A classification module, used for classifying storage volumes of the storage device according to the configuration information of each storage volume, so as to respectively determine business volumes and non-business volumes; wherein the non-business volumes at least include snapshot volumes; A detection module, used to detect the virtual capacity of each business volume and the real capacity of each non-business volume respectively, to obtain the allocated capacity of the storage device; wherein the real capacity is smaller than the virtual capacity; The determination module is used to determine the storage space detection result of the storage device according to the total capacity of the storage device and the allocated capacity.
9. An electronic device, characterized in that: include: at least one processor and memory; The memory stores computer-executable instructions; The at least one processor executes the computer-executable instructions stored in the memory, so that the at least one processor performs the method according to any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-executable instructions, and when a processor executes the computer-executable instructions, the method according to any one of claims 1 to 7 is implemented.