Mirror storage method, device, storage medium and electronic device
By creating storage space in the storage area network and disconnecting it, the problem of low storage mirroring efficiency is solved, and the effect of improving storage mirroring efficiency is achieved.
Patent Information
- Application Number
- CN202111415476.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-11-25
- Publication Date
- 2025-07-25
- Estimated Expiration
- 2041-11-25
AI Technical Summary
In the prior art, the efficiency of uploading mirrors in the storage area network is low, resulting in low storage mirroring efficiency.
Create storage space in the storage area network through the cloud disk management module, connect to the client and write the mirrored data, then disconnect and write the mirrored metadata to the database, improving storage efficiency.
By creating storage space and disconnecting in the storage area network, the efficiency of storage mirroring is improved, and the problem of low storage mirroring efficiency is solved.
Smart Images

Figure CN114168074B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computers, and in particular, to a mirror storage method, device, storage medium, and electronic device. Background Art
[0002] In the prior art, when uploading a mirror to a storage space, the mirror is generally stored in a distributed memory or a third-party memory. There is no method for uploading a mirror in a storage area network in the prior art, resulting in low efficiency of storing the mirror. Summary of the Invention
[0003] Embodiments of the present invention provide a mirror storage method, device, storage medium, and electronic device to at least solve the technical problem of low efficiency of storing a mirror.
[0004] According to one aspect of the embodiments of the present invention, a mirror storage method for a storage area network is provided, including: receiving a mirror upload request from a client, where the mirror upload request is used to request uploading a target mirror; sending a creation request to a cloud disk management module, where the creation request is used to request the cloud disk management module to create a first storage space in the storage area network for storing the target mirror; after the cloud disk management module creates the first storage space, connecting the first storage space to the client locally; writing mirror data of the target mirror on the client locally into the first storage space; after the writing of the mirror data is completed, disconnecting the first storage space from the client locally, and writing mirror metadata of the target mirror into a database.
[0005] According to another aspect of the embodiments of the present invention, a mirror storage device for a storage area network is provided, including: a receiving module, configured to receive a mirror upload request from a client, where the mirror upload request is used to request uploading a target mirror; a sending module, configured to send a creation request to a cloud disk management module, where the creation request is used to request the cloud disk management module to create a first storage space in the storage area network for storing the target mirror; a first creation module, configured to connect the first storage space to the client locally after the cloud disk management module creates the first storage space; a writing module, configured to write mirror data of the target mirror on the client locally into the first storage space; a processing module, configured to disconnect the first storage space from the client locally after the writing of the mirror data is completed, and write mirror metadata of the target mirror into a database.
[0006] As an optional example, the above processing module includes: a first processing unit, configured to disconnect the connection and write the mirror metadata of the above mirror data into the database when the writing of the last byte of the above mirror data is completed; or a second processing unit, configured to disconnect the connection and write the mirror metadata of the above mirror data into the database after a predetermined duration after the writing of the last byte of the above mirror data is completed.
[0007] As an optional example, the above creation module includes: an identification unit, configured to identify a target field in the above mirror upload request, where the above target field is used to identify a target object for creating the above first storage space; a sending unit, configured to send the above creation request to the above cloud disk management module when the above target field indicates that the above target object is the above cloud disk management module.
[0008] As an optional example, the above device further includes: a configuration module, configured to configure the correspondence between fields and objects in a configuration file;
[0009] a saving module, configured to save the newly added correspondence to the above configuration file when receiving a new instruction for adding the above correspondence; or a deleting module, configured to delete the correspondence indicated by the deletion instruction in the above configuration file when receiving a deletion instruction for deleting the above correspondence.
[0010] As an optional example, the above device further includes: an obtaining module, configured to obtain a creation request after writing the mirror data of the above target mirror on the client side into the above first storage space, where the above creation request is used to request the creation of a virtual machine; a determining module, configured to determine a first mirror for creating the above virtual machine from all the mirrors in the above storage area network; a second creation module, configured to create the above virtual machine using the above first mirror.
[0011] As an optional example, the above determining module includes: a searching unit, configured to search for a mirror in all the mirrors in the above storage area network whose mirror flag is the same as the above target flag according to the target flag of the mirror included in the above creation request; a determining unit, configured to determine the found mirror as the above first mirror.
[0012] As an optional example, the above second creation module includes: a mapping unit, configured to map the above first mirror in the above first storage space to a second storage space, thereby creating the above virtual machine.
[0013] In an embodiment of the present invention, a method is adopted to receive a mirror upload request from a client, where the mirror upload request is used to request the upload of a target mirror; send a creation request to a cloud disk management module, where the creation request is used to request the cloud disk management module to create a first storage space in a storage area network for storing the target mirror; after the cloud disk management module creates the first storage space, connect the first storage space to the client locally; write the mirror data of the target mirror on the client locally into the first storage space; after the writing of the mirror data is completed, disconnect the connection between the first storage space and the client locally, and write the mirror metadata of the target mirror into a database. Since in the above method, when storing a mirror, a creation request is sent to the cloud disk management module, and the cloud disk management module sends a creation request to allocate a first storage space in the storage area network, establish a connection between the first storage space and the client, and write the mirror into the first storage space to store the mirror, the purpose of improving the mirror storage efficiency is achieved, and thus the technical problem of low mirror storage efficiency is solved. BRIEF DESCRIPTION OF THE DRAWINGS
[0014] The drawings described herein are used to provide a further understanding of the present invention and constitute a part of this application. The illustrative embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute an improper limitation of the present invention. In the drawings:
[0015] Figure 1 is a flowchart of an optional mirror storage method for a storage area network according to an embodiment of the present invention;
[0016] Figure 2 is a flowchart of another optional mirror storage method for a storage area network according to an embodiment of the present invention;
[0017] Figure 3 is a schematic diagram of uploading a mirror for an optional mirror storage method for a storage area network according to an embodiment of the present invention;
[0018] Figure 4 is a schematic diagram of generating a virtual machine for an optional mirror storage method for a storage area network according to an embodiment of the present invention;
[0019] Figure 5 is a schematic diagram of the structure of an optional mirror storage device for a storage area network according to an embodiment of the present invention. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0020] To enable those skilled in the art to better understand the solution of the present invention, the following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only a part of the embodiments of the present invention, rather than all the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without making creative efforts shall fall within the scope of protection of the present invention.
[0021] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned accompanying drawings are used to distinguish similar objects, and do not necessarily need to be used to describe a specific order or sequence. It should be understood that such data can be interchanged under appropriate circumstances so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "comprising" and "having" and any variations thereof are intended to cover non-exclusive inclusion. For example, a process, method, system, product, or device comprising a series of steps or units does not necessarily have to be limited to those steps or units clearly listed, but may include other steps or units not clearly listed or inherent to these processes, methods, products, or devices.
[0022] According to the first aspect of the embodiments of the present invention, a mirror storage method for a storage area network is provided. Optionally, as Figure 1 shown, the above method includes:
[0023] S102, receiving a mirror upload request from a client, where the mirror upload request is used to request uploading a target mirror;
[0024] S104, sending a creation request to a cloud disk management module, where the creation request is used to request the cloud disk management module to create a first storage space in the storage area network for storing the target mirror;
[0025] S106, after the cloud disk management module creates the first storage space, connecting the first storage space to the client locally;
[0026] S108, writing the mirror data of the target mirror on the client locally into the first storage space;
[0027] S110, after the mirror data writing is completed, disconnecting the connection between the first storage space and the client locally, and writing the mirror metadata of the target mirror into the database.
[0028] Optionally, this embodiment can be but is not limited to being applied in the process of storing a mirror. The mirror in this embodiment can be a template for creating a virtual machine with an operating system already installed, and virtual machines can be created in batches through the mirror.
[0029] Optionally, the Storage Area Network (SAN) in this embodiment adopts Fibre Channel technology, and connects the storage array and the server host through a Fibre Channel switch to establish a dedicated area network for data storage.
[0030] Optionally, in this embodiment, when the client wants to upload an image, it can receive the image upload request from the client, and then send a creation request to the cloud disk management module. The cloud disk management module creates a first storage space in the storage area network, and then connects the first storage space to the client. After the connection, the image data of the client can be written into the first storage space. After the writing is completed, the connection is disconnected, and the image metadata is written into the database.
[0031] In the above method, when storing an image, a creation request is sent to the cloud disk management module. The cloud disk management module sends a creation request to allocate a first storage space in the storage area network, establishes a connection between the first storage space and the client, and writes the image into the first storage space to store the image, thereby achieving the purpose of improving the efficiency of storing the image.
[0032] As an optional example, after the image data is written, disconnecting the connection between the first storage space and the client local and writing the image metadata of the target image into the database includes:
[0033] When the last byte of the image data is written, disconnect the connection and write the image metadata of the image data into the database; or
[0034] After a predetermined time after the last byte of the image data is written, disconnect the connection and write the image metadata of the image data into the database.
[0035] Optionally, in this embodiment, if the target image is uploaded to the first storage space, the connection relationship can be immediately disconnected, or the connection relationship can be disconnected after a predetermined time. Immediately disconnecting the connection relationship can reduce the bandwidth occupancy, and disconnecting the connection relationship after a predetermined time can improve the accuracy of uploading the target image.
[0036] As an optional example, sending a creation request to the cloud disk management module includes:
[0037] Identifying the target field in the image upload request, where the target field is used to identify the target object for creating the first storage space;
[0038] When the target field indicates that the target object is the cloud disk management module, send a creation request to the cloud disk management module.
[0039] In this embodiment, the storage location for allocating the first storage space can be marked by a character flag in the allocation statement. For example, parse the allocation statement to parse out the character flag in the allocation statement. If the character flag is the target character flag, allocate the first storage space in the storage area network. If the character flag is another character flag, such as the first character flag, allocate the first storage space in the distributed network. For example, if the character flag is the second character flag, allocate the first storage space in the direct-attached storage, etc. By setting different character flags in the allocation statement, determine where to allocate the first storage space to store the target image.
[0040] Optionally, in this embodiment, the position of the first storage space in the storage area network or the size of the first storage space can also be determined according to the characters in the allocation statement. Different characters correspond to different positions or sizes.
[0041] As an alternative example, the above method further includes:
[0042] Configure the correspondence between fields and objects in the configuration file;
[0043] In the case of receiving an add instruction for adding a correspondence, save the newly added correspondence to the configuration file; or
[0044] In the case of receiving a delete instruction for deleting a correspondence, delete the correspondence indicated by the delete instruction in the configuration file.
[0045] Optionally, the configuration file in this embodiment includes an allocation statement, and the character flag in the allocation statement can be adjusted. In this embodiment, before allocating the first storage space, the character flag in the allocation statement can be adjusted to the target character flag, so that the adjusted allocation statement can be used to allocate the first storage space for the target image. The content in the configuration file can be modified according to the add instruction and the delete instruction.
[0046] As an alternative example, after writing the image data of the target image on the client side to the first storage space, the above method further includes:
[0047] Obtain a creation request, where the creation request is used to request the creation of a virtual machine;
[0048] Among all the images in the storage area network, determine the first image for creating the virtual machine;
[0049] Create a virtual machine using the first image.
[0050] Optionally, in this embodiment, after storing the target image in the first storage space, a creation request for creating a virtual machine may be received. After receiving the creation request for creating a virtual machine, the image corresponding to the virtual machine to be created may be determined. Different images correspond to the creation of different virtual machines. The first image for creating a virtual machine is determined according to the creation request, and then a virtual machine is created through the first image.
[0051] As an alternative example, determining the first image for creating a virtual machine among all images in the storage area network includes:
[0052] According to the target flag of the image included in the creation request, among all images in the storage area network, find the image whose image flag is the same as the target flag;
[0053] Determine the found image as the first image.
[0054] Optionally, in this embodiment, the first image for creating a virtual machine may be determined according to the target flag of the image included in the creation request. After obtaining the creation request, the target flag of the image in the creation request is obtained, and then this flag is compared with the image flags of all images, and the image whose flag is the same as the target flag is determined from all images as the first image to create a virtual machine.
[0055] As an alternative example, creating a virtual machine using the first image includes:
[0056] Map the first image in the first storage space to the second storage space, thereby creating a virtual machine.
[0057] Optionally, in this embodiment, after determining the first image for creating a virtual machine, the first image is stored in the first storage space. The first image may be mapped to the second storage space, thereby creating a virtual machine.
[0058] Optionally, in this embodiment, the management system includes a glance service for managing images, and also includes a cinder component for managing cloud disks. A cloud disk (volume) is a hard disk device that can provide storage space for a virtual machine.
[0059] Figure 2 This is a flowchart of this embodiment. As Figure 2In S202 to S212, after receiving the request for uploading an image sent by the client, Glance reads from the above-mentioned Glance.conf file that the store configuration is Cinder, sends a request to create a volume to Cinder, waits for Cinder to complete the creation of the volume, Glance connects the volume locally, then writes the image file data to the volume, disconnects the volume connection after writing, and writes the image metadata to the database at the same time. The image metadata stores the attribute information of the image file written to the volume, and the attribute information may include various attributes such as the size, storage location, and storage date of the image file.
[0060] In this embodiment, the Glance.conf file can be configured to set default_store = Cinder. The Glance.conf file is a file used to determine the storage space, that is, the above-mentioned configuration file, and the statement default_store = Cinder is the above-mentioned allocation statement, and Cinder is the target character flag.
[0061] The configuration code is as follows:
[0062] [glance_store]
[0063] #Which backend scheme should Glance use by default is not
[0064] #in a request to add a new image to Glance? Known schemes
[0065] #by the stores option below
[0066] #Default: ‘file’
[0067] default_store = Cinder
[0068] The target character flag can be configured through the above code.
[0069] Figure 3 It is a schematic diagram of receiving an upload request and storing a target image in this embodiment. Figure 3 In it, both client 1 and client 2 send image upload requests to the server. The server receives the image upload requests, allocates the first storage space for client 1 and client 2 respectively in the storage area network, establishes a connection between the storage area network and the clients, and uploads the images to the storage area network.
[0070] Figure 4 It is a schematic diagram of creating a virtual machine upon receiving a creation request in this embodiment. Figure 4 In this embodiment, when a creation request is received, a first image for creating a virtual machine is determined from multiple images, and the virtual machine is created using the first image mapping.
[0071] In this embodiment, the cinder component can be used as the image storage driver for glance. The storage driver of cinder is SAN storage. For each uploaded image, glance sends a request to cinder to create a volume, and then the image data is written into the volume created by cinder. This method realizes that the backends actually used by glance and cinder are the same kind of storage. Cinder can, according to the image selected by the user when creating a virtual machine, correspond to a volume in the SAN underlying storage, and the virtual machine system disk can directly map a new volume from the SAN storage image volume, solving the problem of image storage and realizing the creation of a virtual machine within seconds.
[0072] It should be noted that, for the foregoing method embodiments, for the sake of simple description, they are all expressed as a series of action combinations. However, those skilled in the art should know that the present invention is not limited by the described action sequence, because according to the present invention, certain steps can be performed in other sequences or simultaneously. Secondly, those skilled in the art should also know that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily essential to the present invention.
[0073] According to another aspect of the embodiments of the present application, there is also provided an image storage device for a storage area network, as Figure 5 shown, including:
[0074] A receiving module 502, configured to receive an image upload request from a client, where the image upload request is used to request uploading a target image;
[0075] A sending module 504, configured to send a creation request to a cloud disk management module, where the creation request is used to request the cloud disk management module to create a first storage space for storing the target image in the storage area network;
[0076] A first creation module 506, configured to connect the first storage space to the client locally after the cloud disk management module creates the first storage space;
[0077] A writing module 508, configured to write the image data of the target image on the client locally into the first storage space;
[0078] A processing module 510, configured to disconnect the connection between the first storage space and the client local after the mirror data writing is completed, and write the mirror metadata of the target mirror into the database.
[0079] Optionally, this embodiment can be but is not limited to being applied in the process of storing a mirror. The mirror in this embodiment can be a template that has already installed an operating system for creating virtual machines, and virtual machines can be created in batches through the mirror.
[0080] Optionally, the Storage Area Network (SAN) in this embodiment adopts Fibre Channel technology, and connects the storage array and the server host through a Fibre Channel switch to establish a dedicated area network for data storage.
[0081] Optionally, in this embodiment, when the client wants to upload a mirror, it can receive the mirror upload request from the client, and then send a creation request to the cloud disk management module. The cloud disk management module creates a first storage space in the storage area network, and then connects the first storage space to the client. After the connection, the mirror data of the client can be written into the first storage space. After the writing is completed, the connection is disconnected, and the mirror metadata is written into the database.
[0082] Since in the above method, when storing a mirror, a creation request is sent to the cloud disk management module, and the cloud disk management module sends a creation request to allocate a first storage space in the storage area network, establish a connection between the first storage space and the client, and write the mirror into the first storage space to store the mirror, thus achieving the purpose of improving the efficiency of storing the mirror.
[0083] As an optional implementation manner, the above processing module includes:
[0084] A first processing unit, configured to disconnect the connection when the last byte of the mirror data is written, and write the mirror metadata of the mirror data into the database; or
[0085] A second processing unit, configured to disconnect the connection after a predetermined time period after the last byte of the mirror data is written, and write the mirror metadata of the mirror data into the database.
[0086] Optionally, in this embodiment, if the target mirror is uploaded to the first storage space, the connection relationship can be immediately disconnected, or the connection relationship can be disconnected after a predetermined time period. Immediately disconnecting the connection relationship can reduce the bandwidth occupancy, and disconnecting the connection relationship after a predetermined time period can improve the accuracy of uploading the target mirror.
[0087] As an optional implementation manner, the above creation module includes:
[0088] An identification unit for identifying a target field in a mirror upload request, where the target field is used to identify a target object for creating a first storage space;
[0089] A sending unit for sending a creation request to a cloud disk management module when the target field indicates that the target object is the cloud disk management module.
[0090] In this embodiment, the storage location for which the first storage space is to be allocated can be marked by a character flag in the allocation statement. For example, parse the allocation statement to parse out the character flag in the allocation statement. If the character flag is the target character flag, allocate the first storage space in the storage area network. If the character flag is another character flag, such as the first character flag, allocate the first storage space in the distributed network. For example, if the character flag is the second character flag, allocate the first storage space in the direct-attached storage, etc. By setting different character flags in the allocation statement, determine where to allocate the first storage space to store the target mirror.
[0091] Optionally, in this embodiment, the position of the first storage space in the storage area network or the size of the first storage space can also be determined according to the characters in the allocation statement. Different characters correspond to different positions or sizes.
[0092] As an alternative embodiment, the above device further includes:
[0093] A configuration module for configuring the correspondence between fields and objects in a configuration file;
[0094] A saving module for saving the newly added correspondence to the configuration file when receiving a new instruction for adding a correspondence; or
[0095] A deleting module for deleting the correspondence indicated by the deletion instruction in the configuration file when receiving a deletion instruction for deleting a correspondence.
[0096] Optionally, the configuration file in this embodiment includes an allocation statement, and the character flag in the allocation statement can be adjusted. In this embodiment, before allocating the first storage space, the character flag in the allocation statement can be adjusted to the target character flag, so that the adjusted allocation statement can be used to allocate the first storage space for the target mirror. The content in the configuration file can be modified according to the new instruction and the deletion instruction.
[0097] As an alternative embodiment, the above device further includes:
[0098] A obtaining module for obtaining a creation request after writing the mirror data of the target mirror on the client side to the first storage space, where the creation request is used to request the creation of a virtual machine;
[0099] A determination module, configured to determine a first image for creating a virtual machine from all the images in a storage area network;
[0100] A second creation module, configured to create a virtual machine using the first image.
[0101] Optionally, in this embodiment, after storing the target image in the first storage space, a creation request for requesting to create a virtual machine may be received. After receiving the creation request for creating a virtual machine, the image corresponding to the virtual machine to be created may be determined. Different images correspond to creating different virtual machines. The first image for creating a virtual machine is determined according to the creation request, and then the virtual machine is created through the first image.
[0102] As an optional implementation manner, the above determination module includes:
[0103] A search unit, configured to search, in all the images in the storage area network, for an image whose image flag is the same as the target flag according to the target flag of the image included in the creation request;
[0104] A determination unit, configured to determine the searched image as the first image.
[0105] Optionally, in this embodiment, the first image for creating a virtual machine may be determined according to the target flag of the image included in the creation request. After obtaining the creation request, the target flag of the image in the creation request is obtained, and then this flag is compared with the image flags of all the images, and the image whose flag is the same as the target flag is determined from all the images as the first image to create a virtual machine.
[0106] As an optional implementation manner, the above second creation module includes:
[0107] A mapping unit, configured to map the first image in the first storage space to the second storage space, thereby creating a virtual machine.
[0108] Optionally, in this embodiment, after determining the first image for creating a virtual machine, the first image is stored in the first storage space. The first image may be mapped to the second storage space, thereby creating a virtual machine.
[0109] According to another aspect of the embodiments of the present invention, an electronic device for implementing the above mirror storage method of the storage area network is further provided. The electronic device may include a memory and a processor. A computer program is stored in the memory, and the processor is configured to execute the steps in the above mirror storage method of the storage area network through the computer program.
[0110] According to another aspect of an embodiment of the present invention, there is also provided a computer-readable storage medium storing a computer program, wherein the computer program is configured to execute the steps in the mirror storage method of the above storage area network when running.
[0111] Optionally, in this embodiment, those of ordinary skill in the art can understand that all or part of the steps in the various methods of the above embodiments can be completed by instructing the relevant hardware of the terminal device through a program, and the program can be stored in a computer-readable storage medium. The storage medium may include: a flash drive, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disc, etc.
[0112] The serial numbers of the above embodiments of the present invention are only for description and do not represent the advantages or disadvantages of the embodiments.
[0113] If the integrated unit in the above embodiment is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in the above computer-readable storage medium. Based on such an understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes several instructions for causing one or more computer devices (which may be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present invention.
[0114] In the above embodiments of the present invention, the descriptions of the various embodiments have their own emphases. For the parts not detailed in a certain embodiment, reference may be made to the relevant descriptions of other embodiments.
[0115] In the several embodiments provided in the present application, it should be understood that the disclosed client can be implemented in other ways. Among them, the device embodiments described above are only illustrative. For example, the division of the units is only a logical function division, and there may be other division methods in actual implementation. For example, 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 displayed or discussed mutual coupling or direct coupling or communication connection may be through some interfaces, and the indirect coupling or communication connection of units or modules may be in an electrical or other form.
[0116] The unit described as a separation component may or may not be physically separated. The component shown as a unit may or may not be a physical unit, that is, it may be located in one place or may be distributed across multiple network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0117] In addition, each functional unit in various embodiments of the present invention can be integrated into one processing unit, or each unit can exist physically alone, or two or more units can be integrated into one unit. The above-mentioned integrated units can be implemented in the form of hardware or in the form of software functional units.
[0118] The above are only the preferred embodiments of the present invention. It should be noted that for those of ordinary skill in the art, without departing from the principle of the present invention, several improvements and modifications can be made, and these improvements and modifications should also be regarded as the protection scope of the present invention.
Claims
1. A mirror storage method, characterized in that, including: Receiving a mirror upload request from a client, where the mirror upload request is used to request uploading a target mirror; Sending a creation request to a cloud disk management module, where the creation request is used to request the cloud disk management module to create a first storage space for storing the target mirror in a storage area network, and the location or size of the first storage space in the storage area network is determined according to the characters of an allocation statement in the creation request; After the cloud disk management module creates the first storage space, locally connecting the first storage space to the client; Writing mirror data of the target mirror on the client locally into the first storage space; After the writing of the mirror data is completed, disconnecting the connection between the first storage space and the client locally, and writing mirror metadata of the target mirror into a database; Wherein, after writing the mirror data of the target mirror on the client locally into the first storage space, the method further includes: obtaining a creation request, where the creation request is used to request creating a virtual machine; determining a first mirror for creating the virtual machine from all mirrors in the storage area network; creating the virtual machine using the first mirror; The creating the virtual machine using the first mirror includes: mapping the first mirror in the first storage space to a second storage space, thereby creating the virtual machine.
2. The method according to claim 1, wherein The disconnecting the connection between the first storage space and the client locally and writing the mirror metadata of the target mirror into the database after the writing of the mirror data is completed includes: When the writing of the last byte of the mirror data is completed, disconnecting the connection and writing the mirror metadata of the mirror data into the database; or After a predetermined duration after the writing of the last byte of the mirror data is completed, disconnecting the connection and writing the mirror metadata of the mirror data into the database.
3. The method according to claim 1, wherein The sending the creation request to the cloud disk management module includes: Identifying a target field in the mirror upload request, where the target field is used to identify a target object for creating the first storage space; When the target field indicates that the target object is the cloud disk management module, sending the creation request to the cloud disk management module.
4. The method according to claim 3, characterized in that, The method further includes: Configuring the correspondence between fields and objects in a configuration file; When receiving an addition instruction for adding the correspondence, saving the added correspondence to the configuration file; or When receiving a deletion instruction for deleting the correspondence, deleting the correspondence indicated by the deletion instruction in the configuration file.
5. The method according to claim 1, characterized in that, The determining the first mirror for creating the virtual machine from all mirrors in the storage area network includes: According to a target flag of a mirror included in the creation request, searching for a mirror in all mirrors in the storage area network whose mirror flag is the same as the target flag; Determining the found mirror as the first mirror.
6. A mirror storage device, characterized in that, including: A receiving module, configured to receive an image upload request from a client, where the image upload request is used to request uploading a target image; A sending module, configured to send a creation request to a cloud disk management module, where the creation request is used to request the cloud disk management module to create a first storage space in a storage area network for storing the target image, and a location or size of the first storage space in the storage area network is determined according to characters of an allocation statement in the creation request; A first creation module, configured to locally connect the first storage space to the client after the cloud disk management module creates the first storage space; A writing module, configured to write image data of the target image on the client locally into the first storage space; A processing module, configured to disconnect the local connection between the first storage space and the client after the writing of the image data is completed, and write image metadata of the target image into a database; Wherein, after writing the image data of the target image on the client locally into the first storage space, it further includes: obtaining a creation request, where the creation request is used to request creating a virtual machine; determining a first image for creating the virtual machine from all images in the storage area network; and creating the virtual machine using the first image; The creating the virtual machine using the first image includes: mapping the first image in the first storage space to a second storage space, thereby creating the virtual machine.
7. A computer-readable storage medium storing a computer program, characterized in that, The computer program, when running, executes the method described in any one of claims 1 to 5.
8. An electronic device, comprising a memory and a processor, characterized in that, A computer program is stored in the memory, and the processor is configured to execute the method described in any one of claims 1 to 5 through the computer program.
Citation Information
Patent Citations
Fast write operations to a mirrored volume in a volume manager
CN101784990A
A method and system for creating a mirror image by a cloud platform
CN109634718A