Data acquisition method, device and equipment
By obtaining mirror configuration information and determining the target mirror volume, the problem of low virtual machine creation speed is solved, and the efficiency of virtual machine creation and load balancing of mirror volumes is improved.
Patent Information
- Application Number
- CN202411649067.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-18
- Publication Date
- 2025-03-11
AI Technical Summary
When creating multiple virtual machines, serially obtains data from each mirrored volume, resulting in reduced virtual machine creation speed and inefficient efficiency.
By obtaining the mirror configuration information, determine the target mirror volume corresponding to each virtual machine, and obtain data in the target mirror volume to improve the efficiency of virtual machine creation.
It avoids serial data acquisition when multiple virtual machines are created simultaneously, improves the speed and efficiency of virtual machine creation, and enables load balancing of the use of mirrored volumes.
Smart Images

Figure CN119597401A_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present application relate to the field of computer technology, and in particular, to a data acquisition method, device and equipment. Background Art
[0002] When creating a virtual machine, you can obtain data from the image cache to increase the speed of creating the virtual machine. Therefore, the creation and management of the image cache is crucial to virtual machine creation.
[0003] In actual application, when creating a virtual machine, data is obtained from each mirror volume in series. In the above process, if multiple virtual machines are created at the same time, obtaining data from each mirror volume in series in series will reduce the speed of creating the virtual machine, resulting in low efficiency of virtual machine creation. Summary of the invention
[0004] The embodiments of the present application provide a data acquisition method, apparatus and device to solve the problem of low efficiency in virtual machine creation.
[0005] In a first aspect, an embodiment of the present application provides a data acquisition method, comprising:
[0006] Obtaining a data acquisition request, where the data acquisition request is a request generated when creating at least one virtual machine;
[0007] Acquire mirror configuration information according to the data acquisition request, the mirror configuration information including a first identifier of at least one mirror cache area, a second identifier of at least one mirror volume stored in each mirror cache area, and a first number of at least one mirror volume stored in each mirror cache area;
[0008] According to the mirror configuration information, determining a target mirror volume corresponding to each virtual machine in at least one mirror volume stored in each mirror cache area;
[0009] At least one data is obtained from the target mirror volume corresponding to each virtual machine, so as to be used for creating the at least one virtual machine.
[0010] In the embodiment of the present application, when determining the target mirror volume corresponding to each virtual machine according to the mirror configuration information, the target mirror volume corresponding to each virtual machine can be determined based on the number of mirror volumes in each mirror cache area. This avoids the situation where serially obtaining data from each mirror volume in sequence when creating multiple virtual machines at the same time will reduce the speed of creating the virtual machine, thereby improving the efficiency of virtual machine creation.
[0011] In a possible implementation, determining, according to the mirror configuration information, a target mirror volume corresponding to each virtual machine in at least one mirror volume stored in each mirror cache area includes:
[0012] Get the preset value;
[0013] According to the preset value and the mirror configuration information, a target mirror volume corresponding to each virtual machine is determined in at least one mirror volume stored in each mirror cache area.
[0014] In the embodiment of the present application, it is determined according to a preset value whether the target mirror volume corresponding to each virtual machine is determined in at least one mirror volume stored in each mirror cache area, thereby avoiding the situation where the user cannot obtain the first quantity equal to the preset value, resulting in the blocking of the virtual machine creation process, thereby improving the user experience.
[0015] In a possible implementation, determining, according to the preset value and the mirror configuration information, a target mirror volume corresponding to each virtual machine in at least one mirror volume stored in each mirror cache area includes:
[0016] If the first number is greater than the preset value, a preset algorithm is obtained, and according to the preset algorithm and the mirror configuration information, a target mirror volume corresponding to each virtual machine is determined in at least one mirror volume stored in each mirror cache area.
[0017] In the embodiment of the present application, the preset algorithm can randomly determine the target mirror volume corresponding to each virtual machine in at least one mirror volume when creating a virtual machine. In this way, each virtual machine can uniformly and randomly obtain data in the corresponding target mirror volume.
[0018] In a possible implementation, determining a target mirror volume corresponding to each virtual machine in at least one mirror volume stored in each mirror cache area according to the preset algorithm and the mirror configuration information includes:
[0019] Determine at least one mirror volume to be selected from at least one mirror volume stored in each mirror cache area according to the mirror configuration information;
[0020] According to the preset algorithm, a target mirror volume corresponding to each virtual machine is determined in the at least one mirror volume to be selected, and the preset algorithm is used to determine that the target mirror volume corresponding to each virtual machine is evenly distributed in the at least one mirror cache area.
[0021] In the embodiment of the present application, the preset algorithm is used to determine that the target mirror volume corresponding to each virtual machine is evenly distributed in the at least one mirror cache area. This avoids the situation where, when creating multiple virtual machines at the same time, serially obtaining data from each mirror volume in turn will reduce the speed of creating the virtual machine. This allows the use of mirror volumes to achieve load balancing, ensuring the speed and performance of each virtual machine obtaining data.
[0022] In a possible implementation, determining at least one mirror volume to be selected from at least one mirror volume stored in each mirror cache area according to the mirror configuration information includes:
[0023] In the image cache area, determining at least one to-be-selected cache area, wherein a second number of the image volumes not used to create the virtual machine in the to-be-selected cache area is greater than or equal to a preset number;
[0024] In each to-be-selected cache area, a mirror volume that is not used to create a virtual machine is determined as the to-be-selected mirror volume.
[0025] In the embodiment of the present application, before determining the target mirror volume, at least one candidate area where there are many mirror volumes that are not currently used to create a virtual machine is first determined. In this way, the target mirror volumes can be more accurately evenly distributed in each mirror cache area.
[0026] In a possible implementation, the method further includes:
[0027] If the first number is less than the preset value, a prompt message is generated, where the prompt message is used to indicate that the target mirror volume does not exist in at least one mirror volume stored in each mirror cache area;
[0028] Display or send the prompt information to a preset device.
[0029] In the embodiment of the present application, the user can be prompted that the target mirror volume does not currently exist to obtain data. The user can set or adjust according to the prompt to avoid the situation where the user cannot obtain the data when the first number is equal to the preset value, resulting in the blocking of the virtual machine creation process.
[0030] In a possible implementation, the method further includes:
[0031] If the first number is less than or equal to the preset value, control the storage device to clone and copy the mirror volume to obtain at least one copy mirror volume, so that the at least one copy mirror volume is used to create a virtual machine;
[0032] The storage device includes at least one mirror cache area, and the mirror cache area includes at least one mirror volume.
[0033] In the embodiment of the present application, cloning and copying can avoid the situation where the mirror volume does not exist and data cannot be obtained when the virtual machine is created next time, thereby improving the user experience.
[0034] In a possible implementation, the method further includes:
[0035] For any mirror volume, if it is determined that no data exists in the mirror volume, or the valid period corresponding to the data stored in the mirror volume does not match the current period, the mirror volume is deleted.
[0036] In the embodiment of the present application, it is convenient to store new mirror volumes for creating virtual machines, thereby improving the flexibility of virtual machine creation.
[0037] In a second aspect, an embodiment of the present application provides a data acquisition device, the device comprising:
[0038] A first acquisition module, used to acquire a data acquisition request, where the data acquisition request is a request generated when the virtual machine is created;
[0039] A second acquisition module, configured to acquire mirror configuration information according to the data acquisition request, wherein the mirror configuration information includes a first identifier of at least one mirror cache area, a second identifier of at least one mirror volume stored in each mirror cache area, and a first number of at least one mirror volume stored in each mirror cache area;
[0040] A determination module, configured to determine a target mirror volume from at least one mirror volume stored in each mirror cache area according to the mirror configuration information;
[0041] The third acquisition module is used to acquire at least one data in the target mirror volume for creating a virtual machine.
[0042] In a possible implementation manner, the determining module is specifically configured to:
[0043] Get the preset value;
[0044] According to the preset value and the mirror configuration information, a target mirror volume corresponding to each virtual machine is determined in at least one mirror volume stored in each mirror cache area.
[0045] In a possible implementation manner, the determining module is specifically configured to:
[0046] If the first number is greater than the preset value, a preset algorithm is obtained, and according to the preset algorithm and the mirror configuration information, a target mirror volume corresponding to each virtual machine is determined in at least one mirror volume stored in each mirror cache area.
[0047] In a possible implementation manner, the determining module is specifically configured to:
[0048] Determine at least one mirror volume to be selected from at least one mirror volume stored in each mirror cache area according to the mirror configuration information;
[0049] According to the preset algorithm, a target mirror volume corresponding to each virtual machine is determined in the at least one mirror volume to be selected, and the preset algorithm is used to determine that the target mirror volume corresponding to each virtual machine is evenly distributed in the at least one mirror cache area.
[0050] In a possible implementation manner, the determining module is specifically configured to:
[0051] In the image cache area, determining at least one to-be-selected cache area, wherein a second number of the image volumes not used to create the virtual machine in the to-be-selected cache area is greater than or equal to a preset number;
[0052] In each to-be-selected cache area, a mirror volume that is not used to create a virtual machine is determined as the to-be-selected mirror volume.
[0053] In a possible implementation, the device further includes a generating module, a processing module and a deleting module.
[0054] Wherein, the generating module is used for:
[0055] If the first number is less than the preset value, a prompt message is generated, where the prompt message is used to indicate that the target mirror volume does not exist in at least one mirror volume stored in each mirror cache area;
[0056] Display or send the prompt information to a preset device.
[0057] The processing module is used for:
[0058] If the first number is less than or equal to the preset value, control the storage device to clone and copy the mirror volume to obtain at least one copy mirror volume, so that the at least one copy mirror volume is used to create a virtual machine;
[0059] The storage device includes at least one mirror cache area, and the mirror cache area includes at least one mirror volume.
[0060] The deletion module is used to:
[0061] For any mirror volume, if it is determined that no data exists in the mirror volume, or the valid period corresponding to the data stored in the mirror volume does not match the current period, the mirror volume is deleted.
[0062] In a third aspect, an embodiment of the present application provides a data acquisition device, including:
[0063] at least one processor; and
[0064] a memory communicatively connected to the at least one processor; wherein,
[0065] The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can perform any method described in the first aspect.
[0066] In a fourth aspect, an embodiment of the present application provides a non-transitory computer-readable storage medium storing computer instructions, wherein the computer instructions are used to enable the computer to execute any one of the methods described in the first aspect.
[0067] In a fifth aspect, an embodiment of the present application provides a computer program product, including a computer program, which implements any method in the first aspect when executed by a processor.
[0068] The data acquisition method, device and equipment provided in the embodiment of the present application obtain mirror configuration information after determining to create at least one virtual machine. And according to the mirror configuration information, determine the target mirror volume corresponding to each virtual machine in at least one mirror volume stored in each mirror cache area. Obtain at least one data in the target mirror volume corresponding to each virtual machine for creating at least one virtual machine. In the above process, since the mirror configuration information includes a first identifier of at least one mirror cache area, a second identifier of at least one mirror volume stored in each mirror cache area, and a first number of at least one mirror volume stored in each mirror cache area. When determining the target mirror volume corresponding to each virtual machine according to the mirror configuration information, the target mirror volume corresponding to each virtual machine can be determined based on the number of mirror volumes in each mirror cache area. This avoids the situation where serially obtaining data from each mirror volume in turn when creating multiple virtual machines at the same time will reduce the speed of creating the virtual machine, thereby improving the efficiency of virtual machine creation. BRIEF DESCRIPTION OF THE DRAWINGS
[0069] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.
[0070] Figure 1 A schematic diagram of an application scenario provided by an embodiment of the present application;
[0071] Figure 2 A flowchart of a data acquisition method provided in an embodiment of the present application;
[0072] Figure 3 A schematic diagram of a process for obtaining a data acquisition request provided in an embodiment of the present application;
[0073] Figure 4 A flowchart of another data acquisition method provided in an embodiment of the present application;
[0074] Figure 5A schematic diagram of the process of creating a virtual machine provided in an embodiment of the present application;
[0075] Figure 6 A schematic diagram of the data acquisition process provided in the embodiment of the present application;
[0076] Figure 7 A schematic diagram of the structure of a data acquisition device provided in an embodiment of the present application;
[0077] Figure 8 A schematic diagram of the structure of another data acquisition device provided in an embodiment of the present application;
[0078] Fig. 9 A schematic diagram of the structure of a data acquisition device provided in an embodiment of the present application.
[0079] The above drawings have shown clear embodiments of the present application, which will be described in more detail later. These drawings and text descriptions are not intended to limit the scope of the present application in any way, but to illustrate the concept of the present application to those skilled in the art by referring to specific embodiments. DETAILED DESCRIPTION
[0080] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, the same numbers in different drawings represent the same or similar elements unless otherwise indicated. The implementations described in the following exemplary embodiments do not represent all implementations consistent with the present application. Instead, they are merely examples of devices and methods consistent with some aspects of the present application as detailed in the appended claims.
[0081] It should be noted that, in this article, the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the sentence "comprises a ..." does not exclude the existence of other identical elements in the process, method, article or device including the element.
[0082] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with relevant laws, regulations and standards, and provide corresponding operation entrances for users to choose to authorize or refuse.
[0083] For ease of understanding, below, combined Figure 1 , the application scenarios to which the embodiments of the present application are applicable are described.
[0084] Figure 1 This is a schematic diagram of an application scenario provided by an embodiment of the present application. Figure 1 , including a terminal device 101 and a server 102. The terminal device 101 is provided with an application program, and a user can create a virtual machine through the application program of the terminal device 101. The server 102 is provided with an image cache area, and the image cache area includes an image volume, and the image volume stores at least one data. When creating a virtual machine, the terminal device 101 obtains at least one data from the image volume in the server 102 for installing an operating system on the virtual machine.
[0085] In actual application, when creating a virtual machine, data is obtained from each mirror volume in series. In the above process, if multiple virtual machines are created at the same time, obtaining data from each mirror volume in series in series will reduce the speed of creating the virtual machine, resulting in low efficiency of virtual machine creation.
[0086] In an embodiment of the present application, after determining to create at least one virtual machine, image configuration information is obtained. And based on the image configuration information, the target image volume corresponding to each virtual machine is determined in at least one image volume stored in each image cache area. At least one data is obtained in the target image volume corresponding to each virtual machine for creating at least one virtual machine. In the above process, since the image configuration information includes a first identifier of at least one image cache area, a second identifier of at least one image volume stored in each image cache area, and a first number of at least one image volume stored in each image cache area. When determining the target image volume corresponding to each virtual machine based on the image configuration information, the target image volume corresponding to each virtual machine can be determined based on the number of image volumes in each image cache area. This avoids the situation where serially obtaining data from each image volume in turn when creating multiple virtual machines at the same time will reduce the speed of creating the virtual machine, thereby improving the efficiency of virtual machine creation.
[0087] The method shown in the present application is described below through specific embodiments. It should be noted that the following embodiments can exist independently or in combination with each other, and the same or similar contents will not be described repeatedly in different embodiments.
[0088] Figure 2 A flow chart of a data acquisition method provided in an embodiment of the present application. Figure 2 , the method may include:
[0089] S201: Obtain a data acquisition request.
[0090] The execution subject of the embodiment of the present application may be a data acquisition device, or a data acquisition device arranged in the data acquisition device. The data acquisition device may be implemented by software, or by a combination of software and hardware. The data acquisition device may be a server.
[0091] The data acquisition request is a request generated when at least one virtual machine is created.
[0092] When creating a virtual machine, it is necessary to obtain at least one data from the image cache area for installing an operating system on the virtual machine. Therefore, the terminal device generates a data acquisition request in response to the user's request operation to create a virtual machine.
[0093] Next, combine Figure 3 , the process of obtaining a data acquisition request is explained. Figure 3 A schematic diagram of the process of obtaining a data acquisition request provided in an embodiment of the present application. Figure 3 , including interface 301 to interface 302. Interface 301 to interface 302 may be pages provided for the terminal device. Referring to interface 301, the user clicks the icon corresponding to the application in the main page of the terminal device. The application is used to create a virtual machine. The terminal device displays the operation page in response to the user's click operation. The operation page includes a drop-down selection menu corresponding to the virtual machine identifier, a drop-down selection menu corresponding to the configuration information, and a text input box.
[0094] Referring to interface 302, the user determines in the drop-down selection menu corresponding to the virtual machine identifier that the virtual machine identifier includes virtual machine A1, virtual machine A2, and virtual machine A3, determines in the drop-down selection menu corresponding to the configuration information that the configuration information is configuration information A, and clicks the create icon. The terminal device generates a data acquisition request in response to the user's input selection operation. The data acquisition request is a request generated when creating virtual machines A1, virtual machines A2, and virtual machines A3.
[0095] The configuration information includes at least the installation source, the type of operating system, the version of the operating system, the disk capacity of the virtual machine, etc.
[0096] S202: Obtain mirror configuration information according to the data acquisition request.
[0097] The mirror configuration information includes a first identifier of at least one mirror cache area, a second identifier of at least one mirror volume stored in each mirror cache area, and a first number of at least one mirror volume stored in each mirror cache area.
[0098] At least one mirror cache area may be set in one server or in multiple servers, which is not limited in this application.
[0099] Each mirror cache area stores at least one mirror volume, and a first quantity of the at least one mirror volume is less than or equal to a rated quantity.
[0100] You can obtain the image configuration information through the image service in the data acquisition device.
[0101] For example, according to the above example, the data acquisition request is a request generated when creating virtual machines A1, A2, and A3. The image service in the data acquisition device obtains the image configuration information according to the data acquisition request, which can be specifically shown in Table 1:
[0102] Table 1
[0103] First logo Second mark First quantity Image cache area A1 Mirror volume A11, mirror volume A12, mirror volume A13 3 Image cache area A2 Mirror volume A21, mirror volume A22 2 Image cache area A3 Mirror volume A32, mirror volume A34, mirror volume A36, mirror volume A37 4
[0104] S203: Determine, according to the mirror configuration information, a target mirror volume corresponding to each virtual machine in at least one mirror volume stored in each mirror cache area.
[0105] The target mirror volume corresponding to each virtual machine can be determined in at least one mirror volume stored in each mirror cache area according to the mirror configuration information in the following manner: obtaining a preset value; and determining the target mirror volume corresponding to each virtual machine in at least one mirror volume stored in each mirror cache area according to the preset value and the mirror configuration information.
[0106] If the first number is greater than a preset value, a preset algorithm is obtained, and according to the preset algorithm and the mirror configuration information, a target mirror volume corresponding to each virtual machine is determined in at least one mirror volume stored in each mirror cache area.
[0107] The preset algorithm and preset value may be set in advance, and the preset algorithm and preset value may be stored in a preset storage space of the data acquisition device. The preset value may be 0. The preset algorithm may be a Finsher-Yates shuffling algorithm.
[0108] The preset algorithm can randomly determine the target mirror volume corresponding to each virtual machine in at least one mirror volume when creating a virtual machine. In this way, each virtual machine can obtain data from the corresponding target mirror volume uniformly and randomly. This avoids the situation where obtaining data from each mirror volume in series when creating multiple virtual machines at the same time will reduce the speed of creating virtual machines. In this way, the use of mirror volumes can achieve load balancing, ensuring the speed and performance of each virtual machine in obtaining data.
[0109] For example, according to the mirror configuration information shown in Table 1 above, it can be determined that the first number is greater than the preset value 0. Therefore, the data acquisition device can obtain a preset algorithm in a preset storage space. And according to the preset algorithm and the mirror configuration information, the target mirror volume corresponding to each virtual machine is determined in at least one mirror volume stored in each mirror cache area. The target mirror volumes corresponding to virtual machines A1, A2, and A3 can be specifically shown in Table 2:
[0110] Table 2
[0111] Virtual Machines Target mirror volume Virtual Machine A1 Mirror volume A11 Virtual Machine A2 Mirror volume A32 Virtual Machine A3 Mirror volume A37
[0112] S204: Obtain at least one data in the target mirror volume corresponding to each virtual machine, for use in creating at least one virtual machine.
[0113] For example, according to Table 2 above, the data acquisition device can acquire at least one data in the mirror volume A11 for creating the virtual machine A1. The data acquisition device can acquire at least one data in the mirror volume A32 for creating the virtual machine A2. The data acquisition device can acquire at least one data in the mirror volume A37 for creating the virtual machine A3.
[0114] The data acquisition method provided in the embodiment of the present application obtains a data acquisition request. According to the data acquisition request, image configuration information is obtained. According to the image configuration information, the target image volume corresponding to each virtual machine is determined in at least one image volume stored in each image cache area. At least one data is obtained in the target image volume corresponding to each virtual machine for creating at least one virtual machine. In the above process, since the image configuration information includes a first identifier of at least one image cache area and a first number of at least one image volume stored in each image cache area. When determining the target image volume corresponding to each virtual machine according to the image configuration information, the target image volume corresponding to each virtual machine can be determined based on the number of image volumes in each image cache area. This avoids the situation where serially obtaining data from each image volume in turn when creating multiple virtual machines at the same time will reduce the speed of creating the virtual machine, thereby improving the efficiency of virtual machine creation.
[0115] Based on any of the above embodiments, Figure 4 , the detailed process of data acquisition is explained.
[0116] Figure 4 This is a flow chart of another data acquisition method provided in an embodiment of the present application. Figure 4 , the method comprising:
[0117] S401: Obtain a data acquisition request.
[0118] It should be noted that the execution process of S401 can refer to S201 and will not be repeated here.
[0119] S402: Obtain mirror configuration information according to the data acquisition request.
[0120] The data acquisition device is provided with a control service and a mirror service. The data acquisition device can establish a connection with a computing device. A plurality of computing services are provided in the computing device. After receiving a data acquisition request, the data acquisition device can send a data acquisition request to the computing device, and the computing service in the computing device calls the mirror service in the data acquisition device to obtain the mirror configuration information according to the data acquisition request. The data acquisition device and the computing device can be servers.
[0121] S403: Obtain a preset value.
[0122] The default value can be 0.
[0123] S404: If the first number is greater than a preset value, obtain a preset algorithm.
[0124] If the first number is greater than the preset value, it can be determined that there is a mirror volume in the mirror cache area, and the data acquisition device can acquire data from the mirror volume. Therefore, the data acquisition device acquires a preset algorithm and determines the target mirror volume through the preset algorithm.
[0125] S405: Determine at least one mirror volume to be selected from at least one mirror volume stored in each mirror cache area according to the mirror configuration information.
[0126] At least one mirror volume to be selected can be determined from at least one mirror volume stored in each mirror cache area according to the mirror configuration information in the following manner: in the mirror cache area, at least one mirror volume to be selected is determined, and the second number of mirror volumes in the mirror cache area that are not used to create a virtual machine is greater than or equal to a preset number; in each mirror cache area that is to be selected, a mirror volume that is not used to create a virtual machine is determined as a mirror volume to be selected.
[0127] The mirror volume that is not used to create the virtual machine may be a mirror volume that was used before and is not currently deleted, or a copied mirror volume obtained by the storage device through volume copy processing.
[0128] The preset number may be set in advance and stored in a preset storage space of the data acquisition device.
[0129] For example, assuming that the data acquisition request is a request generated when creating virtual machines B1 and B2, the mirror service in the data acquisition device obtains the mirror configuration information according to the data acquisition request, which can be specifically shown in Table 3:
[0130] Table 3
[0131] First logo Second mark First quantity Image cache area B1 Mirror volume B11, mirror volume B12, mirror volume B13 3 Image cache area B2 Mirror volume B21, mirror volume B22 2 Image cache area B3 Mirror volume B32, mirror volume B33, mirror volume B35 3
[0132] As shown in Table 3, the data acquisition device determines that in the mirror cache area B1, mirror volume B12 and mirror volume B13 are not used to create a virtual machine. In the mirror cache area B2, mirror volume B21 is not used to create a virtual machine. The data acquisition device determines that in the mirror cache area B3, mirror volume B33 and mirror volume B35 are not used to create a virtual machine. Assuming that the preset number is 1, it can be determined that the second number of mirror volumes that are not used to create a virtual machine in the mirror cache area B1 and the mirror cache area B3 is greater than or equal to the preset number. Therefore, the data acquisition device determines that at least one to-be-selected cache area includes the mirror cache area B1 and the mirror cache area B3, and at least one to-be-selected mirror volume includes mirror volume B12, mirror volume B13, mirror volume B33, and mirror volume B35.
[0133] Before determining the target mirror volume, first determine at least one candidate area where there are many mirror volumes that are not currently used to create a virtual machine. In this way, the target mirror volumes can be more accurately evenly distributed in each mirror cache area, avoiding the situation where multiple mirror volumes in the same mirror cache area are used to create a virtual machine at the same time, resulting in a slow virtual machine creation speed.
[0134] S406: Determine a target mirror volume corresponding to each virtual machine from at least one mirror volume to be selected according to a preset algorithm.
[0135] The preset algorithm is used to determine that the target mirror volume corresponding to each virtual machine is evenly distributed in at least one mirror cache area.
[0136] For example, according to the above example, it is determined that at least one mirror volume to be selected includes mirror volume B12, mirror volume B13, mirror volume B33, and mirror volume B35. The data acquisition device determines that the target mirror volume corresponding to the virtual machine B1 is mirror volume B12 in the at least one mirror volume to be selected, and determines that the target mirror volume corresponding to the virtual machine B2 is mirror volume B33 according to a preset algorithm.
[0137] S407: If the first number is equal to a preset value, a prompt message is generated.
[0138] The prompt information is used to indicate that the target mirror volume does not exist in at least one mirror volume stored in each mirror cache area.
[0139] If the first number is equal to the preset value 0, it indicates that there is no mirror volume in the mirror cache area. Therefore, it is impossible to obtain data to create a virtual machine.
[0140] When the first number is equal to the preset value, a prompt message is generated. The user can be prompted that the target mirror volume does not currently exist to obtain data. The user can set or adjust according to the prompt to avoid the situation where the user cannot obtain the data when the first number is equal to the preset value, resulting in the blocking of the virtual machine creation process.
[0141] If the first number is equal to a preset value, the storage device is controlled to copy and clone the mirror volume to obtain at least one copy mirror volume, so that the at least one copy mirror volume is used to create a virtual machine; wherein the storage device includes at least one mirror cache area, and the mirror cache area includes at least one mirror volume.
[0142] If the first number is equal to the preset value 0, it indicates that there is no mirror volume in the mirror cache area. At this time, the data acquisition device can control the storage device to clone and copy the mirror volume. The storage device can be a server.
[0143] The storage device can clone and copy the mirror volume in the following manner: determine the associated storage device corresponding to the storage device, the data stored in the mirror volume in the associated storage device is the same as the data obtained by currently creating the virtual machine; the storage device stores the mirror volume in the associated storage device to the mirror cache area in the storage device through volume copy processing; the storage device copies the mirror volume to obtain at least one copy mirror volume, and stores at least one copy mirror volume to the mirror cache area.
[0144] It should be noted that when performing copy processing, the storage device needs to obtain the maximum number of mirror volumes that can be stored in each mirror cache area, and when determining that the number of at least one copy mirror volume and at least one mirror volume is equal to the maximum number during the volume copy process, the volume copy is stopped.
[0145] When it is determined that the first number is equal to the preset value, performing cloning and copying can avoid the situation where the mirror volume does not exist and data cannot be obtained when a virtual machine is created next time, thereby improving the user experience.
[0146] For example, assume that the data acquisition request is a request generated when creating virtual machine B3. The image service in the data acquisition device obtains the image configuration information according to the data acquisition request, and determines that the first number of at least one image volume stored in the image cache area B1 and the image cache area B2 is a preset value of 0. At this time, the data acquisition device generates prompt information and sends the prompt information to the terminal device used by the user. The prompt information is used to indicate that the target image volume does not exist in the at least one image volume stored in each image cache area. The data acquisition device controls the storage device to copy the image volume through the storage interface.
[0147] For any mirror volume, if it is determined that no data exists in the mirror volume, or the valid period corresponding to the data stored in the mirror volume does not match the current period, the mirror volume is deleted.
[0148] When there is no data in the mirror volume or the data is expired, you can delete the mirror volume.
[0149] Optionally, when it is determined that the mirror cache area is not needed, the entire mirror cache area can be directly deleted. In this case, the mirror volumes in the mirror cache area will also be deleted.
[0150] When it is determined that there is no data in the mirror volume or the data is expired, the mirror volume can be deleted, so that a new mirror volume can be stored for creating a virtual machine, which improves the flexibility of virtual machine creation.
[0151] When creating a virtual machine, computing devices, data acquisition devices, and storage devices need to work together. Figure 5 , describes the process of creating a virtual machine.
[0152] Figure 5 A schematic diagram of the process of creating a virtual machine provided in the embodiment of the present application. Figure 5 , including a data acquisition device 501, a computing device 502 and a storage device cluster 503. The data acquisition device 501 and the computing device 502 can be servers. The data acquisition device includes a management service and K mirror services. The computing device includes N computing services and a quota management service. The storage device cluster 503 includes M storage devices, each storage device includes a mirror cache area, and the mirror cache area includes at least one mirror volume. The storage device can be a server.
[0153] After the management service of the data acquisition device 501 obtains the data acquisition request, it sends the data acquisition request to the computing device 502. The computing device 502 determines the computing service corresponding to each virtual machine to be created according to the data acquisition request. The computing service of the computing device 502 calls the image service of the management node to obtain the image configuration information. The image service of the data acquisition device 502 obtains the image configuration information. And according to the above method, the target image volume corresponding to each virtual machine is determined. The image service of the data acquisition device 502 obtains data from the target image volume corresponding to each virtual machine through the storage interface and creates a virtual machine.
[0154] The quota management service in the computing device 502 is used to set the maximum number of mirror volumes stored in each mirror cache area. The storage devices in the storage cluster 503 can copy the mirror volumes in the mirror cache areas of other storage devices in the storage cluster 503 through copying. The mirror volumes in the mirror cache areas can be cloned to obtain new mirror volumes.
[0155] Optionally, when the user obtains the image configuration information through the page provided by the terminal device, the data acquisition device controls the storage device in response to the user's operation to detect whether the image volumes stored in the image storage area are the maximum number. And determine whether to perform volume copy processing. In this way, it can be determined in advance whether it is necessary to copy the image volumes required for creating a virtual machine before the user creates a virtual machine, and it can be processed asynchronously without affecting the user's operation and the creation of the virtual machine, thereby improving the user experience.
[0156] S408: Display or send a prompt message to a preset device.
[0157] The preset device may be a terminal device used by the user.
[0158] S409: Obtain at least one data in the target mirror volume corresponding to each virtual machine, for use in creating at least one virtual machine.
[0159] For example, according to the above example, the target mirror volume corresponding to virtual machine B1 is determined to be mirror volume B12, and the target mirror volume corresponding to virtual machine B2 is determined to be mirror volume B33. The data acquisition device acquires data from mirror volume B12 for creating virtual machine B1, and acquires data from mirror volume B33 for creating virtual machine B2.
[0160] The data acquisition method provided in the embodiment of the present application obtains a data acquisition request. According to the data acquisition request, image configuration information is obtained. A preset value is obtained. If the first number is greater than the preset value, a preset algorithm is obtained. According to the image configuration information, at least one image volume to be selected is determined in at least one image volume stored in each image cache area. According to the preset algorithm, a target image volume corresponding to each virtual machine is determined in at least one image volume to be selected. If the first number is equal to the preset value, a prompt message is generated, and the storage device is controlled to copy the image volume to obtain at least one copy image volume, so that the at least one copy image volume is used to create a virtual machine. At least one data is obtained in the target image volume corresponding to each virtual machine for creating at least one virtual machine. In the above process, when determining the target image volume corresponding to each virtual machine according to the image configuration information, the target image volume corresponding to each virtual machine can be determined based on the number of image volumes in each image cache area. When multiple virtual machines are created at the same time, the situation that serially obtaining data from each image volume in sequence will reduce the speed of creating the virtual machine is avoided. The efficiency of virtual machine creation is improved. At the same time, the preset algorithm can randomly determine the target image volume corresponding to each virtual machine in at least one image volume when creating the virtual machine, so that the use of the image volume is load balanced. When it is determined that the number of mirror volumes is insufficient for creating a virtual machine, the storage device can be controlled to copy the mirror volumes to obtain at least one copy mirror volume for creating at least one virtual machine. This avoids the degradation of the read and write performance of the system disk of the virtual machine created by the volume snapshot technology. While increasing the speed of virtual machine creation, the performance and stability of the virtual machine are improved.
[0161] Based on any of the above embodiments, Figure 6 , the process of data acquisition is illustrated with examples.
[0162] Figure 6 This is a schematic diagram of the data acquisition process provided in the embodiment of the present application. Figure 6 , including a data acquisition device 601 and a storage device 602. The data acquisition device 601 and the storage device 602 can be servers. The data acquisition device 601 is provided with a management service and a mirror service. The storage device 602 is provided with at least one mirror cache area, and at least one mirror volume is stored in the mirror cache area. The management service of the data acquisition device 601 obtains the data acquisition request set by the user. The data acquisition request is a request generated when the virtual machine C1 and the virtual machine C2 are created. The mirror service of the data acquisition device 601 obtains the mirror configuration information according to the data acquisition request, which can be specifically shown in Table 4:
[0163] Table 4
[0164] First logo Second mark First quantity Image cache area C1 Mirror volume C11, mirror volume C12 2 Image cache area C2 Mirror volume C21, mirror volume C22, mirror volume C23 3 Image cache area C3 Mirror volume C32, mirror volume C34 2 Image cache area C4 Mirror Volume C40 1
[0165] The mirror service of the data acquisition device 601 determines that the first number is not the preset number 0. The data acquisition device 601 determines, based on the mirror configuration information shown in Table 4, that in the mirror cache area C1, the mirror volume C11 is not used to create a virtual machine. It is determined that in the mirror cache area C2, the mirror volume C22 is not used to create a virtual machine. It is determined that in the mirror cache area C3, the mirror volume C32 and the mirror volume C34 are not used to create a virtual machine. It is determined that in the mirror cache area C4, there is no mirror volume that is not used to create a virtual machine. Assuming that the preset number is 1, it can be determined that the second number of mirror volumes that are not used to create a virtual machine in the mirror cache area C1, the mirror cache area C2, and the mirror cache area C3 is greater than or equal to the preset number. Therefore, the data acquisition device 601 determines that at least one to-be-selected cache area includes the mirror cache area C1, the mirror cache area C2, and the mirror cache area C3, and at least one to-be-selected mirror volume includes the mirror volume C11, the mirror volume C22, the mirror volume C32, and the mirror volume C34.
[0166] The data acquisition device 601 determines that the target mirror volume corresponding to the virtual machine C1 is mirror volume C32 in at least one mirror volume to be selected, and determines that the target mirror volume corresponding to the virtual machine C2 is mirror volume C22 according to a preset algorithm. The data acquisition device 601 obtains data from mirror volume C32 for creating the virtual machine C1, and obtains data from mirror volume C22 for creating the virtual machine C2. After determining that the data in mirror volume C22 is used to create the virtual machine C2, the storage device 602 can clone the mirror volume C22 to obtain the mirror volume C23, and store the mirror volume C23 in the mirror cache area C2. The mirror volume C23 can be used to obtain data when subsequently creating a virtual machine.
[0167] The data acquisition process provided by the embodiment of the present application obtains a data acquisition request. According to the data acquisition request, image configuration information is obtained. A preset value is obtained. If the first number is greater than the preset value, a preset algorithm is obtained. According to the image configuration information, at least one image volume to be selected is determined in at least one image volume stored in each image cache area. According to the preset algorithm, a target image volume corresponding to each virtual machine is determined in at least one image volume to be selected. If the first number is equal to the preset value, a prompt message is generated, and the storage device is controlled to copy the image volume to obtain at least one copy image volume, so that at least one copy image volume is used to create a virtual machine. At least one data is obtained in the target image volume corresponding to each virtual machine for creating at least one virtual machine. In the above process, when determining the target image volume corresponding to each virtual machine according to the image configuration information, the target image volume corresponding to each virtual machine can be determined based on the number of image volumes in each image cache area. When creating multiple virtual machines at the same time, it is avoided that serially obtaining data from each image volume in sequence will reduce the speed of creating the virtual machine. The efficiency of virtual machine creation is improved. At the same time, the preset algorithm can randomly determine the target image volume corresponding to each virtual machine in at least one image volume when creating the virtual machine, so that the use of the image volume is load balanced. When it is determined that the number of mirror volumes is insufficient for creating a virtual machine, the storage device can be controlled to copy the mirror volumes to obtain at least one copy mirror volume for creating at least one virtual machine. This avoids the degradation of the read and write performance of the system disk of the virtual machine created by the volume snapshot technology. While increasing the speed of virtual machine creation, the performance and stability of the virtual machine are improved.
[0168] Figure 7 This is a schematic diagram of the structure of a data acquisition device provided in an embodiment of the present application. Figure 7 , the data acquisition device 10 may include:
[0169] A first acquisition module 11 is used to acquire a data acquisition request, where the data acquisition request is a request generated when the virtual machine is created;
[0170] A second acquisition module 12 is used to acquire mirror configuration information according to the data acquisition request, wherein the mirror configuration information includes a first identifier of at least one mirror cache area, a second identifier of at least one mirror volume stored in each mirror cache area, and a first number of at least one mirror volume stored in each mirror cache area;
[0171] A determination module 13, configured to determine a target mirror volume from at least one mirror volume stored in each mirror cache area according to the mirror configuration information;
[0172] The third acquisition module 14 is used to acquire at least one data in the target mirror volume for creating a virtual machine.
[0173] In a possible implementation manner, the determining module 13 is specifically configured to:
[0174] Get the preset value;
[0175] According to the preset value and the mirror configuration information, a target mirror volume corresponding to each virtual machine is determined in at least one mirror volume stored in each mirror cache area.
[0176] In a possible implementation manner, the determining module 13 is specifically configured to:
[0177] If the first number is greater than the preset value, a preset algorithm is obtained, and according to the preset algorithm and the mirror configuration information, a target mirror volume corresponding to each virtual machine is determined in at least one mirror volume stored in each mirror cache area.
[0178] In a possible implementation manner, the determining module 13 is specifically configured to:
[0179] Determine at least one mirror volume to be selected from at least one mirror volume stored in each mirror cache area according to the mirror configuration information;
[0180] According to the preset algorithm, a target mirror volume corresponding to each virtual machine is determined in the at least one mirror volume to be selected, and the preset algorithm is used to determine that the target mirror volume corresponding to each virtual machine is evenly distributed in the at least one mirror cache area.
[0181] In a possible implementation manner, the determining module 13 is specifically configured to:
[0182] In the image cache area, determining at least one to-be-selected cache area, wherein a second number of the image volumes not used to create the virtual machine in the to-be-selected cache area is greater than or equal to a preset number;
[0183] In each to-be-selected cache area, a mirror volume that is not used to create a virtual machine is determined as the to-be-selected mirror volume.
[0184] The data acquisition device provided in the embodiment of the present application can execute the technical solution shown in the above method embodiment, and its implementation principle and beneficial effects are similar, which will not be repeated here.
[0185] Figure 8 A schematic diagram of the structure of another data acquisition device provided in an embodiment of the present application. Figure 7 Based on the examples shown, see Figure 8 The data acquisition device 10 also includes a generating module 15 , a processing module 16 and a deleting module 17 .
[0186] Wherein, the generating module 15 is used for:
[0187] If the first number is less than the preset value, a prompt message is generated, where the prompt message is used to indicate that the target mirror volume does not exist in at least one mirror volume stored in each mirror cache area;
[0188] Display or send the prompt information to a preset device.
[0189] The processing module 16 is used for:
[0190] If the first number is less than or equal to the preset value, control the storage device to clone and copy the mirror volume to obtain at least one copy mirror volume, so that the at least one copy mirror volume is used to create a virtual machine;
[0191] The storage device includes at least one mirror cache area, and the mirror cache area includes at least one mirror volume.
[0192] The deletion module 17 is used for:
[0193] For any mirror volume, if it is determined that no data exists in the mirror volume, or the valid period corresponding to the data stored in the mirror volume does not match the current period, the mirror volume is deleted.
[0194] The data acquisition device provided in the embodiment of the present application can execute the technical solution shown in the above method embodiment, and its implementation principle and beneficial effects are similar, which will not be repeated here.
[0195] Fig. 9 This is a schematic diagram of the structure of the data acquisition device provided in the embodiment of the present application. Fig. 9 The data acquisition device 20 may include: a memory 21 and a processor 22. Exemplarily, the memory 21 and the processor 22 are interconnected via a bus 23.
[0196] The memory 21 is used to store program instructions;
[0197] The processor 22 is used to execute the program instructions stored in the memory, so as to enable the data acquisition device 20 to execute the method shown in the above method embodiment.
[0198] The data acquisition device provided in the embodiment of the present application can execute the technical solution shown in the above method embodiment, and its implementation principle and beneficial effects are similar, which will not be repeated here.
[0199] An embodiment of the present application provides a computer-readable storage medium, in which computer-executable instructions are stored. When the computer-executable instructions are executed by a processor, they are used to implement the above method.
[0200] The embodiment of the present application may also provide a computer program product, including a computer program, which can implement the above method when executed by a processor.
[0201] All or part of the steps of the above-mentioned method embodiments can be completed by hardware related to program instructions. The aforementioned program can be stored in a readable memory. When the program is executed, the steps of the above-mentioned method embodiments are executed; and the aforementioned memory (storage medium) includes: read-only memory (ROM), random access memory (RAM), flash memory, hard disk, solid state drive, magnetic tape, floppy disk, optical disc and any combination thereof.
[0202] The embodiments of the present application are described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processing unit of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processing unit of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. 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.
[0203] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate 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 A function specified in one or more boxes.
[0204] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0205] Obviously, those skilled in the art can make various changes and modifications to the embodiments of the present application without departing from the spirit and scope of the present application. Thus, if these modifications and variations of the embodiments of the present application fall within the scope of the claims of the present application and their equivalents, the present application is also intended to include these modifications and variations.
[0206] In the present application, the term "include" and its variations may refer to non-restrictive inclusion; the term "or" and its variations may refer to "and / or". The terms "first", "second", etc. in the present application are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. In the present application, "plurality" refers to two or more. "And / or" describes the association relationship of associated objects, indicating that three relationships may exist. For example, B and / or B may mean: B exists alone, B and B exist at the same time, and B exists alone. The character " / " generally indicates that the previously associated objects are in an "or" relationship.
Claims
1. A data acquisition method, characterized in that: include: Obtaining a data acquisition request, where the data acquisition request is a request generated when creating at least one virtual machine; Acquire mirror configuration information according to the data acquisition request, the mirror configuration information including a first identifier of at least one mirror cache area, a second identifier of at least one mirror volume stored in each mirror cache area, and a first number of at least one mirror volume stored in each mirror cache area; According to the mirror configuration information, determining a target mirror volume corresponding to each virtual machine in at least one mirror volume stored in each mirror cache area; At least one data is obtained from the target mirror volume corresponding to each virtual machine, so as to be used for creating the at least one virtual machine.
2. The method according to claim 1, characterized in that Determining, according to the mirror configuration information, a target mirror volume corresponding to each virtual machine in at least one mirror volume stored in each mirror cache area, including: Get the preset value; According to the preset value and the mirror configuration information, a target mirror volume corresponding to each virtual machine is determined in at least one mirror volume stored in each mirror cache area.
3. The method according to claim 2, characterized in that Determining a target mirror volume corresponding to each virtual machine in at least one mirror volume stored in each mirror cache area according to the preset value and the mirror configuration information includes: If the first number is greater than the preset value, a preset algorithm is obtained, and according to the preset algorithm and the mirror configuration information, a target mirror volume corresponding to each virtual machine is determined in at least one mirror volume stored in each mirror cache area.
4. The method according to claim 3, characterized in that According to the preset algorithm and the mirror configuration information, determining a target mirror volume corresponding to each virtual machine in at least one mirror volume stored in each mirror cache area includes: Determine at least one mirror volume to be selected from at least one mirror volume stored in each mirror cache area according to the mirror configuration information; According to the preset algorithm, a target mirror volume corresponding to each virtual machine is determined in the at least one mirror volume to be selected, and the preset algorithm is used to determine that the target mirror volume corresponding to each virtual machine is evenly distributed in the at least one mirror cache area.
5. The method according to claim 4, characterized in that Determining at least one mirror volume to be selected from at least one mirror volume stored in each mirror cache area according to the mirror configuration information includes: In the image cache area, determining at least one to-be-selected cache area, wherein a second number of the image volumes not used to create the virtual machine in the to-be-selected cache area is greater than or equal to a preset number; In each to-be-selected cache area, a mirror volume that is not used to create a virtual machine is determined as the to-be-selected mirror volume.
6. The method according to any one of claims 2 to 5, characterized in that: The method further comprises: If the first number is less than the preset value, a prompt message is generated, where the prompt message is used to indicate that the target mirror volume does not exist in at least one mirror volume stored in each mirror cache area; Display or send the prompt information to a preset device.
7. The method according to claim 6, characterized in that The method further comprises: If the first number is less than or equal to the preset value, control the storage device to clone and copy the mirror volume to obtain at least one copy mirror volume, so that the at least one copy mirror volume is used to create a virtual machine; The storage device includes at least one mirror cache area, and the mirror cache area includes at least one mirror volume.
8. The method according to any one of claims 1 to 7, characterized in that: The method further comprises: For any mirror volume, if it is determined that no data exists in the mirror volume, or the valid period corresponding to the data stored in the mirror volume does not match the current period, the mirror volume is deleted.
9. A data acquisition device, characterized in that: The device comprises: A first acquisition module, used to acquire a data acquisition request, where the data acquisition request is a request generated when the virtual machine is created; A second acquisition module, configured to acquire mirror configuration information according to the data acquisition request, wherein the mirror configuration information includes a first identifier of at least one mirror cache area, a second identifier of at least one mirror volume stored in each mirror cache area, and a first number of at least one mirror volume stored in each mirror cache area; A determination module, configured to determine a target mirror volume from at least one mirror volume stored in each mirror cache area according to the mirror configuration information; The third acquisition module is used to acquire at least one data in the target mirror volume for creating a virtual machine.
10. A data acquisition device, characterized in that: include: at least one processor; as well as a memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method according to any one of claims 1 to 8.
11. A non-transitory computer-readable storage medium storing computer instructions, characterized in that: in, The computer instructions are used to make a computer execute the method according to any one of claims 1 to 8.
12. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the method according to any one of claims 1 to 8 is implemented.
Citation Information
Patent Citations
Creation method and component of virtual machine in cloud platform and server
CN111209090A
Virtual machine creation method, system and device, server and storage medium
CN112084010A
Virtual machine creation method, apparatus and device, and computer readable storage medium
CN113703922A
Cloud platform mirror image cache management method based on LRU permutation algorithm
CN114168262A
Virtual machine mirror image data distribution method and device, equipment and storage medium
CN115865948A