Virtual machine deployment method and apparatus
Patent Information
- Application Number
- CN202610560510.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-04-24
- Publication Date
- 2026-08-28
AI Technical Summary
[0005]本申请实施例提供一种虚拟机部署方法及设备,解决了虚拟机部署的过程中资源占用量增加的问题
[0021] The virtual machine deployment method and device provided in this disclosure parse an OVA file on the terminal device side to obtain an OVF file, and then parse the OVF file to obtain target configuration information, displaying the target configuration information. This allows users to directly confirm the target configuration information on the terminal side, or modify the target configuration information and use the modified target configuration information for virtual machine deployment. This enables modification of configuration information on the terminal side before actual virtual machine configuration, reducing the steps involved in virtual machine deployment. Furthermore, it achieves OVA file parsing on the terminal device side, eliminating the need to upload the complete OVA file, thus reducing the memory resources occupied by the server during virtual machine deployment.
Smart Images

Figure CN122653748A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computing device technology, and in particular to a virtual machine deployment method and device. Background Technology
[0002] Currently, when users create virtual machines, they typically need to use Open Virtualization Appliance (OVA) files for creation.
[0003] In related technologies, when creating a virtual machine using an open virtualization device, the OVA file needs to be uploaded to the server first, and then the server creates the virtual machine according to the OVA file. After the virtual machine is created, it is configured on the server side.
[0004] Therefore, deploying virtual machines on a server is a rather cumbersome process. Summary of the Invention
[0005] This application provides a virtual machine deployment method and device, which solves the problem of increased resource consumption during virtual machine deployment.
[0006] In a first aspect, embodiments of this application provide a virtual machine deployment method, applied to a terminal device, comprising:
[0007] Obtain the Open Virtualization Device (OVA) file; based on the OVA file's format rules, read the metadata of the OVA file's Open Virtualization Format (OVF) file; based on the OVF file's metadata, obtain the data range where the OVF file is located, and based on the data range, read and parse the OVF file to obtain the target configuration information of the virtual machine described by the OVA file; display the target configuration information so that users can configure virtual machine resources on the server according to the target configuration information.
[0008] One possible implementation also includes: reading the metadata of the disk file in the OVA file based on the format rules of the OVA file; reading the disk file based on the metadata of the disk file; sending the target configuration information to the server so that the server can create a virtual disk volume that meets the data storage space size according to the target configuration information, wherein the target configuration information includes the data storage space size; and sending the disk file in the OVA file to the server so that the server can write the disk file to the virtual disk volume.
[0009] In one possible implementation, the OVA file includes multiple disk files; correspondingly, sending the disk files in the OVA file to the server includes: concurrently transmitting each disk file in the OVA file to the server, so that the server concurrently writes each disk file to the corresponding virtual disk volume.
[0010] In one possible implementation, the target configuration information includes the number of disks; concurrently transferring each disk file in the OVA file to the server so that the server can concurrently write each disk file to the corresponding virtual disk volume, including: creating a corresponding number of data transfer threads based on the number of disk files; using the data transfer threads to concurrently transfer each disk file in the OVA file to the server so that the server can concurrently write the disk files to the virtual disk volume.
[0011] In one possible implementation, the disk file corresponds to a disk identifier; a data transfer thread is used to concurrently transfer each disk file in the OVA file to the server, so that the server concurrently writes the disk files to the virtual disk volume, including: using the data transfer thread to send the disk identifier and the corresponding disk file to the server, so that the server concurrently writes the disk file to the virtual disk volume corresponding to the disk identifier.
[0012] In one possible implementation, a disk file corresponds to a disk identifier; a data transfer thread is used to concurrently transfer each disk file in the OVA file to the server, so that the server concurrently writes the disk files to the virtual disk volume, including: sending the correspondence between the data transfer thread and the disk identifier to the server; using the data transfer thread, the disk files are concurrently sent to the server, so that the server determines the disk identifier corresponding to the transfer thread according to the correspondence between the transfer thread and the disk identifier, and concurrently writes the disk files transferred by the transfer thread to the virtual disk volume corresponding to the disk identifier.
[0013] In one possible implementation, the virtual machine deployment method further includes: in response to receiving an adjustment instruction for target configuration information, adjusting the target configuration information according to the adjustment instruction to obtain new target configuration information.
[0014] In one possible implementation, the virtual machine deployment method further includes: in response to detecting a trigger signal for the send button, sending new target configuration information to the server so that the server creates a virtual disk volume based on the new target configuration information.
[0015] Secondly, this application provides a virtual machine deployment method applied to a server, comprising: receiving target configuration information sent by a terminal device; creating a virtual disk volume based on the target configuration information; concurrently receiving disk files sent by the terminal device; and concurrently writing the disk files to the virtual disk volume.
[0016] Thirdly, this application provides a virtual machine deployment apparatus applied to a terminal device, comprising: a file acquisition module for acquiring an Open Virtualization Device (OVA) file; a data reading module for reading the metadata of an Open Virtualization Format (OVF) file based on the format rules of the OVA file; a range acquisition module for acquiring the data range of the OVF file based on the metadata of the OVF file, and reading and parsing the OVF file based on the data range to obtain the target configuration information of the virtual machine described by the OVA file; and an information display module for displaying the target configuration information so that users can configure virtual machine resources on the server according to the target configuration information.
[0017] Fourthly, this application provides a virtual machine deployment apparatus applied to a server, comprising: a data receiving module for receiving target configuration information sent by a terminal device; a disk creation module for creating a virtual disk volume based on the target configuration information; a concurrent receiving module for concurrently receiving disk files sent by the terminal device; and a file writing module for concurrently writing disk files to the virtual disk volume.
[0018] Fifthly, embodiments of this application provide a computing device, which includes a memory and a processor; the memory and the processor are coupled; the memory is used to store program instructions; the processor is used to invoke the program instructions to cause the computing device to perform the method as described in the first or second aspect.
[0019] In a sixth aspect, embodiments of this application provide a computer-readable storage medium storing computer program instructions; when the program instructions are executed by a computing device, the computing device performs the method as described in the first or second aspect.
[0020] In a seventh aspect, embodiments of this application provide a computer program product, which includes computer program instructions that, when executed, cause a computing device to perform the method described in the first or second aspect.
[0021] The virtual machine deployment method and device provided in this disclosure parse an OVA file on the terminal device side to obtain an OVF file, and then parse the OVF file to obtain target configuration information, displaying the target configuration information. This allows users to directly confirm the target configuration information on the terminal side, or modify the target configuration information and use the modified target configuration information for virtual machine deployment. This enables modification of configuration information on the terminal side before actual virtual machine configuration, reducing the steps involved in virtual machine deployment. Furthermore, it achieves OVA file parsing on the terminal device side, eliminating the need to upload the complete OVA file, thus reducing the memory resources occupied by the server during virtual machine deployment. Attached Figure Description
[0022] Figure 1 This is a schematic diagram illustrating an application scenario of the virtual machine deployment method provided in the embodiments of this application;
[0023] Figure 2 A flowchart illustrating the virtual machine deployment method provided in this application embodiment. Figure 1 ;
[0024] Figure 3 A flowchart illustrating the virtual machine deployment method provided in this application embodiment. Figure 2 ;
[0025] Figure 4 A schematic diagram of the interaction flow of the virtual machine deployment method provided in the embodiments of this application;
[0026] Figure 5 Schematic diagram of the structure of the virtual machine deployment apparatus provided in the embodiments of this application Figure 1 ;
[0027] Figure 6 Schematic diagram of the structure of the virtual machine deployment apparatus provided in the embodiments of this application Figure 2 ;
[0028] Figure 7 This is a schematic diagram of the structure of a computing device provided in an embodiment of this application. Detailed Implementation
[0029] Exemplary embodiments will now be described in detail, examples of which are illustrated in the accompanying drawings. When the following description relates to the drawings, unless otherwise indicated, the same numbers in different drawings denote the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this application. Rather, they are merely examples of apparatuses and methods consistent with some aspects of this application as detailed in the appended claims.
[0030] Currently, when users create virtual machines, they generally use open virtualization device files as virtual machine templates.
[0031] In related virtual machine deployment schemes based on OVA files, the OVA file must first be uploaded to the server in its entirety. Then, the server completes the parsing, decompression, and virtual machine deployment process of the OVA file. Only after the virtual machine is created can the virtual machine parameters be adjusted.
[0032] This method requires the server to reserve additional temporary storage and computing resources for OVA decompression, resulting in high resource consumption and low resource utilization during virtual machine deployment.
[0033] To address the aforementioned technical problems, the inventors propose the following technical concept: read the OVF file from the OVA file using a terminal device, parse the OVF file to obtain the target configuration information of the virtual machine, and then configure the virtual machine using the target configuration information.
[0034] Figure 1 This is a schematic diagram illustrating an application scenario for the virtual machine deployment method provided in this application embodiment. For example... Figure 1 As shown, the application scenarios of the virtual machine deployment method include: terminal device 101 and server 102.
[0035] Terminal device 101 may include computers, servers, tablets, mobile phones, PDAs (personal digital assistants), and laptops, which can input and send data.
[0036] Server 102 can be implemented by one or more servers with powerful processing capabilities and high security. Where possible, it can also be replaced by computers, laptops or other devices with strong computing power.
[0037] The terminal device 101 and the server 102 can be connected via wired or wireless means.
[0038] Terminal device 101 is used to parse the OVA file, obtain configuration information, and transmit the configuration information and the disk file corresponding to the virtual disk volume to server 102. Server 102 is used to create the corresponding virtual disk volume, write the disk file to the virtual disk volume, and create a virtual machine using the configuration information.
[0039] Figure 2 A flowchart illustrating the virtual machine deployment method provided in this application embodiment. Figure 1 .like Figure 2 As shown, the virtual machine deployment method can be applied to... Figure 1 The terminal device 101 includes:
[0040] S201: Obtain the open virtualization device file.
[0041] In this step, the terminal device can run a client (browser or dedicated client) to provide a local file selection entry. The user can select an Open Virtualization Device (OVA) file from the local file system of their own terminal through this entry. The client obtains the OVA file through the file reading interface and establishes a file reading channel for subsequent reading of the file content.
[0042] S202: Based on the format rules of OVA files, read the metadata of the Open Virtualization Format (OVF) file of the Open Virtualization Device File.
[0043] In this step, the metadata of the Open Virtualization Format file can be obtained by reading the header of the OVA file, based on the archive format characteristics of the OVA file.
[0044] S203: Based on the metadata of the OVF file, obtain the data range where the OVF file is located, and based on the data range, read and parse the OVF file to obtain the target configuration information of the virtual machine described by the OVF file.
[0045] In this step, the OVF file's metadata may contain its size. The client performs structured parsing of the metadata to obtain the OVF file size. Starting from the next data block in the OVF file's metadata, the client reads the OVF file's size data to obtain the OVF file. Alternatively, the OVF file's metadata may directly contain the OVF file's range; the OVF file can be read directly through this range. The OVF file may also contain target configuration information. This target configuration information can be obtained by parsing the OVF file.
[0046] The target configuration information may include the number of CPU (Central Processing Unit) cores, memory size, number of disks, disk capacity, disk identifiers, and network-related configurations, which are then integrated to obtain the target configuration information.
[0047] S204: Displays target configuration information to enable users to configure virtual machine resources on the server based on the target configuration information.
[0048] In this step, the configuration can be rendered visually to the front-end interface (such as a web page or client window), and displayed according to configuration type (such as computing resources, storage resources, and network resources). After confirming the target configuration information, it is sent to the server. The virtual machine can be deployed directly using the target configuration information, or the target configuration information can be modified before being sent to the server, so that the server uses the modified target configuration information for virtual machine deployment.
[0049] As described in the above embodiments, this disclosure parses the OVA file on the terminal device side to obtain the OVF file, then parses the OVF file to obtain target configuration information, and displays the target configuration information. This allows users to directly confirm the target configuration information on the terminal side, or modify the target configuration information and use the modified target configuration information for virtual machine deployment. This enables modification of configuration information on the terminal side before actual virtual machine configuration, reducing the steps involved in virtual machine deployment. Furthermore, it achieves OVA file parsing on the terminal device side, eliminating the need to upload the complete OVA file, thus reducing the memory resources occupied by the server during virtual machine deployment.
[0050] One possible implementation also includes:
[0051] S220: Based on the format rules of OVA files, read the metadata of disk files in OVA files.
[0052] In this step, the OVA file begins with an OVF file. Following the OVF file are the metadata of a fixed-size disk file, which contains the size of the disk file or the range of disk data. The disk file data itself is then stored after the metadata. At the end of each disk file, the metadata for the next disk file is stored. This storage method allows for the cyclical reading of both the metadata and the disk data until the last disk file's data is accessed.
[0053] S221: Read disk files based on their metadata.
[0054] In this step, the disk file's metadata stores the size of the corresponding disk file. The disk file size is read from the disk file's metadata to obtain the disk file.
[0055] In this case, the terminal device only needs to read the disk file, and does not need to parse the disk file.
[0056] S222: Send the target configuration information to the server so that the server can create a virtual disk volume that meets the data storage space size according to the target configuration information, wherein the target configuration information includes the data storage space size.
[0057] In this step, the target configuration information can be sent to the server using methods such as data packets, messages, or application messages, causing the server to create a virtual disk volume larger than or equal to the disk size specified in the target configuration information. Specifically, the data storage space size matches the size of the virtual disk volume and is greater than or equal to the size of the disk file.
[0058] S223: Send the disk file from the OVA file to the server so that the server writes the disk file to the virtual disk volume.
[0059] In this step, based on the size of the disk file, data of the corresponding size can be read from the disk file's metadata to obtain the disk file. The disk file is then sent to the server using a single-threaded or multi-threaded approach, and the server writes the disk file to the corresponding virtual disk volume.
[0060] As can be seen from the description of the above embodiments, the embodiments of this disclosure read the disk file in the OVA file based on the format rules of the OVA file, determine the data size of the disk based on the metadata, send the data size and disk data to the server, the server creates a virtual disk volume of the corresponding size and writes the disk file into the virtual disk volume, thereby realizing the creation of the virtual disk volume.
[0061] In one possible implementation, the OVA file includes multiple disk files.
[0062] Accordingly, in step S223 above, sending the disk file in the OVA file to the server includes:
[0063] S2231: Concurrently transfer each disk file in the OVA file to the server, so that the server can concurrently write each disk file to the corresponding virtual disk volume.
[0064] In this step, at least two transfer threads can be created to transfer disk files to the server. In one possible implementation, the number of transfer threads can be the same as the number of disk files, or the number of disk files can be an integer multiple of the number of transfer threads.
[0065] As can be seen from the description of the above embodiments, the embodiments of this disclosure achieve the effect of increasing data transmission speed and reducing virtual machine deployment time by concurrently transmitting disk files to the server.
[0066] In one possible implementation, the target configuration information includes the number of disks.
[0067] In step S2231 above, the concurrent transfer of each disk file in the OVA file to the server, so that the server can concurrently write each disk file to the corresponding virtual disk volume, includes:
[0068] S311: Create a corresponding number of data transfer threads based on the number of disk files.
[0069] In this step, the client on the terminal device reads the number of disks from the target configuration information to determine the number of disk file blocks to be transferred. Using a multi-threaded programming interface, it creates a data transfer thread equal to the number of disk files. Each thread corresponds to a data transfer task for one disk. After creation, the threads are in a ready state, waiting to start the transfer. The number of disk files can be the same as the number of virtual disks.
[0070] For example, if the terminal device parses the target configuration information and finds that the number of disks is 3, meaning that 3 disks correspond to 3 disk files, then 3 data transmission threads are created to transmit the disk files corresponding to these 3 disks respectively. As another example, if the terminal device parses the target configuration information and finds that the number of disks is 6, meaning that 6 disks correspond to 6 disk files, then 6 data transmission threads are created to transmit the disk files corresponding to these 6 disks respectively (or 3 data transmission threads can be created to transmit the disk files corresponding to the 6 disks in two separate transmissions).
[0071] S312: Uses a data transfer thread to concurrently transfer each disk file in the OVA file to the server, so that the server can concurrently write the disk files to the virtual disk volume.
[0072] In this step, all created data transfer threads are started. Each thread loads the corresponding bound disk binary data and establishes an independent network transmission channel with the server through a preset protocol. The threads send the disk files to the server at a preset transmission rate or the maximum transmission rate. After receiving the data, the server writes the data to the corresponding virtual disk volume and completes the virtual machine deployment based on the target configuration information.
[0073] As can be seen from the description of the above embodiments, the embodiments of this disclosure achieve multi-threaded concurrent data upload by creating data transmission threads corresponding to the number of disk files and using data transmission threads to transmit disk files to the server. This fully utilizes network bandwidth, saves a lot of transmission time for large virtual machines with multiple disks, increases transmission efficiency, and solves the problem of long data transmission time during virtual machine creation.
[0074] In one possible implementation, the disk file corresponds to a disk identifier.
[0075] In step S312 above, a data transfer thread is used to concurrently transfer each disk file in the OVA file to the server, so that the server concurrently writes the disk files to the virtual disk volume, including:
[0076] S312A1: Uses a data transfer thread to send the disk identifier and the corresponding disk file to the server, so that the server can concurrently write the disk file to the virtual disk volume corresponding to the disk identifier.
[0077] In this step, each data transfer thread loads the binary data of the corresponding disk and the disk's unique identifier. During transmission, the disk identifier is bound to the disk file. The disk identifier can be carried in the form of a request header, a data packet header identifier bit, or a preset parameter and sent to the server along with the disk file. After receiving the disk identifier, the server parses it, matches it with the pre-created corresponding virtual disk volume, writes the disk file to the volume, and finally completes the virtual machine deployment according to the target configuration information.
[0078] As can be seen from the description of the above embodiments, the embodiments of this disclosure send the disk identifier and the corresponding disk file to the server along with the data transmission thread. This enables the server to quickly match the pre-created corresponding virtual disk volume through the disk identifier, achieving accurate correspondence between the disk file and the target virtual disk volume. This ensures the accuracy and orderliness of disk file writing and provides data matching guarantee for the server to successfully create virtual machines based on the target configuration information. It also avoids the technical problem of the server being unable to distinguish between different disk files and data writing errors.
[0079] In one possible implementation, the disk file corresponds to a disk identifier.
[0080] In step S312 above, a data transfer thread is used to concurrently transfer each disk file in the OVA file to the server, so that the server concurrently writes the disk files to the virtual disk volume, including:
[0081] S312B1: Sends the mapping between data transfer threads and disk identifiers to the server.
[0082] In this step, before starting the data transmission thread, the client of the terminal device establishes a mapping relationship between the thread identifier (such as thread number and name) of each data transmission thread and the corresponding disk identifier, and generates a mapping relationship table; through a separate network request, the mapping relationship table is sent to the server, and the server stores the mapping relationship after receiving it for identifier matching during subsequent data reception.
[0083] The correspondence between data transfer threads and disk identifiers can be stored in formats such as tables, key-value pairs, and files.
[0084] S312B2: Employs a data transfer thread to concurrently send disk files to the server. The server then determines the disk identifier corresponding to the transfer thread based on the correspondence between the transfer thread and the disk identifier, concurrently writes the disk files transferred by the transfer thread to the virtual disk volume corresponding to the disk identifier, and creates a virtual machine based on the target configuration information.
[0085] In this step, the terminal device can start all data transmission threads. Each thread loads the corresponding bound disk binary data and sends it to the server through an independent network channel. During the transmission, the server obtains the thread ID of the current transmission thread, queries the pre-stored mapping relationship between thread IDs and disk identifiers, and determines the disk identifier corresponding to the disk file transmitted by the thread. Based on the disk identifier, the server matches the corresponding virtual disk volume, writes the received disk file to the volume, and creates a virtual machine based on the target configuration information after all data transmission is completed.
[0086] As can be seen from the description of the above embodiments, the embodiments of this disclosure send the mapping relationship between threads and disk identifiers to the server in advance, enabling the server to quickly locate the corresponding disk identifier based on the transmission thread ID. This eliminates the need to carry the identifier in each frame of data, saving network transmission resources. It also ensures accurate matching between disk files and virtual disk volumes during multi-threaded concurrent transmission, guaranteeing the stability and orderliness of disk file writing. At the same time, it provides reliable identifier association support for the server to successfully create virtual machines based on target configuration information. This solves the technical problems in multi-threaded concurrent transmission scenarios, where disk identifiers cannot be stably associated solely through the thread itself, and where thread anomalies (such as restarts or interruptions) can easily lead to mismatches between disk files and target virtual disk volumes, as well as the complex identifier carrying method and its high bandwidth consumption.
[0087] In one possible implementation, the virtual machine deployment method also includes:
[0088] S240: In response to receiving an adjustment instruction for the target configuration information, adjust the target configuration information according to the adjustment instruction to obtain new target configuration information.
[0089] In this step, the client listens for user configuration adjustments on the front-end interface, receiving adjustment instructions (such as modifying the number of CPU cores, adjusting memory size, selecting storage location, and changing disk type) from data input devices (e.g., mouse, keyboard). Based on these instructions, the client modifies and replaces the corresponding fields in the original target configuration information to obtain the target configuration information. It can also verify the validity of the adjusted parameters (e.g., the number of CPU cores does not exceed the platform limit, and the memory size conforms to hardware specifications). After successful verification, all adjusted configuration parameters are integrated to generate new target configuration information, which is then cached locally.
[0090] As can be seen from the description of the above embodiments, the embodiments of this disclosure support users to adjust the configuration independently, and finally obtain the target configuration information that meets the user's needs. This provides an accurate configuration basis for the subsequent creation of virtual disk volumes, accurate reception of disk files, and successful creation of virtual machines on the server. It avoids the problem of process rework caused by mismatched or illegal configurations, and solves the technical problem in the traditional virtual machine deployment process that users cannot view the original configuration of the virtual machine before uploading the OVA file and need to modify the configuration after the OVA is transferred, which increases the number of interactions.
[0091] In one possible implementation, the method of reading the OVF file within an OVA file can include:
[0092] S250: Read the header fields of the Open Virtualization Device File to obtain the read location of the Open Virtualization Format file.
[0093] In this step, the client starts an OVA file header reading thread to read the header area of the OVA file (e.g., the first 100MB, avoiding reading the entire large file) and extract the OVF file-related metadata recorded therein, including the start byte offset and total file size of the OVF file, or the start and end bytes of the OVF file, thereby determining the precise reading position of the OVF file in the OVA file.
[0094] S251: Read the Open Virtualization Format file from the Open Virtualization Device File according to the read location of the Open Virtualization Format file.
[0095] In this step, the client reads the corresponding byte range of binary data from the OVA original file according to the OVF file reading location determined by S2021, converts the binary data into a preset text format, and obtains a complete and parseable Open Virtualization Format (OVF) file.
[0096] As can be seen from the description of the above embodiments, the embodiments of this disclosure locate the OVF file by reading only the header fields of the OVA file, and then accurately read the OVF file within the corresponding byte range. This eliminates the need to decompress the entire OVA file, reducing the storage and computing resource consumption of the user terminal and accelerating the extraction speed of the OVF file. This provides a foundation for subsequent parsing of the original virtual machine configuration and determining the target configuration information, and solves the problem that traditional OVA file parsing requires uploading and decompressing the entire large OVA file to obtain the OVF file, resulting in excessive terminal resource consumption and low parsing efficiency.
[0097] In one possible implementation, the virtual machine deployment method also includes:
[0098] S260: In response to detecting a trigger signal for the send button, new target configuration information is sent to the server so that the server can create a virtual disk volume based on the new target configuration information.
[0099] In this step, the client on the terminal device listens for click events of buttons such as "Confirm Send" and "Import" on the front-end interface. When a button trigger signal is detected, the new target configuration information is converted into a preset format (or a communication format agreed upon by the platform) and sent to the server through a preset protocol. At the same time, a request identifier is carried to ensure that the server can recognize that the request is a virtual disk volume creation related request. After receiving the request, the server parses the target configuration information and performs the virtual disk volume creation operation.
[0100] As can be seen from the description of the above embodiments, the embodiments of this disclosure ensure that the target configuration information is sent only after the user confirms that it is correct by listening to the trigger signal of the send button. This provides timely pre-support for subsequent disk file transfer and writing, virtual machine deployment, and ensures that the entire process proceeds in an orderly manner according to the user's wishes. It solves the technical problems of unclear timing of target configuration information sending and lack of user confirmation in the traditional process.
[0101] In one possible implementation, the disk file within the OVA file can be read based on the end position of the OVF file within the OVA file, specifically including:
[0102] S2051: Determine the starting point for data reading based on the end position of the OVF file in the OVA file, read the disk description data block of the preset length, and obtain the data size of the disk file.
[0103] In this step, the terminal device determines the next byte after the end of the OVF file as the data reading start point, reads data of a preset length from the data reading start point, that is, the disk description data block, and obtains the data size of the disk file.
[0104] For example, if OVF ends at the 5th 512-byte block, then data (disk description data) is read starting from the byte following the 5th 512-byte block (the 6th 512-byte data block). As another example, if OVF ends at the 4th 512-byte block, then data (disk description data) is read starting from the byte following the 4th 512-byte block.
[0105] S2052: Start reading data from the beginning of the disk description data block to obtain the target disk file in the OVA file, and use the position after the target disk file as the new starting point for data reading. Repeat the step of reading the disk description data block until all disk files are read.
[0106] In this step, the target disk file is read starting from the next byte of the disk description data block. The disk file can be obtained by combining multiple 512-byte data blocks; these 512-byte blocks are read multiple times to obtain the target disk file. After completely reading the disk file of one disk, the next byte of that disk file is used as the new starting point for data reading. The disk description data block of the next disk is read, and the size of the next disk is determined again based on the content of the disk description data block. The disk file is then read in data blocks, and this process is repeated until all disk files have been read. The step of reading the disk description data block can be the same as step S2051 described above.
[0107] As can be seen from the description of the above embodiments, the embodiments of this disclosure obtain all disk files by reading disk description data blocks starting from the end of the OVF file, and then reading the disk files backward using the data size in the disk description data blocks. The entire process does not require decompressing the entire OVA file, which reduces the storage and computing resource consumption of the user terminal, achieves accurate extraction and caching of disk files, and binds the disk files with disk identifiers to ensure the accuracy of disk file transmission and writing. This solves the problem of wasting terminal resources and low reading efficiency caused by uploading the entire OVA file during traditional virtual machine deployment.
[0108] Figure 3 A flowchart illustrating the virtual machine deployment method provided in this application embodiment. Figure 2 .like Figure 3 The virtual machine deployment method shown is applied to servers and includes:
[0109] S301: Receive target configuration information sent by the terminal device.
[0110] In this step, the server receives the target configuration information transmitted by the terminal through a preset communication interface.
[0111] The target configuration information can be the original configuration information in the OVA file, or it can be a new target configuration file obtained after the user modifies it on the terminal.
[0112] S302: Create a virtual disk volume based on the target configuration information.
[0113] In this step, the server extracts disk-related configurations (number of disks, disk capacity, storage location, disk identifier, allocation mode, etc.) from the target configuration information and uses this information to create virtual machines. It calls the server's local storage management interface to create the corresponding number of virtual disk volumes in the storage unit based on the extracted configuration parameters. During creation, each virtual disk volume is bound to its corresponding disk identifier. The server then calls the disk write interface to gradually write the disk binary data in the buffer to the corresponding virtual disk volume. Next, it reads parameters from the target configuration information (computing resources, network configuration, startup parameters, virtual machine ownership, etc.). A virtual machine definition file is generated through the virtualization management interface, configuring parameters such as the number of CPU cores, memory size, network adapter, and startup order, and associating it with the virtual disk volumes whose data has already been written. The virtual machine definition file is registered with the hyperconverged platform / virtualization platform, completing the virtual machine creation. After creation, the virtual machine instance can be started according to the startup parameters in the target configuration information, and the virtual machine deployment status is recorded and fed back to the terminal device.
[0114] During the writing process, data integrity can be verified in real time (such as verifying the number of data bytes) to avoid data loss or writing errors. In the case of multi-threaded concurrent transmission, the server can allocate an independent write channel for each transmission thread to ensure that multiple disk files are written at the same time without interfering with each other.
[0115] S303: Concurrently receive disk files sent by terminal devices.
[0116] In this step, the same number of transmission threads as the number of disk files can be used to concurrently receive disk files sent by the terminal device. The number of disk files can also be an integer multiple of the number of transmission threads.
[0117] S304: Write disk files concurrently to the virtual disk volume.
[0118] In this step, multiple threads are also used to concurrently write the received disk files to the virtual disk volume. For example, if four disk files are received simultaneously, these four disk files will be stored into the virtual disk volume through four transfer threads.
[0119] As can be seen from the description of the above embodiments, the embodiments of this disclosure receive target configuration information sent by the terminal device, create a virtual disk volume according to the target configuration information, and concurrently receive and write disk files sent by the terminal device, thereby achieving fast reception and fast storage of disk files and increasing the configuration speed and efficiency of virtual machines.
[0120] In one possible implementation, in step S303 above, concurrently receiving disk files sent by the terminal device includes:
[0121] S320: The correspondence between the data transmission thread and the disk identifier sent by the receiving terminal device.
[0122] In this step, the corresponding relationship sent by the terminal device can be received through the preset communication interface. The corresponding relationship can be stored in a table, key-value pair or other format.
[0123] S321: Associate the disk file received through the data transfer thread with the virtual disk volume according to the correspondence between the data transfer thread and the disk identifier.
[0124] In this step, for example, if data transfer thread A corresponds to disk identifier E, then the disk file transferred by data transfer thread A is associated with disk identifier E. Similarly, if data transfer thread B corresponds to disk identifier F, then the disk file transferred by data transfer thread B is associated with disk identifier F.
[0125] As can be seen from the description of the above embodiments, the embodiments of this disclosure achieve accurate writing of disk files to virtual disk volumes by receiving the correspondence between data transmission threads and disk identifiers, and associating the disk files received by the data transmission threads with virtual disk volumes according to the correspondence.
[0126] In one possible implementation, in step S303 above, concurrently receiving disk files sent by the terminal device includes:
[0127] S330: Receives a disk identifier and disk file sent by a terminal device, wherein the disk identifier is associated with the disk file.
[0128] S340: Write the disk file to the virtual disk volume based on the disk identifier associated with the disk file.
[0129] The disk identifier can be carried in the header of the disk file data, so that the disk file and the virtual disk correspond accurately.
[0130] As can be seen from the description of the above embodiments, the embodiments of this disclosure realize the association between data transmission threads and disks by receiving the correspondence between data transmission threads and disk identifiers, thereby obtaining the storage location of the disk files transmitted by each data transmission thread.
[0131] Figure 4 This is a schematic diagram illustrating the interaction flow of the virtual machine deployment method provided in an embodiment of this application. Figure 4 As shown, the interaction flow of the virtual machine deployment method includes:
[0132] S401: Terminal device obtains OVA file.
[0133] S402: The terminal device reads the metadata of the OVF file of the OVA file based on the format rules of the OVA file.
[0134] S403: The terminal device obtains the data range where the OVF file is located based on the metadata of the OVF file, and reads and parses the OVF file based on the data range to obtain the target configuration information of the virtual machine described by the OVA file.
[0135] S404: The terminal device displays the target configuration information so that the user can modify or confirm the target configuration information.
[0136] S405: The terminal device reads the disk file in the OVA file.
[0137] S406: The terminal device sends the target configuration information to the server.
[0138] S407: The server uses the target configuration information to create a virtual disk volume.
[0139] S408: The terminal device sends the disk file to the server.
[0140] S409: The server writes disk files to the virtual disk volume.
[0141] Figure 5 Schematic diagram of the structure of the virtual machine deployment apparatus provided in the embodiments of this application Figure 1 .like Figure 5 As shown, the virtual machine deployment device 500 includes: a file acquisition module 501, a data reading module 502, a range acquisition module 503, and an information display module 504.
[0142] File acquisition module 501 is used to acquire Open Virtualization Device (OVA) files;
[0143] Data reading module 502 is used to read the metadata of OVA file's Open Virtualization Format (OVF) file based on the OVA file's format rules;
[0144] The range acquisition module 503 is used to obtain the data range where the OVF file is located based on the metadata of the OVF file, and read and parse the OVF file based on the data range to obtain the target configuration information of the virtual machine described by the OVA file;
[0145] The information display module 504 is used to display target configuration information so that users can configure virtual machine resources on the server according to the target configuration information.
[0146] In one possible implementation, the virtual machine deployment device 500 further includes a file sending module 505.
[0147] The file sending module 505 is used to read the metadata of the disk file in the OVA file based on the format rules of the OVA file; read the disk file based on the metadata of the disk file; send the target configuration information to the server so that the server can create a virtual disk volume that meets the data storage space size according to the target configuration information, wherein the target configuration information includes the data storage space size; and send the disk file in the OVA file to the server so that the server can write the disk file to the virtual disk volume.
[0148] In one possible implementation, the OVA file includes multiple disk files; the file sending module 505 is used to concurrently transmit each disk file in the OVA file to the server, so that the server concurrently writes each disk file to the corresponding virtual disk volume.
[0149] In one possible implementation, the target configuration information includes the number of disks; the file sending module 505 is used to create a corresponding number of data transmission threads based on the number of disk files; the data transmission threads are used to concurrently transmit each disk file in the OVA file to the server, so that the server concurrently writes the disk files to the virtual disk volume.
[0150] In one possible implementation, the disk file corresponds to a disk identifier; the file sending module 505 is used to send the disk identifier and the corresponding disk file to the server using a data transmission thread, so that the server concurrently writes the disk file to the virtual disk volume corresponding to the disk identifier.
[0151] In one possible implementation, the disk file corresponds to a disk identifier; the file sending module 505 is used to send the correspondence between the data transmission thread and the disk identifier to the server; the data transmission thread is used to send the disk file concurrently to the server, so that the server determines the disk identifier corresponding to the transmission thread according to the correspondence between the transmission thread and the disk identifier, and concurrently writes the disk file transmitted by the transmission thread to the virtual disk volume corresponding to the disk identifier.
[0152] In one possible implementation, the virtual machine deployment device 500 further includes an information adjustment module 506.
[0153] The information adjustment module 506 is used to respond to receiving an adjustment instruction for the target configuration information, adjust the target configuration information according to the adjustment instruction, and obtain new target configuration information.
[0154] In one possible implementation, the virtual machine deployment device 500 further includes an information sending module 507.
[0155] In response to the detection of a trigger signal for the send button, new target configuration information is sent to the server so that the server can create a virtual disk volume based on the new target configuration information.
[0156] Figure 6 Schematic diagram of the structure of the virtual machine deployment apparatus provided in the embodiments of this application Figure 2 .like Figure 6 As shown, the virtual machine deployment device 600 includes: a data receiving module 601, a disk creation module 602, a concurrent receiving module 603, and a file writing module 604.
[0157] The data receiving module 601 is used to receive target configuration information sent by the terminal device.
[0158] The disk creation module 602 is used to create virtual disk volumes based on the target configuration information.
[0159] The concurrent receiving module 603 is used to concurrently receive disk files sent by terminal devices.
[0160] File writing module 604 is used to concurrently write disk files to a virtual disk volume.
[0161] In one possible implementation, the concurrent receiving module 603 is used to receive the correspondence between data transmission threads and disk identifiers sent by the terminal device. Based on the correspondence between data transmission threads and disk identifiers, the disk files received through the data transmission threads are associated with virtual disk volumes.
[0162] In one possible implementation, the concurrent receiving module 603 is used to receive a disk identifier and a disk file sent by the terminal device, wherein the disk identifier is associated with the disk file. Based on the disk identifier associated with the disk file, the disk file is written to the virtual disk volume.
[0163] Figure 7 This is a schematic diagram of the structure of a computing device provided in an embodiment of this application.
[0164] like Figure 7 As shown, the computing device 700 may include a baseboard management controller 701 and a memory 702, wherein the baseboard management controller 701 and the memory 702 are coupled and can communicate with each other; for example, the baseboard management controller 701 and the memory 702 communicate via a communication bus 703, the memory 702 is used to store computer execution instructions, and the baseboard management controller 701 is used to invoke the computer execution instructions in the memory to execute the virtual machine deployment method shown in the above method embodiment. The computing device 700 may be a server.
[0165] Optionally, the computing device 700 may also include a communication interface, which may include a transmitter and / or a receiver.
[0166] Optionally, the aforementioned baseboard management controller can be a central processing unit (CPU), a graphics processing unit (GPU), other general-purpose processors, digital signal processors (DSPs), or application-specific integrated circuits (ASICs), etc. The general-purpose processor can be a microprocessor or any conventional processor. The steps of the method disclosed in the embodiments of this application can be directly implemented by a hardware processor, or implemented by a combination of hardware and software modules in the processor.
[0167] This application provides a computer-readable storage medium storing computer program instructions; when the program instructions are executed by a computing device, the computing device performs the virtual machine deployment method described above.
[0168] This application provides a computer program product, which includes computer program instructions. When the computer program instructions are executed, they cause a computing device or a computing device to perform the virtual machine deployment method described above.
[0169] All or part of the steps in the above method embodiments can be implemented by hardware related to program instructions. The aforementioned program can be stored in a readable memory. When the program is executed, it performs the steps of the above method embodiments; and the aforementioned memory (storage medium) includes: read-only memory (ROM), RAM, flash memory, hard disk, solid-state drive, magnetic tape, floppy disk, optical disk, and any combination thereof.
[0170] This application describes embodiments of methods, apparatus (systems), and computer program products according to embodiments of this application with reference to flowchart illustrations and / or block diagrams. It should be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processing unit of a general-purpose computer, special-purpose computer, embedded processor, or other programmable terminal device to produce a machine, such that the instructions, which execute via the processing unit of the computer or other programmable terminal device, generate instructions for implementing the flowchart illustrations. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0171] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable terminal device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.
[0172] These computer program instructions can also be loaded onto a computer or other programmable terminal device, causing a series of operational steps to be performed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable device for implementing the process. Figure 1One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
[0173] Obviously, those skilled in the art can make various modifications and variations to the embodiments of this application without departing from the spirit and scope of the embodiments of this application. Therefore, if these modifications and variations to the embodiments of this application fall within the scope of the claims of this application and their equivalents, the embodiments of this application are also intended to include these modifications and variations.
[0174] In the embodiments of this application, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element. The term "or" and its variations can mean "and / or." In the embodiments of this application, the terms "first," "second," etc., are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. In the embodiments of this application, "multiple" refers to two or more. "And / or" describes the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A alone, A and B simultaneously, and B alone. The character " / " generally indicates that the preceding and following related objects have an "or" relationship.
[0175] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the embodiments of this application, and are not intended to limit them. Although the embodiments of this application have been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some or all of the technical features therein. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of this application.
Claims
1. A virtual machine deployment method, characterized in that, Applied to terminal devices, including: Obtain the Open Virtualization Device (OVA) file; Based on the format rules of the OVA file, read the metadata of the OVA file's Open Virtualization Format (OVF) file; Based on the metadata of the OVF file, the data range in which the OVF file is located is obtained, and based on the data range, the OVF file is read and parsed to obtain the target configuration information of the virtual machine described by the OVF file; The target configuration information is displayed so that the user can configure virtual machine resources on the server according to the target configuration information.
2. The method according to claim 1, characterized in that, Also includes: Based on the format rules of the OVA file, read the metadata of the disk file in the OVA file; Read the disk file based on its metadata; The target configuration information is sent to the server so that the server creates a virtual disk volume that meets the data storage space size according to the target configuration information, wherein the target configuration information includes the data storage space size; The disk file in the OVA file is sent to the server so that the server writes the disk file to the virtual disk volume.
3. The method according to claim 2, characterized in that, The OVA file includes multiple disk files; Accordingly, sending the disk file in the OVA file to the server includes: The various disk files in the OVA file are concurrently transmitted to the server, so that the server concurrently writes each disk file to the corresponding virtual disk volume.
4. The method according to claim 3, characterized in that, The target configuration information includes the number of disks; The concurrent transfer of each disk file in the OVA file to the server, so that the server can concurrently write each disk file to the corresponding virtual disk volume, includes: Create a corresponding number of data transfer threads based on the number of disk files; The data transmission thread is used to concurrently transmit each disk file in the OVA file to the server, so that the server concurrently writes the disk files to the virtual disk volume.
5. The method according to claim 4, characterized in that, The disk file corresponds to the disk identifier; The step of using the data transmission thread to concurrently transmit each disk file in the OVA file to the server, so that the server concurrently writes the disk files to the virtual disk volume, includes: The data transmission thread is used to send the disk identifier and the corresponding disk file to the server, so that the server concurrently writes the disk file to the virtual disk volume corresponding to the disk identifier.
6. The method according to claim 4, characterized in that, Disk file corresponds to disk identifier; The step of using the data transmission thread to concurrently transmit each disk file in the OVA file to the server, so that the server concurrently writes the disk files to the virtual disk volume, includes: The correspondence between the data transmission thread and the disk identifier is sent to the server; The data transmission thread is used to send the disk file concurrently to the server, so that the server determines the disk identifier corresponding to the transmission thread according to the correspondence between the transmission thread and the disk identifier, and concurrently writes the disk file transmitted by the transmission thread to the virtual disk volume corresponding to the disk identifier.
7. The method according to claim 1, characterized in that, Also includes: In response to receiving an adjustment instruction for the target configuration information, the target configuration information is adjusted according to the adjustment instruction to obtain new target configuration information.
8. The method according to claim 7, characterized in that, Also includes: In response to detecting a trigger signal for the send button, the new target configuration information is sent to the server so that the server creates a virtual disk volume based on the new target configuration information.
9. A virtual machine deployment method, characterized in that, Applied to servers, including: Receive target configuration information sent by the terminal device; Create a virtual disk volume based on the target configuration information; Concurrently receive disk files sent by terminal devices; The disk files are written concurrently to the virtual disk volume.
10. A computing device, characterized in that, include: The computing device includes a memory and a baseboard management controller; The memory and the substrate management controller are coupled; The memory is used to store program instructions; The baseboard management controller is used to invoke the program instructions to cause the computing device to perform the method as described in any one of claims 1 to 8 or claim 9.