Method and application for making the allocated space of a virtual disk consistent in a cloud computing environment

By creating and marking space allocation units in a cloud computing environment, the problem of inconsistent physical space allocation of virtual disks is solved, and resource savings are achieved in the case of power failure.

CN116225711BActive Publication Date: 2025-08-05ANCHAO CLOUD SOFTWARE CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202310236580.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-03-13
Publication Date
2025-08-05
Estimated Expiration
2043-03-13

AI Technical Summary

Technical Problem

In a cloud computing environment, the physical space allocation of virtual disks is inconsistent, resulting in waste of space. Especially in the event of unexpected power failure, the cluster fails to record local space allocation in time, resulting in waste of resources.

Method used

By creating a space allocation unit and adding a mark when the cluster receives IO, returning the replica path to record it to the cluster database, and performing corresponding operations locally, ensuring that unrecorded space allocation units are deleted in the event of power outage, avoiding duplicate allocation.

Benefits of technology

Without adding additional IO, ensure that the physical space allocation of virtual disks is consistent, avoiding waste of space and saving resources.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116225711B_ABST
    Figure CN116225711B_ABST
Patent Text Reader

Abstract

The present invention discloses a method and application for ensuring consistent allocation space for virtual disks in a cloud computing environment. The method comprises the following steps: a virtual disk cluster receives an IO; if the space allocation unit corresponding to the IO is not found in the cluster database, a signal to create the space allocation unit is sent to the local computer, and the IO is placed in a retransmission queue; upon receiving the signal, the local computer creates a new space allocation unit and adds new_created and create_at tags to the space allocation unit. After creation, a copy path of the space allocation unit is returned to the cluster; the cluster receives the copy path and records it in the cluster database; the cluster removes the IO from the retransmission queue and sends it to the local computer, which then records it in a journal; and if the local computer checks and finds that the space allocation unit has the new_created tag, the new_created tag is deleted from memory. This method ensures that the physical space corresponding to the virtual disk is correctly allocated, avoiding space waste.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of electronic communications, and in particular to a method and application for making the allocated space of a virtual disk consistent in a cloud computing environment. Background Art

[0002] In cloud computing environments, users generally don't directly use physical disks to store content. This is because physical disk damage can result in data loss, disrupting business operations. To avoid single points of failure, cloud computing uses virtual disks to mitigate business interruptions caused by physical disk damage. Virtual disks avoid single points of failure by splitting data across multiple disks.

[0003] In the prior art, a virtual disk consists of two main parts: a cluster portion and a local portion. The cluster portion primarily stores the virtual disk's metadata. The metadata involved in this invention primarily consists of the replica path, which refers to the value used to locate the physical location of the data. The local portion primarily provides actual data storage space and returns the local location of the data to the cluster.

[0004] Assume that the address space of a virtual disk is divided into 1GB blocks. Each 1GB block is called an extent group. An extent group is the smallest unit of space allocation at the cluster level. Each extent group consists of multiple replicas, each with its own replica path. Because a portion of the replica path is provided locally, possibly on a different physical computer, it's possible that a power outage could occur after space is allocated locally, resulting in the cluster not yet registering the allocated space, wasting space.

[0005] The information disclosed in this background technology section is only intended to enhance understanding of the overall background of the invention and should not be regarded as an admission or any form of suggestion that the information constitutes the prior art already known to a person skilled in the art. Summary of the Invention

[0006] The purpose of the present invention is to provide a method and application for making the allocated space of virtual disks consistent in a cloud computing environment, which can ensure that the physical space corresponding to the virtual disk can be correctly allocated and avoid space waste.

[0007] To achieve the above objectives, an embodiment of the present invention provides a method for making the allocated space of a virtual disk consistent in a cloud computing environment.

[0008] In one or more embodiments of the present invention, the method for disk space allocation includes: S1: the cluster of the virtual disk receives IO, and if the space allocation unit corresponding to the IO is not found in the cluster database, a signal for creating the space allocation unit is sent to the local of the virtual disk, and the IO is placed in a retransmission queue; S2: after the local receives the signal for creating the space allocation unit, a new space allocation unit is created, and new_created and create_at tags are added to the space allocation unit. After the creation is completed, a copy path of the space allocation unit is returned to the cluster, wherein the new_created tag indicates that the space allocation unit is a newly created space allocation unit, and the create_at tag indicates the creation time point of the space allocation unit; S3: the cluster receives the copy path and records the copy path in the cluster database; S4: the cluster takes the IO out of the retransmission queue, and sends the IO to the local according to the copy path. After the IO arrives at the local, it is recorded in the journal; S5: if the local checks and finds that the space allocation unit has a new_created tag, the new_created tag is deleted in the memory after the IO is completed.

[0009] In one or more embodiments of the present invention, if a power outage occurs after step S2 is completed, the method includes: after power is restored, traversing the local space allocation units to find the space allocation unit with the new_created mark; comparing the current time point of the space allocation unit and the time point corresponding to the create_at mark of the space allocation unit to obtain the time difference; if the time difference is greater than the maximum IO delay, deleting the space allocation unit and returning to step S1.

[0010] In one or more embodiments of the present invention, if a power outage occurs after step S3 is completed and before step S5 is completed, the method further includes: after power is restored, comparing the local space allocation unit and the maximum IO delay; if the IO of the space allocation unit is within the maximum IO delay, performing step S4; if the IO of the space allocation unit exceeds the maximum IO delay, deleting the copy path of the space allocation unit in the cluster database and returning to step S1.

[0011] In one or more embodiments of the present invention, if a power outage occurs before step S2 is completed, steps S1 to S5 are performed normally after power is restored.

[0012] In one or more embodiments of the present invention, the method further includes: when a journal is checked, the data in the memory is updated to the virtual disk.

[0013] In one or more embodiments of the present invention, if a power outage occurs after step S5 is completed and before the journal completes the checkpoint, the method is characterized in that: after power is restored, the new_created mark is reloaded into the memory and the memory reloads the IO from the journal; and when the IO is executed, the new_created mark of the space allocation unit corresponding to the IO is deleted in the memory.

[0014] In another aspect of the present invention, a device for making allocated space of a virtual disk consistent in a cloud computing environment is provided, which includes a detection module, a creation module, a recording module, a sending module and a first deletion module.

[0015] The detection module is used for the cluster of the virtual disk to receive IO. If the space allocation unit corresponding to the IO is not found in the cluster database, a signal for creating the space allocation unit is sent to the local of the virtual disk and the IO is put into a retransmission queue.

[0016] A creation module is used to create a new space allocation unit after locally receiving the signal for creating the space allocation unit, and add new_created and create_at tags to the space allocation unit. After the creation is completed, the copy path of the space allocation unit is returned to the cluster, wherein the new_created tag indicates that the space allocation unit is a newly created space allocation unit, and the create_at tag indicates the creation time point of the space allocation unit.

[0017] The recording module is configured to receive the replica path from the cluster and record the replica path in the cluster database.

[0018] The sending module is used for the cluster to take out the IO from the resending queue and send the IO to the local according to the replica path. After the IO arrives at the local, it is recorded in the journal.

[0019] The first deletion module is configured to delete the new_created tag in the memory after the IO is completed if the local check finds that the space allocation unit has a new_created tag.

[0020] In one or more embodiments of the present invention, the apparatus further comprises: a search module configured to traverse local space allocation units and search for space allocation units with a new_created tag.

[0021] The comparison module is used to compare the current time point of finding the space allocation unit with the time point corresponding to the create_at tag of the space allocation unit to obtain a time difference.

[0022] The second deleting module is configured to delete the space allocation unit if the time difference is greater than the maximum IO delay.

[0023] In one or more embodiments of the present invention, the apparatus further includes: a third deletion module, configured to delete the replica path of the space allocation unit in the cluster database if the IO of the space allocation unit exceeds the maximum IO delay.

[0024] In one or more embodiments of the present invention, the sending module is further configured to update the data in the memory to the virtual disk when a checkpoint is performed on the journal.

[0025] In one or more embodiments of the present invention, the first deletion module is further used to: after power is restored, the new_created mark is reloaded into the memory and the memory reloads the IO from the journal; and when executing the IO, the new_created mark of the space allocation unit corresponding to the IO is deleted in the memory.

[0026] In another aspect of the present invention, an electronic device is provided, comprising: at least one processor; and a memory, wherein the memory stores instructions, which, when executed by the at least one processor, enable the at least one processor to execute the method for making the allocated space of a virtual disk consistent in a cloud computing environment as described above.

[0027] In another aspect of the present invention, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps of making the allocated space of the virtual disk consistent in the cloud computing environment are implemented.

[0028] Compared with the prior art, the method and application for making the allocated space of virtual disks consistent in a cloud computing environment according to an embodiment of the present invention can solve the problem that in the event of an unexpected power outage, local space allocation is completed but the cluster has not yet recorded it. Without adding additional IO, by deleting space allocation units or copy paths under different power outage conditions, the virtual disk has no extra space allocated in the event of an unexpected power outage, avoiding space waste and saving physical space resources corresponding to the virtual disk. BRIEF DESCRIPTION OF THE DRAWINGS

[0029] Figure 1 is a flow chart of a method for making allocated space of a virtual disk consistent in a cloud computing environment according to an embodiment of the present invention;

[0030] Figure 2is a structural diagram of a method for making allocated space of a virtual disk consistent in a cloud computing environment according to an embodiment of the present invention;

[0031] Figure 3 is a specific flow chart of a method for making the allocated space of a virtual disk consistent in a cloud computing environment according to an embodiment of the present invention;

[0032] Figure 4 is a specific flow chart of a method for making the allocated space of a virtual disk consistent in a cloud computing environment according to an embodiment of the present invention;

[0033] Figure 5 is a structural diagram of an apparatus for making allocated space of a virtual disk consistent in a cloud computing environment according to an embodiment of the present invention;

[0034] Figure 6 is a structural diagram of an apparatus for making allocated space of a virtual disk consistent in a cloud computing environment according to an embodiment of the present invention;

[0035] Figure 7 The figure is a hardware structure diagram of a computing device for making the allocated space of a virtual disk consistent in a cloud computing environment according to one embodiment of the present invention. DETAILED DESCRIPTION

[0036] The specific embodiments of the present invention are described in detail below with reference to the accompanying drawings, but it should be understood that the protection scope of the present invention is not limited by the specific embodiments.

[0037] Unless expressly stated otherwise, throughout the specification and claims, the term "comprise" or variations such as "include" or "comprising", etc., will be understood to include the stated elements or components but not to exclude other elements or other components.

[0038] The technical solutions provided by various embodiments of the present invention are described in detail below with reference to the accompanying drawings.

[0039] Example 1

[0040] like Figure 1 and Figure 2 As shown, a method for allocating disk space to make the allocated space of virtual disks consistent in a cloud computing environment in one embodiment of the present invention is introduced.

[0041] In step S101, the cluster of the virtual disk receives an IO. If the space allocation unit corresponding to the IO is not found in the cluster database, a signal for creating a space allocation unit is sent to the local virtual disk, and the IO is placed in a retransmission queue.

[0042] IO, also known as I / O (Input / Output), refers to input and output operations, such as reading / writing a certain area of the disk.

[0043] In this embodiment, the case where the space allocation unit corresponding to the IO does not exist is handled. When the space allocation unit corresponding to the IO exists, the IO can be sent to the local server according to the replica path. The space allocation unit in this embodiment is the extentgroup, which refers to the minimum space allocation unit at the cluster level.

[0044] In step S102, after the local receives the signal for creating the space allocation unit, a new space allocation unit is created, and new_created and create_at tags are added to the space allocation unit. After the creation is completed, the copy path of the space allocation unit is returned to the cluster, where the new_created tag indicates that the space allocation unit is a newly created space allocation unit, and the create_at tag indicates the creation time point of the space allocation unit.

[0045] Specifically, the locally created new extent group is an extent group with new_created and create_at tags, wherein the new_created tag indicates that the created extent group is a newly created extent group, and the create_at tag indicates the creation time point of the created extent group.

[0046] Furthermore, if a power outage occurs before step S102 is completed, steps S101 to S105 proceed normally. In other words, an unexpected power outage before extent groups are created is safe because all operations up to this point are performed in memory, and no data is stored in the cluster database or locally. Therefore, a power outage at this time will not cause inconsistencies in the virtual disk's allocated space.

[0047] In step S103 , the cluster receives the replica path and records the replica path in the cluster database.

[0048] Specifically, each extent group consists of multiple replicas, typically two or three, and each replica has its own replica path, part of which is provided locally. The cluster is responsible for recording the replica path of the extent group in the cluster database.

[0049] In step S104, the cluster takes the IO out of the retransmission queue and sends the IO to the local according to the replica path. After the IO arrives at the local, it is recorded in the journal.

[0050] Specifically, after the local receives the IO sent by the cluster, it provides actual storage space for the data.

[0051] In this embodiment, when the journal is checked, the data in the memory is updated to the virtual disk.

[0052] In the process of updating the data in the memory to the disk, the deletion mark operation will be persisted.

[0053] Specifically, journal refers to a system that records all uncommitted IO in sequence to a persistent medium to ensure data consistency. A checkpoint is a database event that writes modified data from the cache to disk and updates the control file and data files.

[0054] Furthermore, after I / O arrives locally, it is first persisted to the journal, where each I / O is recorded. This I / O is used to handle unexpected power outages and cannot be used to read data. When the journal performs a checkpoint, all in-memory data is updated to the virtual disk. Because checkpoints are part of the journal mechanism, no new I / O is introduced.

[0055] Journal checkpointing occurs throughout the entire IO execution process, and is performed at regular intervals based on demand and actual conditions. When the journal checkpoint is completed, the IO in the journal will be deleted.

[0056] In step S105, if the local check finds that the space allocation unit has a new_created tag, the new_created tag is deleted in the memory after the IO is completed.

[0057] In this embodiment, the allocated space of the virtual disk is made consistent in the cloud computing environment, that is, the locally allocated space of the virtual disk is made consistent with the path recorded in the cluster database.

[0058] In this embodiment, an unexpected power outage occurs after the new_created mark is deleted from the memory. At this time, the content recorded in the cluster database and the locally allocated space have reached consistency, so the unexpected power outage does not affect the disk space allocation.

[0059] Furthermore, if a power outage occurs after step S105 is completed and before the journal completes the checkpoint, after power is restored, the new_created mark is reloaded into the memory and the memory reloads the IO from the journal; and when the IO is executed, the new_created mark of the space allocation unit corresponding to the IO is deleted in the memory.

[0060] To avoid adding extra IO, step S105 simply deletes the new_created marker from memory. When a power outage occurs and power is restored, the memory reloads the IO from the journal. When the IO is re-executed, the new_created marker is also re-loaded into memory. After the new_created marker is re-loaded into memory, the IO is re-executed, and the unused extent group can be released normally. The persistence of the delete marker operation is completed when the journal is checkpointed.

[0061] If an unexpected power outage occurs before the journal checkpoint is completed, the journal will execute all IOs before the checkpoint, so the operation of deleting the new_created mark will also be re-executed, that is, the new_created mark of the extent group corresponding to the IO will be deleted in memory.

[0062] Example 2

[0063] like Figure 3 As shown, a method for making the allocation space of a virtual disk consistent in a cloud computing environment in one embodiment of the present invention is introduced.

[0064] In this embodiment, a method for making the allocated space of the virtual disk consistent when a power outage occurs after step S102 is completed is specifically described. Steps S301 to S304 of this embodiment are all performed after a power outage occurs and power is restored when step S102 has been completed but step S103 has not yet been completed.

[0065] In step S301, after power is restored, the local space allocation units are traversed to find the space allocation units with the new_created mark.

[0066] Specifically, after power is restored, because the unexpected power outage occurred before the replica path was recorded, the cluster database does not yet have a record of the newly created space allocation unit, the extent group. Therefore, the corresponding area's I / O will create a new extent group, resulting in a space leak and duplicate space allocation. However, before the unexpected power outage, the new_created flag of the newly created extent group has not been deleted. Therefore, it can be processed by traversing all local extent groups to find the extent group with the new_created flag.

[0067] In step S302, the current time point of the space allocation unit is compared with the time point corresponding to the create_at tag of the space allocation unit to obtain a time difference.

[0068] In this embodiment, the extent group found with the new_created tag also has the create_at tag. By comparing the current time point with the time point corresponding to the carry-carry create_at tag, the time difference between the two can be obtained.

[0069] In step S303, if the time difference is greater than the maximum IO delay, the space allocation unit is deleted and the process returns to step S101.

[0070] In this embodiment, if the difference between the current time point and the time point corresponding to the carry-in create_at tag is greater than the maximum IO latency, indicating that the extent group has been leaked due to an unexpected power outage, the extent group is deleted. The leaked space is now successfully reclaimed, and the entire process can proceed normally. After completing this step, the process returns to step S101 and continues with steps S101 to S105.

[0071] Specifically, if the difference between the current time point and the time point corresponding to the carried create_at tag is not greater than the maximum IO delay, the extent group is placed until the time difference is greater than the maximum IO delay, at which time the extent group is deleted.

[0072] Furthermore, the operation of deleting the extent group is performed by other corresponding systems. For example, if the extent group is a file type, the unlink system of the file system is called to perform the operation of deleting the extent group.

[0073] Example 3

[0074] like Figure 4As shown, a method for making the allocation space of a virtual disk consistent in a cloud computing environment in one embodiment of the present invention is introduced.

[0075] In this embodiment, a method for ensuring consistent virtual disk allocation space in the event of a power outage after step S103 is completed and before step S105 is completed is specifically described. Steps S401 to S403 of this embodiment are all performed after a power outage occurs and power is restored after step S103 has completed and step S105 has not yet completed.

[0076] In step S401, after power is restored, the local space allocation unit is compared with the maximum IO delay.

[0077] In this embodiment, if a power outage occurs after the cluster completes recording the replica path and before the new_created mark of the local space allocation unit extentgroup is deleted, the IO and maximum IO delays of the local extentgroup are compared after power is restored.

[0078] In step S402, if the IO of the space allocation unit is within the maximum IO delay, step S104 is performed.

[0079] Specifically, when the extent group's IO appears within the maximum IO delay, it means that the extent group created before the unexpected power failure still exists, so the IO can be issued smoothly, and subsequent operations can continue normally, and steps S104 and S105 are performed normally.

[0080] In step S403, if the IO of the space allocation unit exceeds the maximum IO delay, the copy path of the space allocation unit in the cluster database is deleted, and the process returns to step S101.

[0081] Specifically, if an extent group's IO exceeds the maximum IO latency, it indicates that the extent group created before the unexpected power outage no longer exists. However, the cluster can only query the cluster database, not the local database. Therefore, the cluster is unaware that the local extent group no longer exists and will continue to issue the IO. When the IO reaches the local database, the local database will return an error indicating that the extent group does not exist. Therefore, the cluster directly deletes the replica path corresponding to the extent group in the cluster database, repeats step S101, and continues with steps S101 through S105.

[0082] In fact, the cluster can query whether the local extent group exists by calling the local API, but this operation requires each IO to query, which will greatly reduce the performance of the system. This embodiment will not elaborate on this situation for the time being.

[0083] Furthermore, after the cluster completes recording the replica path corresponding to the extent group in the cluster database, the cluster database may become unavailable. In this case, the IO will be directly handled as an IO error, and the local extent group will eventually be deleted because it carries the new_created value. The cluster database also has no record of this replica path, so the content recorded in the cluster database and the locally allocated space will remain consistent.

[0084] According to the method for making the allocated space of virtual disks consistent in a cloud computing environment in accordance with an embodiment of the present invention, it is possible to solve the problem that in the event of an unexpected power outage, local space allocation is completed but the cluster has not yet recorded it. Without adding additional IO, by deleting space allocation units or copy paths under different power outage conditions, no extra space is allocated to the virtual disk in the event of an unexpected power outage, thereby avoiding space waste and saving physical space resources corresponding to the virtual disk.

[0085] In all the above embodiments, the power failure situation includes a system power failure situation or a single host power failure situation. The present invention aims to solve the problem of data inconsistency in any power failure situation.

[0086] It should be noted that steps S101, S102, etc. defined in the present invention are only for the convenience of description, and are not used to limit the execution order of the steps. Without affecting the essence of the present invention, the present invention can also be implemented by changing the order of some steps.

[0087] like Figure 5 and Figure 6 As shown, a device for making the allocated space of a virtual disk consistent in a cloud computing environment according to a specific embodiment of the present invention is introduced.

[0088] In an embodiment of the present invention, the apparatus for making the allocated space of a virtual disk consistent in a cloud computing environment includes a detection module 501 , a creation module 502 , a recording module 503 , a sending module 504 and a first deletion module 505 .

[0089] The detection module 501 is used for the virtual disk cluster to receive IO. If the space allocation unit corresponding to the IO is not found in the cluster database, a signal for creating a space allocation unit is sent to the local virtual disk and the IO is put into a retransmission queue.

[0090] The creation module 502 is used to create a new space allocation unit after receiving the signal for creating the space allocation unit locally, and add new_created and create_at tags to the space allocation unit. After the creation is completed, the copy path of the space allocation unit is returned to the cluster, wherein the new_created tag indicates that the space allocation unit is a newly created space allocation unit, and the create_at tag indicates the creation time point of the space allocation unit.

[0091] The recording module 503 is configured for the cluster to receive the replica path and record the replica path in the cluster database.

[0092] The sending module 504 is used for the cluster to take the IO from the resending queue and send the IO to the local according to the replica path. After the IO arrives at the local, it is recorded in the journal.

[0093] The first deleting module 505 is configured to delete the new_created tag in the memory after the IO is completed if the local check finds that the space allocation unit has a new_created tag.

[0094] The sending module 504 is further configured to update the data in the memory to the virtual disk when the journal is checked.

[0095] The first deletion module 505 is further configured to: after power is restored, reload the new_created tag into the memory and reload the IO from the journal; and delete the new_created tag of the space allocation unit corresponding to the IO in the memory when executing the IO.

[0096] In an embodiment of the present invention, the apparatus for making the allocated space of virtual disks consistent in a cloud computing environment further includes a search module 601 , a comparison module 602 , a second deletion module 603 and a third deletion module 604 .

[0097] The search module 601 is used to traverse the local space allocation units and search for the space allocation units with the new_created mark.

[0098] The comparison module 602 is configured to compare the current time point of the space allocation unit and the time point corresponding to the create_at tag of the space allocation unit to obtain a time difference.

[0099] The second deleting module 603 is configured to delete the space allocation unit if the time difference is greater than the maximum IO delay.

[0100] The third deletion module 604 is configured to delete the copy path of the space allocation unit in the cluster database if the IO of the space allocation unit exceeds the maximum IO delay.

[0101] Figure 7 FIG. 7 shows a hardware structure diagram of a computing device 70 for making the allocation space of a virtual disk consistent in a cloud computing environment according to an embodiment of the present specification. Figure 7 As shown, the computing device 70 may include at least one processor 701, a memory 702 (e.g., a non-volatile memory), a storage 703, and a communication interface 704, and the at least one processor 701, the memory 702, the storage 703, and the communication interface 704 are connected together via a bus 705. The at least one processor 701 executes at least one computer-readable instruction stored or encoded in the storage 702.

[0102] It should be understood that the computer executable instructions stored in the memory 702, when executed, cause the at least one processor 701 to perform the above combined operations in the various embodiments of this specification. Figure 1-7 Describes the various operations and functions.

[0103] In the embodiments of the present specification, the computing device 70 may include, but is not limited to, a personal computer, a server computer, a workstation, a desktop computer, a laptop computer, a notebook computer, a mobile computing device, a smart phone, a tablet computer, a cellular phone, a personal digital assistant (PDA), a handheld device, a messaging device, a wearable computing device, a consumer electronic device, and the like.

[0104] According to one embodiment, a program product such as a machine-readable medium is provided. The machine-readable medium may have instructions (i.e., the above-mentioned elements implemented in software form), which, when executed by a machine, causes the machine to perform the above-mentioned combined embodiments of the present specification. Figure 1-7 Specifically, a system or device equipped with a readable storage medium can be provided, on which software program codes for implementing the functions of any of the above-mentioned embodiments are stored, and a computer or processor of the system or device can be enabled to read and execute the instructions stored in the readable storage medium.

[0105] According to the method for making the allocated space of virtual disks consistent in a cloud computing environment in accordance with an embodiment of the present invention, it is possible to solve the problem that in the event of an unexpected power outage, local space allocation is completed but the cluster has not yet recorded it. Without adding additional IO, by deleting space allocation units or copy paths under different power outage conditions, no extra space is allocated to the virtual disk in the event of an unexpected power outage, thereby avoiding space waste and saving physical space resources corresponding to the virtual disk.

[0106] It will be understood by those skilled in the art that embodiments of the present invention may be provided as methods, systems, or computer program products. Thus, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment combining software and hardware. Furthermore, the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to magnetic disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0107] The present invention is described with reference to flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowcharts and / or block diagrams, as well as combinations of processes and / or blocks in the flowcharts and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowcharts and / or block diagrams. Figure 1 a process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0108] These computer program instructions may also be stored in a computer readable memory that can direct a computer or other programmable data processing device to work in a specific manner, so that the instructions stored in the computer readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 a process or multiple processes and / or boxes Figure 1 The function specified in one or more boxes.

[0109] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operational steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing the instructions executed on the computer or other programmable device for implementing the process. Figure 1 a process or multiple processes and / or boxes Figure 1 The steps for the function specified in one or more boxes.

[0110] The foregoing descriptions of specific exemplary embodiments of the present invention are for purposes of illustration and description. These descriptions are not intended to limit the invention to the precise forms disclosed, and it is apparent that many variations and modifications are possible in light of the foregoing teachings. The exemplary embodiments have been selected and described for the purpose of explaining the specific principles of the invention and their practical application, thereby enabling those skilled in the art to realize and utilize a variety of exemplary embodiments of the invention and various options and modifications. The scope of the invention is intended to be defined by the claims and their equivalents.

Claims

1. A method for making the allocation space of virtual disks consistent in a cloud computing environment, characterized in that: The method comprises: S1: The virtual disk cluster receives an IO. If the space allocation unit corresponding to the IO is not found in the cluster database, a signal to create a space allocation unit is sent to the local virtual disk and the IO is placed in a retransmission queue. S2: After receiving the signal for creating a space allocation unit, the local computer creates a new space allocation unit and adds the new_created and create_at tags to the space allocation unit. After the creation is complete, the replica path of the space allocation unit is returned to the cluster, where the new_created tag indicates that the space allocation unit is a newly created space allocation unit, and the create_at tag indicates the creation time of the space allocation unit. S3: The cluster receives the replica path and records the replica path in the cluster database; S4: The cluster takes the IO from the retransmission queue and sends it to the local server according to the replica path. After the IO arrives at the local server, it is recorded in the journal. S5: If the local check finds that the space allocation unit has a new_created tag, the new_created tag is deleted in the memory after the IO is completed.

2. The method for making the allocated space of virtual disks consistent in a cloud computing environment according to claim 1, wherein if a power outage occurs after step S2 is completed, The method further comprises: After power is restored, the local space allocation units are traversed to find the space allocation units with the new_created mark; Compare the current time point of the space allocation unit and the time point corresponding to the create_at tag of the space allocation unit to obtain the time difference; If the time difference is greater than the maximum IO delay, the space allocation unit is deleted and the process returns to step S1.

3. The method for making the allocated space of virtual disks consistent in a cloud computing environment according to claim 1, wherein if a power failure occurs between the completion of step S3 and the completion of step S5, The method further comprises: After power is restored, compare the local space allocation unit and the maximum IO latency; If the IO of the space allocation unit is within the maximum IO delay, proceed to step S4; If the IO of the space allocation unit exceeds the maximum IO delay, the copy path of the space allocation unit in the cluster database is deleted, and the process returns to step S1.

4. The method for making the allocated space of virtual disks consistent in a cloud computing environment according to claim 1, wherein: If a power outage occurs before step S2 is completed, steps S1 to S5 are performed normally after power is restored.

5. The method for making the allocated space of virtual disks consistent in a cloud computing environment according to claim 1, wherein: The method further comprises: When the journal is checked, the data in the memory is updated to the virtual disk.

6. The method for making the allocated space of virtual disks consistent in a cloud computing environment according to claim 5, characterized in that: If a power outage occurs after step S5 is completed and before the journal completes the checkpoint, the method further includes: After power is restored, the new_created flag is reloaded into memory and memory reloads the IO from the journal; and When the IO is executed, the new_created mark of the space allocation unit corresponding to the IO is deleted in the memory.

7. A device for making the allocation space of virtual disks consistent in a cloud computing environment, characterized in that: The device comprises: A detection module is configured to receive an IO from a virtual disk cluster. If no space allocation unit corresponding to the IO is found in the cluster database, a signal for creating a space allocation unit is sent to the local virtual disk and the IO is placed in a retransmission queue. A creation module is configured to, upon receiving a signal to create a space allocation unit locally, create a new space allocation unit, add new_created and create_at tags to the space allocation unit, and return a copy path of the space allocation unit to the cluster after the creation is complete, wherein the new_created tag indicates that the space allocation unit is a newly created space allocation unit, and the create_at tag indicates the creation time of the space allocation unit; A recording module, configured for the cluster to receive the replica path and record the replica path in the cluster database; A sending module is used for the cluster to take the IO from the resending queue and send the IO to the local according to the replica path. After the IO arrives at the local, it is recorded in the journal; The first deletion module is configured to delete the new_created tag in the memory after the IO is completed if the local check finds that the space allocation unit has a new_created tag.

8. The apparatus for making the allocated space of virtual disks consistent in a cloud computing environment according to claim 7, wherein: The device further comprises: A search module is used to traverse the local space allocation units and find the space allocation units with the new_created mark; A comparison module is used to compare the current time point of the space allocation unit with the time point corresponding to the create_at tag of the space allocation unit to obtain a time difference; The second deleting module is configured to delete the space allocation unit if the time difference is greater than the maximum IO delay.

9. The apparatus for making the allocated space of virtual disks consistent in a cloud computing environment according to claim 7, wherein: The device further comprises: The third deletion module is configured to delete the copy path of the space allocation unit in the cluster database if the IO of the space allocation unit exceeds the maximum IO delay.

10. An electronic device, characterized in that: include: at least one processor; as well as A memory storing instructions, which, when executed by the at least one processor, causes the at least one processor to execute the method for making the allocated space of a virtual disk consistent in a cloud computing environment according to any one of claims 1 to 6.

11. A computer-readable storage medium, characterized in that The computer-readable storage medium stores a computer program, which, when executed by a processor, implements the steps of the method for making the allocated space of a virtual disk consistent in a cloud computing environment according to any one of claims 1 to 6.

Citation Information

Patent Citations

  • Disk space management method and device, electronic equipment and storage medium

    CN114564283A

  • Synchronizing allocated blocks of virtual disk files across primary and secondary volumes by excluding unused blocks

    US8990815B1