Detailed Description
In order to make the technical solutions of the present invention better understood, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
It should be noted that the terms "first," "second," and the like in the description and claims of the present invention and in the drawings described above are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used is interchangeable under appropriate circumstances such that the embodiments of the invention described herein are capable of operation in sequences other than those illustrated or described herein. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed, but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
According to a first aspect of the embodiments of the present invention, there is provided a mirror storage method for a storage area network, optionally, as shown in fig. 1, the method includes:
s102, receiving a mirror image uploading request of a client, wherein the mirror image uploading request is used for requesting to upload a target mirror image;
s104, sending a creation request to a cloud disk management module, wherein the creation request is used for requesting the cloud disk management module to create a first storage space for storing a target image in a storage area network;
s106, after the cloud disk management module creates the first storage space, the first storage space is locally connected with the client;
s108, writing mirror image data of a local target mirror image of the client into a first storage space;
and S110, after the mirror image data is written, disconnecting the first storage space from the local client, and writing the mirror image metadata of the target mirror image into the database.
Optionally, the present embodiment may be, but is not limited to, applied to a process of storing an image. The image in this embodiment may be a template in which an operating system has been installed for creating virtual machines, and the virtual machines may be created in batch by the image.
Optionally, a Storage Area Network (SAN) in this embodiment adopts a Fibre Channel (Fibre Channel) technology, and connects the Storage array and the server host through a Fibre Channel switch, so as to establish an Area Network dedicated to data Storage.
Optionally, in this embodiment, when the client wants to upload the image, the client may receive an image upload request of the client, send a creation request to the cloud disk management module, create a first storage space in the storage area network by the cloud disk management module, connect the first storage space with the client, and write image data of the client into the first storage space after the connection. And after the writing is finished, disconnecting the connection, and writing the mirror pixel data into the database.
In the method, when the mirror image is stored, the creation request is sent to the cloud disk management module, the cloud disk management module sends the creation request to open up the first storage space in the storage area network, the connection is established between the first storage space and the client, and the mirror image is written into the first storage space to store the mirror image, so that the aim of improving the efficiency of the storage mirror image is fulfilled.
As an alternative example, after the mirror image data is written, disconnecting the first storage space from the local client, and writing the mirror image metadata of the target mirror image into the database includes:
when the last byte of the mirror image data is written, disconnecting the connection, and writing the mirror image metadata of the mirror image data into the database; or
And after the preset time after the last byte of the mirror image data is written, disconnecting the connection, and writing the mirror image metadata of the mirror image data into the database.
Optionally, in this embodiment, if the target image is uploaded to the first storage space, the connection relationship may be disconnected immediately, or may be disconnected after a predetermined time period. The immediate disconnection relation can reduce the occupation of bandwidth, and the disconnection relation after a preset time can improve the accuracy of uploading the target mirror image.
As an optional example, sending the creation request to the cloud disk management module includes:
identifying a target field in the mirror image uploading request, wherein the target field is used for marking a target object for creating the first storage space;
and sending a creation request to the cloud disk management module under the condition that the target field indicates that the target object is the cloud disk management module.
In this embodiment, the storage location to which the first storage space is to be allocated may be marked by a character flag in the allocation statement. For example, the allocation statement is analyzed, the character mark in the allocation statement is analyzed, and if the character mark is the target character mark, the first storage space is allocated in the storage area network. If the character tag is other character tags, for example, the first character tag, then the first storage space is allocated in the distributed network. For example, if the character mark is the second character mark, the first storage space is allocated in the direct connection type storage. The allocation of the first storage space to the storage target image is determined by setting different character flags in the allocation statement.
Optionally, in this embodiment, the location of the first storage space in the storage area network or the size of the first storage space may also be determined according to characters in the allocation statement. Different characters correspond to different positions or sizes.
As an optional example, the method further includes:
configuring the corresponding relation between the fields and the objects in the configuration file;
under the condition that a new instruction for adding the corresponding relation is received, the newly added corresponding relation is stored in a configuration file; or
And in the case of receiving a deleting instruction for deleting the corresponding relation, deleting the corresponding relation indicated by the deleting instruction in the configuration file.
Optionally, the configuration file in this embodiment includes an allocation statement, and a character flag in the allocation statement may be adjusted. In this embodiment, before the first storage space is allocated, the character flag in the allocation statement may be adjusted to be the target character flag, so that the adjusted allocation statement may be used to allocate the first storage space for the target mirror image. The content in the configuration file may be modified according to the add instruction and the delete instruction.
As an optional example, after writing the image data of the target image local to the client into the first storage space, the method further includes:
acquiring a creating request, wherein the creating request is used for requesting to create a virtual machine;
determining a first image for creating a virtual machine in all images in a storage area network;
a virtual machine is created using the first image.
Optionally, in this embodiment, after the target image is stored in the first storage space, a creation request may be received, where the creation request is used to request creation of a virtual machine. After receiving a creation request to create a virtual machine, an image corresponding to the virtual machine to be created may be determined. Different images correspondingly create different virtual machines. And determining a first image of the virtual machine to be created according to the creation request, and then creating the virtual machine through the first image.
As an alternative example, determining the first image for creating the virtual machine among all images in the storage area network comprises:
searching the mirror image with the mirror image mark same as the target mark in all the mirror images in the storage area network according to the target mark of the mirror image contained in the creating request;
and determining the searched mirror image as a first mirror image.
Optionally, in this embodiment, the first image to be used for creating the virtual machine may be determined according to a target flag of the image included in the creation request. After the creation request is acquired, acquiring a target mark of a mirror image in the creation request, then comparing the mark with mirror image marks of all mirror images, determining a mirror image with the same mark as the target mark from all mirror images, and using the mirror image as a first mirror image to create the virtual machine.
As an alternative example, creating a virtual machine using a first image includes:
the first image in the first storage space is mapped into the second storage space, thereby creating a virtual machine.
Optionally, in this embodiment, after determining to create the first image of the virtual machine, the first image is stored in the first storage space. The first image may be mapped into a second storage space, thereby creating a virtual machine.
Optionally, in this embodiment, the management system includes a work service, which is used to manage the image, and a shader component, which is used to manage the cloud disk. A cloud disk (volume) is a hard disk device that can provide storage space for a virtual machine.
Fig. 2 is a flowchart of the present embodiment. As shown in S202 to S212 in fig. 2, after receiving a request for uploading an image sent by a client, reading, by the angle, to the store according to the aforementioned angle. conf file, that the store configuration is ring, sending a create volume request to the ring, waiting for the completion of creating the volume by the ring, connecting the volume to the local by the angle, then writing the image file data into the volume, and after the completion of writing, disconnecting the volume connection and writing the image metadata into the database. The mirror metadata stores attribute information of the mirror file written into the volume, and the attribute information may include various attributes such as the size, storage location, and storage date of the mirror file.
In this embodiment, a gland _ store file may be configured, and default _ store may be configured as a shader. The company _ conf file is a file for determining a storage space, that is, the configuration file, the default _ store ═ circular statement is the allocation statement, and the circular is the target character mark.
The configuration code is as follows:
[glance_store]
#Which backend scheme should glance use by default is not
#in a request to add a new image to glanceKnown schemes
#by the stores option below
#Default:‘file’
default_store=cinder
the character mark can be configured to be a target character mark through the code.
Fig. 3 is a schematic diagram of a storage target image receiving an upload request according to the present embodiment. In fig. 3, both the client 1 and the client 2 send mirror image upload requests to the server, the server receives the mirror image upload requests, allocates first storage spaces for the client 1 and the client 2 in the storage area network, establishes connection between the storage area network and the client, and uploads the mirror images to the storage area network.
Fig. 4 is a schematic diagram of the present embodiment that a virtual machine is created upon receiving a creation request. In fig. 4, after receiving a creation request, a first image for creating a virtual machine is determined from the plurality of images, and the virtual machine is created using the first image map.
In the embodiment, the circle component can be used as a storage mirror image drive of the pane, the storage drive of the circle is SAN storage, a request for creating a volume is sent to the circle every time when the mirror image pane is uploaded, then mirror image data can be written into the volume created by the circle.
It should be noted that, for simplicity of description, the above-mentioned method embodiments are described as a series of acts or combination of acts, but those skilled in the art will recognize that the present invention is not limited by the order of acts, as some steps may occur in other orders or concurrently in accordance with the invention. Further, those skilled in the art should also appreciate that the embodiments described in the specification are preferred embodiments and that the acts and modules referred to are not necessarily required by the invention.
According to another aspect of the embodiments of the present application, there is also provided a mirror storage device of a storage area network, as shown in fig. 5, including:
a receiving module 502, configured to receive a mirror image upload request of a client, where the mirror image upload request is used to request to upload a target mirror image;
a sending module 504, configured to send a creation request to the 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 a target image in a storage area network;
the first creating module 506 is configured to locally connect the first storage space with the client after the cloud disk management module creates the first storage space;
a writing module 508, configured to write mirror image data of a local target mirror image of the client into the first storage space;
and the processing module 510 is configured to disconnect the local connection between the first storage space and the client after the mirror image data is written, and write the mirror image metadata of the target mirror image into the database.
Optionally, the present embodiment may be, but is not limited to, applied to a process of storing an image. The image in this embodiment may be a template in which an operating system has been installed for creating virtual machines, and the virtual machines may be created in batch by the image.
Optionally, a Storage Area Network (SAN) in this embodiment adopts a Fibre Channel (Fibre Channel) technology, and connects the Storage array and the server host through a Fibre Channel switch, so as to establish an Area Network dedicated to data Storage.
Optionally, in this embodiment, when the client wants to upload the image, the client may receive an image upload request of the client, send a creation request to the cloud disk management module, create a first storage space in the storage area network by the cloud disk management module, connect the first storage space with the client, and write image data of the client into the first storage space after the connection. And after the writing is finished, disconnecting the connection, and writing the mirror pixel data into the database.
In the method, when the mirror image is stored, the creation request is sent to the cloud disk management module, the cloud disk management module sends the creation request to open up the first storage space in the storage area network, the connection is established between the first storage space and the client, and the mirror image is written into the first storage space to store the mirror image, so that the aim of improving the efficiency of the storage mirror image is fulfilled.
As an optional implementation, the processing module includes:
the first processing unit is used for disconnecting the connection when the last byte of the mirror image data is written into the database, and writing the mirror image metadata of the mirror image data into the database; or
And the second processing unit is used for disconnecting the connection after the preset time after the last byte of the mirror image data is written into the database, and writing the mirror image metadata of the mirror image data into the database.
Optionally, in this embodiment, if the target image is uploaded to the first storage space, the connection relationship may be disconnected immediately, or may be disconnected after a predetermined time period. The immediate disconnection relation can reduce the occupation of bandwidth, and the disconnection relation after a preset time can improve the accuracy of uploading the target mirror image.
As an optional implementation, the creating module includes:
the identification unit is used for identifying a target field in the mirror image uploading request, wherein the target field is used for marking a target object for creating the first storage space;
and the sending unit is used for sending a creation request to the cloud disk management module under the condition that the target field indicates that the target object is the cloud disk management module.
In this embodiment, the storage location to which the first storage space is to be allocated may be marked by a character flag in the allocation statement. For example, the allocation statement is analyzed, the character mark in the allocation statement is analyzed, and if the character mark is the target character mark, the first storage space is allocated in the storage area network. If the character tag is other character tags, for example, the first character tag, then the first storage space is allocated in the distributed network. For example, if the character mark is the second character mark, the first storage space is allocated in the direct connection type storage. The allocation of the first storage space to the storage target image is determined by setting different character flags in the allocation statement.
Optionally, in this embodiment, the location of the first storage space in the storage area network or the size of the first storage space may also be determined according to characters in the allocation statement. Different characters correspond to different positions or sizes.
As an optional implementation, the apparatus further includes:
the configuration module is used for configuring the corresponding relation between the fields and the objects in the configuration file;
the storage module is used for storing the newly added corresponding relation into the configuration file under the condition of receiving a newly added instruction of the newly added corresponding relation; or
And the deleting module is used for deleting the corresponding relation indicated by the deleting instruction in the configuration file under the condition of receiving the deleting instruction for deleting the corresponding relation.
Optionally, the configuration file in this embodiment includes an allocation statement, and a character flag in the allocation statement may be adjusted. In this embodiment, before the first storage space is allocated, the character flag in the allocation statement may be adjusted to be the target character flag, so that the adjusted allocation statement may be used to allocate the first storage space for the target mirror image. The content in the configuration file may be modified according to the add instruction and the delete instruction.
As an optional implementation, the apparatus further includes:
the system comprises an acquisition module, a storage module and a processing module, wherein the acquisition module is used for acquiring a creation request after image data of a local target image of a client is written into a first storage space, and the creation request is used for requesting to create a virtual machine;
the system comprises a determining module, a judging module and a judging module, wherein the determining module is used for determining a first mirror image used for creating a virtual machine in all mirror images in a storage area network;
a second creation module to create a virtual machine using the first image.
Optionally, in this embodiment, after the target image is stored in the first storage space, a creation request may be received, where the creation request is used to request creation of a virtual machine. After receiving a creation request to create a virtual machine, an image corresponding to the virtual machine to be created may be determined. Different images correspondingly create different virtual machines. And determining a first image of the virtual machine to be created according to the creation request, and then creating the virtual machine through the first image.
As an optional implementation, the determining module includes:
a searching unit, configured to search, according to the target identifier of the mirror image included in the creation request, a mirror image whose mirror image identifier is the same as the target identifier in all mirror images in the storage area network;
and the determining unit is used for determining the searched mirror image as a first mirror image.
Optionally, in this embodiment, the first image to be used for creating the virtual machine may be determined according to a target flag of the image included in the creation request. After the creation request is acquired, acquiring a target mark of a mirror image in the creation request, then comparing the mark with mirror image marks of all mirror images, determining a mirror image with the same mark as the target mark from all mirror images, and using the mirror image as a first mirror image to create the virtual machine.
As an optional implementation manner, the second creating module includes:
and the mapping unit is used for mapping the first mirror image in the first storage space into the second storage space so as to create the virtual machine.
Optionally, in this embodiment, after determining to create the first image of the virtual machine, the first image is stored in the first storage space. The first image may be mapped into a second storage space, thereby creating a virtual machine.
According to still another aspect of the embodiments of the present invention, there is also provided an electronic device for implementing the mirror storage method of the storage area network, where the electronic device may include a memory and a processor, the memory stores therein a computer program, and the processor is configured to execute the steps in the mirror storage method of the storage area network through the computer program.
According to still another aspect of embodiments of the present invention, there is also provided a computer-readable storage medium having a computer program stored therein, wherein the computer program is configured to execute the steps in the mirror image storage method of the storage area network when running.
Alternatively, in this embodiment, a person skilled in the art may understand that all or part of the steps in the methods of the foregoing embodiments may be implemented by a program instructing hardware associated with the terminal device, where the program may be stored in a computer-readable storage medium, and the storage medium may include: flash disks, Read-Only memories (ROMs), Random Access Memories (RAMs), magnetic or optical disks, and the like.
The above-mentioned serial numbers of the embodiments of the present invention are merely for description and do not represent the merits of the embodiments.
The integrated unit in the above embodiments, if implemented in the form of a software functional unit and sold or used as a separate product, may be stored in the above computer-readable storage medium. Based on such understanding, the technical solution of the present invention may be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for causing one or more computer devices (which may be personal computers, servers, network devices, etc.) to execute all or part of the steps of the method according to the embodiments of the present invention.
In the above embodiments of the present invention, the descriptions of the respective embodiments have respective emphasis, and for parts that are not described in detail in a certain embodiment, reference may be made to related descriptions of other embodiments.
In the several embodiments provided in the present application, it should be understood that the disclosed client may be implemented in other manners. The above-described embodiments of the apparatus are merely illustrative, and for example, the division of the units is only one type of division of logical functions, and there may be other divisions when actually implemented, for example, a plurality of units or components may be combined or may be integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, units or modules, and may be in an electrical or other form.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present invention may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, and can also be realized in a form of a software functional unit.
The foregoing is only a preferred embodiment of the present invention, and it should be noted that, for those skilled in the art, various modifications and decorations can be made without departing from the principle of the present invention, and these modifications and decorations should also be regarded as the protection scope of the present invention.