A virtual machine startup method and device
By using stored historical configuration data to directly call execution results, the virtual machine startup process is simplified, solving the problems of tedious steps and large resource usage in the virtual machine startup process, and achieving rapid startup and efficient response of the virtual machine.
Patent Information
- Application Number
- CN202010618472.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-06-30
- Publication Date
- 2024-08-23
- Estimated Expiration
- 2040-06-30
AI Technical Summary
Existing virtual machine emulators have complicated startup steps and occupy a lot of resources, resulting in long startup times and slow response times.
By using the first startup configuration file that stores historical configuration data, the generated execution results are directly called, skipping some boot steps, and simplifying the virtual machine startup process.
The virtual machine startup time is reduced, the device processing load is reduced, the response speed is improved, and the virtual machine is quickly started.
Smart Images

Figure CN111782342B
Abstract
Description
Technical Field
[0001] The embodiments of the present application relate to the field of virtualization technology, and in particular to a method and device for starting a virtual machine. Background Art
[0002] In the prior art, virtual machine emulators, such as Qemu (Qemu, Quick EMUlator), need to go through many steps in the process of guiding the virtual machine to complete the creation and startup based on the traditional boot process. The overall process is relatively cumbersome, and the virtual machine emulator needs to load a variety of built-in modules when executing each boot step to successfully execute each step and obtain the corresponding execution results. This will cause the virtual machine startup time to be too long, and it will occupy a large amount of physical resources such as the central processing unit, memory, input and output system, etc. during operation, resulting in a slow response speed of the electronic device in the process of creating and starting the virtual machine. Summary of the invention
[0003] The present application provides a virtual machine startup method and device that can realize rapid startup of a virtual machine by utilizing a first startup configuration file storing historical configuration data.
[0004] In order to solve the above technical problems, the embodiment of the present application provides a virtual machine startup method, including:
[0005] Determine a first startup configuration file, where the first startup configuration file is a pre-stored file, and the first startup configuration file includes a plurality of execution results, where the plurality of execution results are generated accordingly during a process of completing the startup of the virtual machine based on a boot process;
[0006] The virtual machine is started based on the first startup configuration file and the boot process.
[0007] Preferably, the boot process comprises the following steps:
[0008] Creating the virtual motherboard and virtual memory according to the obtained first virtual machine configuration information;
[0009] Initializing the virtual mainboard;
[0010] Establishing a storage space mapping relationship between virtual hardware and virtual memory in the virtual motherboard;
[0011] Determine a target operating system according to the first virtual machine configuration information, and boot the target operating system;
[0012] Controlling the target virtual mainboard to load the kernel of the target operating system;
[0013] Start the daemon of the target operating system.
[0014] Preferably, the first startup configuration file further includes first virtual machine configuration information input by a user, wherein the first virtual machine configuration information includes virtual hardware configuration parameters of the first virtual machine;
[0015] The determining of the first startup configuration file comprises:
[0016] In response to the virtual machine creation instruction, receiving second virtual machine configuration information input by a user, wherein the second virtual machine configuration information includes virtual hardware configuration parameters of the second virtual machine;
[0017] The first startup configuration file is determined according to the second virtual machine configuration information, wherein the second virtual machine configuration information matches the first virtual machine configuration information.
[0018] Preferably, the first startup configuration file further includes first virtual machine configuration information input by a user, wherein the first virtual machine configuration information includes virtual hardware configuration parameters of the first virtual machine;
[0019] The determining of the first startup configuration file comprises:
[0020] In response to the virtual machine creation instruction, receiving second virtual machine configuration information input by a user, wherein the second virtual machine configuration information includes virtual hardware configuration parameters of the second virtual machine;
[0021] The first startup configuration file is determined according to the second virtual machine configuration information, wherein the virtual motherboard configuration parameters stored in the first virtual machine configuration information match the virtual motherboard configuration parameters in the second virtual machine configuration information.
[0022] Preferably, completing the startup of the virtual machine based on the first startup configuration file and the boot process includes:
[0023] Obtaining, from the first startup configuration file, an execution result required for the current virtual machine during startup, wherein the required execution result may be all execution results stored in the first startup configuration file, or an execution result corresponding to a processing process of the virtual mainboard stored in the first startup configuration file;
[0024] Performing a data call on the required execution result, and determining a step corresponding to the boot process based on the called execution result;
[0025] The corresponding steps are skipped in order based on the required execution result, and other steps in the boot process are continued to be executed until the startup of the virtual machine is completed.
[0026] Preferably, the virtual machine emulator stores a plurality of startup configuration files;
[0027] The determining of the first startup configuration file comprises:
[0028] Responding to a virtual machine creation instruction input by a user;
[0029] Determining that the second virtual machine configuration information input by the user is not received;
[0030] Determine the startup time of the virtual machine corresponding to each startup configuration file respectively;
[0031] The first startup configuration file is determined from the multiple startup configuration files based on the startup duration.
[0032] Preferably, the determining the first startup configuration file includes:
[0033] Make sure that the startup configuration file is stored;
[0034] Determine the file content of the startup configuration file;
[0035] Determine, from the startup configuration files, a first startup configuration file including the plurality of execution results based on the file content;
[0036] The method further comprises:
[0037] Determining that no startup configuration file is stored, or at least determining based on the file content that the stored startup configuration file does not include the multiple execution results;
[0038] The virtual machine is guided to start up based on the boot process.
[0039] Preferably, the virtual machine emulator guides the virtual machine to complete startup based on the boot process, including:
[0040] Guiding the first virtual machine to complete startup based on the boot process, and simultaneously recording the execution result of each step in the boot process;
[0041] After the virtual machine is started up based on the boot process, the method further includes:
[0042] Establishing the first startup configuration file;
[0043] The execution result is stored in the first startup configuration file.
[0044] Another embodiment of the present invention provides a virtual simulation device, comprising:
[0045] A determination module, configured to determine whether a first startup configuration file is stored;
[0046] An execution module is used to complete the startup of the virtual machine based on the first startup configuration file and the boot process.
[0047] The first startup configuration file is a pre-stored file, and the first startup configuration file includes a plurality of execution results, and the plurality of execution results are correspondingly generated by the execution module during the process of executing the boot process to complete the startup of the virtual machine.
[0048] Preferably, the determining module is further used for:
[0049] Make sure that the startup configuration file is stored;
[0050] Determine the file content of the startup configuration file;
[0051] Determine, from the startup configuration files, a first startup configuration file including the plurality of execution results based on the file content;
[0052] When the determining module determines that no startup configuration file is stored, or at least determines based on the file content that the stored startup configuration file does not include the multiple execution results, the executing module is further configured to:
[0053] The virtual machine is guided to start up based on the boot process.
[0054] Based on the above disclosure, it can be learned that the present application can assist the virtual machine emulator in re-creating or starting the virtual machine based on the boot process by utilizing the execution results correspondingly generated during the historical creation and startup of the virtual machine, so that at least in the process of starting the virtual machine this time, the execution results of at least part of the boot steps do not need to be processed and derived again, but the stored execution results can be directly called for data, thereby reducing the processing and derivation process of at least part of the execution results, saving processing and derivation time, thereby reducing the device processing load, shortening the startup time of the virtual machine, and realizing the rapid startup of the virtual machine. BRIEF DESCRIPTION OF THE DRAWINGS
[0055] Figure 1 The present invention is a flowchart of a method for starting a virtual machine in an embodiment of the present application.
[0056] Figure 2 This is a flowchart of a virtual machine startup method in another embodiment of the present application.
[0057] Figure 3 This is a flowchart of a virtual machine startup method in another embodiment of the present application.
[0058] Figure 4 This is a flowchart of a virtual machine startup method in another embodiment of the present application.
[0059] Figure 5 This is a flowchart of a virtual machine startup method in another embodiment of the present application.
[0060] Figure 6 This is a flowchart of a virtual machine startup method in another embodiment of the present application.
[0061] Figure 7 This is a flowchart of a virtual machine startup method in another embodiment of the present application.
[0062] Figure 8 This is a flowchart of a virtual machine startup method in another embodiment of the present application.
[0063] Fig. 9 It is a structural block diagram of the virtual machine simulation device in the embodiment of the present application.
[0064] Fig.10 It is a structural block diagram of an electronic device in an embodiment of the present application. DETAILED DESCRIPTION
[0065] Below, specific embodiments of the present application are described in detail with reference to the accompanying drawings, but are not intended to limit the present application.
[0066] It should be understood that various modifications may be made to the embodiments disclosed herein. Therefore, the following description should not be considered as limiting, but merely as an example of an embodiment. Other modifications within the scope and spirit of the present disclosure will occur to those skilled in the art.
[0067] The accompanying drawings, which are incorporated in and constitute a part of the specification, illustrate embodiments of the present disclosure and, together with the general description of the present disclosure given above and the detailed description of the embodiments given below, serve to explain the principles of the present disclosure.
[0068] These and other characteristics of the present application will become apparent from the following description of a preferred form of embodiment given as a non-limiting example with reference to the accompanying drawings.
[0069] It should also be understood that, although the present application has been described with reference to some specific examples, those skilled in the art will be able to realize many other equivalent forms of the present application that have the features described in the claims and are therefore within the scope of protection defined thereby.
[0070] The above and other aspects, features and advantages of the present disclosure will become more apparent from the following detailed description when taken in conjunction with the accompanying drawings.
[0071] Specific embodiments of the present disclosure are described hereinafter with reference to the accompanying drawings; however, it should be understood that the disclosed embodiments are merely examples of the present disclosure, which may be implemented in a variety of ways. Well-known and / or repeated functions and structures are not described in detail to avoid obscuring the present disclosure with unnecessary or redundant details. Therefore, the specific structural and functional details disclosed herein are not intended to be limiting, but merely serve as a basis and representative basis for the claims to teach those skilled in the art to use the present disclosure in a variety of ways with substantially any suitable detailed structure.
[0072] This specification may use the phrases "in one embodiment," "in another embodiment," "in a further embodiment," or "in other embodiments," all of which may refer to one or more of the same or different embodiments according to the present disclosure.
[0073] Below, embodiments of the present application are described in detail with reference to the accompanying drawings.
[0074] like Figure 1 As shown, an embodiment of the present invention provides a method for starting a virtual machine, comprising:
[0075] Determine a first startup configuration file, where the first startup configuration file is a pre-stored file, and the first startup configuration file includes a plurality of execution results, where the plurality of execution results are generated accordingly during the process of completing the startup of the virtual machine based on the boot process;
[0076] The creation and startup of the virtual machine are completed based on the first startup configuration file and the boot process.
[0077] For example, a virtual machine emulator software / program is loaded on an electronic device, and the software is an open source simulation processing software, such as Qemu (Quick EMUlator). When the software is loaded in the electronic device, a virtual simulation module will be generated to complete the startup of the virtual machine. The module is referred to as the virtual machine emulator below. After the user starts the virtual machine emulator and inputs the virtual machine creation instruction to it, the virtual machine emulator will determine whether a first startup configuration file is stored in its storage module. The first startup configuration file stores multiple execution results. The multiple execution results are generated by the virtual machine emulator in sequence to complete the creation and startup of the historical virtual machine. That is, the boot process includes multiple boot steps. When the virtual machine emulator executes multiple boot steps in sequence, an execution result will be generated accordingly based on each boot step. The next boot step needs to be executed only after the previous boot step is completed and the corresponding execution result is generated. That is, the execution result of the previous boot step is the trigger condition for executing the next boot step. When the virtual machine emulator determines that the first startup configuration file is stored in its storage module or in other storage modules of the electronic device, the creation and startup of the virtual machine at least are completed based on the first startup configuration file and the boot process. Alternatively, when a user wants to start a historical virtual machine, the user can determine the first startup configuration file corresponding to the historical virtual machine to be started, and then the device completes the startup of the historical virtual machine based on the first startup configuration file and the boot process. Since the first startup configuration file stores part or all of the execution results required in the startup process of the virtual machine, when the virtual machine emulator starts the virtual machine based on the boot process, or creates and starts the virtual machine, the execution results in the first startup configuration file can be directly used, so that when the virtual machine is started, or created and started, at least part of the processing results of the boot steps do not need to be derived again, so at least the startup time of the virtual machine is saved, the actual boot process is simplified, and a large amount of intermediate redundant data generated when deriving each processing result is avoided, which reduces the data processing load for the electronic device and speeds up the response speed of the electronic device to the user.
[0078] Therefore, based on the disclosure of the above-mentioned embodiments, it can be known that the beneficial effect of the embodiments of the present application is that by utilizing the execution results corresponding to the historical creation and startup process of the virtual machine, the virtual machine emulator is assisted to re-create and start, or restart the virtual machine based on the boot process, so that in the process of starting the virtual machine this time, at least part of the execution results of the boot steps do not need to be processed and derived again, but data calls can be made directly to the stored execution results, thereby reducing the processing and derivation process of at least part of the execution results, saving processing and derivation time, thereby reducing the device processing load, shortening the startup time of the virtual machine, and realizing the rapid startup of the virtual machine.
[0079] Furthermore, if Figure 2 As shown, the boot process in this embodiment includes the following steps:
[0080] Start the virtual machine emulator;
[0081] Creating a virtual motherboard and virtual memory according to the obtained first virtual machine configuration information;
[0082] Initialize the virtual motherboard;
[0083] Establishing a storage space mapping relationship between virtual hardware and virtual memory in a virtual motherboard;
[0084] Determine a target operating system according to the first virtual machine configuration information, and boot the target operating system;
[0085] Control the target virtual motherboard to load the kernel of the target operating system;
[0086] Start the target operating system's daemon.
[0087] Among them, the first virtual machine configuration information is input after the user inputs the virtual machine creation instruction, based on the dialog box of the virtual machine emulator feedback asking for specific virtual hardware configuration, etc., and can also be input by the user while inputting the virtual machine creation instruction, without specific limitation. The first virtual machine configuration information specifically includes the configuration parameters of each virtual hardware in the first virtual machine, such as the model of the virtual motherboard, the size of the virtual hard disk, etc., and can also include the specified loaded virtual operating system, that is, the target operating system in the text, such as loading the windows operating system, the linux operating system, etc. Initializing the virtual motherboard includes starting the Sea BIOS program (SeaBIOS is an open source 16bit x86 BIOS program) to complete the initialization of the memory, central processing unit, and input and output system on the virtual motherboard. The daemon program of starting the target operating system, for example, can be a program such as starting a firewall, installing a driver for virtual hardware, etc. Of course, when starting the daemon program, a client application, such as a browser, etc., can also be started. The above-mentioned various execution results are generated accordingly by the virtual machine emulator when executing the above-mentioned various boot steps. The execution result also includes the established virtual machine, that is, the execution result of creating a virtual motherboard and virtual memory according to the first virtual machine configuration information. When the same virtual machine is started again, the execution result of the corresponding virtual machine can be directly called.
[0088] Furthermore, when the virtual machine emulator in this embodiment determines the first startup configuration file, it includes:
[0089] Make sure that the startup configuration file is stored;
[0090] Determine the file content of the startup configuration file;
[0091] A first startup configuration file including the execution result required for starting the virtual machine this time is determined from the startup configuration files at least based on the file content.
[0092] That is, in the process of determining the first startup configuration file, the virtual machine emulator first needs to determine whether a startup configuration file is stored in its storage module. If it is determined that a startup configuration file is stored, the specific file content of each startup configuration file is read and determined, and then the first startup configuration file is determined from the stored startup configuration files at least based on the file content of each startup configuration file.
[0093] Specifically, the first startup configuration file in this embodiment also includes the first virtual machine configuration information input by the user, and the first virtual machine configuration information at least includes the virtual hardware configuration parameters of the first virtual machine. When the virtual machine emulator determines the first startup configuration file, it specifically includes the following two embodiments:
[0094] Embodiment 1:
[0095] The first startup configuration file also includes information of the target operating system to be loaded;
[0096] Determine the first startup configuration file, including:
[0097] In response to the virtual machine creation instruction, receiving second virtual machine configuration information input by a user, the second virtual machine configuration information including virtual hardware configuration parameters of the second virtual machine;
[0098] The first startup configuration file is determined according to the second virtual machine configuration information, wherein the second virtual machine configuration information matches the first virtual machine configuration information.
[0099] For example, Figure 3 As shown, the virtual machine emulator receives a virtual machine creation instruction input by the user, which is used to create a new virtual machine, which is temporarily defined as the second virtual machine, and inputs the second virtual machine configuration information. The second virtual machine configuration information includes the virtual hardware configuration parameters of the second virtual machine and the target operating system information specified to be loaded. Then, the virtual machine emulator responds to the instruction input by the user, reads the specific content in the second virtual machine configuration information, and performs a matching search in the storage module based on the reading result. If the specific content of the first virtual machine configuration information contained in a certain startup configuration file is found to be completely matched with the specific content of the read second virtual machine configuration information, that is, the virtual hardware configuration parameters in the two configuration information are the same, and the specified target operating system is also the same, then at this time, it can be determined that the second virtual machine is essentially the same as the first virtual machine, and the first virtual machine can be directly started based on the boot process and the configuration file. Therefore, the virtual machine emulator determines that the startup configuration file is the first startup configuration file.
[0100] Embodiment 2:
[0101] This embodiment is different from the first embodiment in that when the second virtual machine configuration information or the first virtual machine configuration information contains information about a target operating system to be loaded, if the virtual machine emulator determines through searching that the first virtual machine configuration information stored in a certain startup configuration file is exactly the same as the configuration parameters about the virtual hardware in the obtained second virtual machine configuration information, but the target operating systems to be loaded are different, then the virtual machine emulator also determines that the startup configuration file is the first startup configuration file.
[0102] Embodiment three:
[0103] Determine the first startup configuration file, including:
[0104] In response to the virtual machine creation instruction, receiving second virtual machine configuration information input by a user, the second virtual machine configuration information including virtual hardware configuration parameters of the second virtual machine;
[0105] A first startup configuration file is determined according to the second virtual machine configuration information, wherein the virtual motherboard configuration parameters stored in the first virtual machine configuration information match the virtual motherboard configuration parameters in the second virtual machine configuration information.
[0106] For example, Figure 4 As shown, the virtual machine emulator receives a virtual machine creation instruction input by the user, which is used to create a new virtual machine, which is also temporarily defined as the second virtual machine, and the second virtual machine configuration information is input. The second virtual machine configuration information at least includes the virtual hardware configuration parameters of the second virtual machine. Then, the virtual machine emulator responds to the instruction input by the user, reads the specific content in the second virtual machine configuration information, and performs a matching search in the storage module based on the read result. If the specific content of the first virtual machine configuration information contained in a certain startup configuration file is found to be the same as the specific content of the read second virtual machine configuration information, the virtual motherboard configuration parameters are the same, then it means that the virtual motherboards of the first virtual machine and the second virtual machine are the same, and the execution result corresponding to the virtual motherboard does not need to be executed again during the creation and startup of the second virtual machine, and the virtual motherboard that has been created and started by the first virtual machine can be directly used, that is, the execution result generated by the first virtual machine during the creation and startup of the virtual motherboard can be directly used. Based on this, the virtual machine emulator determines that the startup configuration file is the first startup configuration file.
[0107] In addition, when the device determines whether the first startup configuration file is stored, it can also be searched based on the virtual machine configuration information specified by the user. For example, when the user wants to start a historical virtual machine, the user can enter the virtual machine configuration information to be searched in the search engine. The search engine performs a matching search based on the input information, and then determines the first startup configuration file.
[0108] Furthermore, if Figure 5 As shown, after determining the first startup configuration file, completing the startup of the virtual machine based on the first startup configuration file and the boot process includes:
[0109] Obtaining the execution result required for the current virtual machine during the startup process from the first startup configuration file, where the required execution result may be all execution results stored in the first startup configuration file, or an execution result corresponding to the processing process of the virtual mainboard stored in the first startup configuration file;
[0110] Performing data call for the required execution result, and determining the corresponding step in the guidance process based on the called execution result;
[0111] The corresponding steps are skipped in sequence based on the desired execution results, and other steps in the boot process are continued to be executed until the virtual machine is created and started.
[0112] Specifically, after determining the first startup configuration file, the virtual machine emulator can explain that the first startup configuration file contains some or all of the execution results required in the current virtual machine startup process. When determining the required execution results, it can be determined based on the comparison of the virtual machine configuration information in the process of determining the first startup configuration file. For example, by comparing the first virtual machine configuration information and the second virtual machine configuration information, it can be known that if the two configuration information are completely consistent, it can be determined that all the execution results in the first startup configuration file can be used for the creation and startup of the virtual machine this time, that is, all the execution results in the first startup configuration file are the required execution results. At this time, the virtual machine emulator does not need to create a virtual machine again, and directly performs steps such as initialization of virtual hardware based on the corresponding virtual hardware data recorded in the first startup configuration file and the boot process until the startup of the virtual machine corresponding to the first startup configuration file is completed. The execution results of each boot step in the startup process do not need to be derived again, and the data of the execution results stored in the first startup configuration file can be directly called, which greatly improves the startup speed. If only the configuration parameters corresponding to the virtual motherboard are consistent in the two configuration information, then in the first startup configuration file, only the execution results of the generation and initialization part of the corresponding virtual motherboard in the boot process are available, that is, only this part of the execution results is the execution result required this time. After the required execution result is determined, the virtual machine emulator performs data call on the required execution result and determines the boot step corresponding to the execution result in the boot process. After that, the virtual machine emulator executes the boot process, and after reaching the corresponding boot step, directly calls the corresponding execution result, and triggers the execution of the next boot step based on the execution result. If the execution result of the next boot step can also be called and does not need to be generated, it is directly called and continues to start the next boot step until there is no callable execution result, then the step is executed according to the normal process, and the corresponding execution result is generated until the creation and startup of this virtual machine is completed. The above-mentioned repeated execution process of triggering the next boot step based on the execution result of the call is a step jump process, that is, there is no need to execute each boot step that can directly call the execution result, and each boot step can be directly skipped based on the corresponding execution result, and directly enters the boot step that needs to be executed normally to obtain the corresponding execution result. Since the above process does not need to derive and process the execution results of all the boot steps, the method of this embodiment saves time compared to the previous virtual machine creation and startup process, so that virtual machines with the same configuration that have been created historically or virtual machines with only the same virtual motherboard configuration can directly call historical data when they are created or started again, without having to execute all the boot steps again.
[0113] Furthermore, if Figure 6 As shown, when multiple startup configuration files are stored in the virtual machine emulator,
[0114] Determine the first startup configuration file, including:
[0115] Responding to a virtual machine creation instruction input by a user;
[0116] Determining that the second virtual machine configuration information input by the user is not received;
[0117] Determine the startup time of the virtual machine corresponding to each startup configuration file respectively;
[0118] A first startup configuration file is determined from a plurality of startup configuration files based on the startup duration.
[0119] For example, when a plurality of startup configuration files corresponding to different virtual machines are stored in the storage module of the virtual machine emulator, when the virtual machine emulator receives the virtual machine creation instruction input by the user, but does not receive the second virtual machine configuration information input by the user, the virtual machine emulator can respectively determine the startup time of the corresponding virtual machine based on each startup configuration file, and then select the first startup configuration file from the plurality of startup configuration files based on the time. After that, the virtual machine emulator does not need to create a new virtual machine again, and can directly start the corresponding historical virtual machine based on the first startup configuration file and the boot process. Among them, the determination of the above-mentioned durations can be specifically determined according to the data size of each stored execution result. If the data storage volume is large, the time consumption is usually long, and if the data storage volume is small, the time consumption is usually short. Alternatively, the startup time consumption of the virtual machine corresponding to each startup configuration file can be determined based on the historical records of the startup time consumption of each virtual motherboard and the target operating system. When determining the first startup configuration file, the startup configuration file corresponding to the virtual machine with the shortest startup time consumption can be selected as the first startup configuration file, so that the startup time consumption of this virtual machine is the shortest.
[0120] Alternatively, for the above situation, the virtual machine emulator may also determine the first startup configuration file based on the pre-stored priorities set for each stored startup configuration file.
[0121] Furthermore, if Figure 7 As shown, the method in this embodiment also includes:
[0122] Determining that no startup configuration file is stored, or at least determining based on the file content that the stored startup configuration file does not contain multiple execution results;
[0123] The virtual machine is booted based on the boot process.
[0124] For example, the virtual machine emulator determines that there is no startup configuration file stored in its storage module, such as when a virtual machine is created for the first time, when an already created virtual machine is started for the first time, or by reading the file content of the stored startup configuration file and determining after searching that the stored configuration file does not contain multiple execution results, it automatically guides the creation or startup of this virtual machine according to the boot process without calling any processing results.
[0125] For another example, when the virtual machine emulator determines that the first virtual machine configuration information does not match the second virtual machine configuration information at all, or only the target operating system information matches, the virtual machine emulator may also determine that there is no first startup configuration file and complete the creation or startup of this virtual machine based only on the boot process.
[0126] Furthermore, if Figure 8 As shown, the virtual machine emulator guides the virtual machine to complete startup based on the boot process, including:
[0127] Guiding the first virtual machine to complete startup of the virtual machine based on the boot process, and simultaneously recording the execution result of each step in the corresponding boot process;
[0128] After the virtual machine is started based on the boot process, it also includes:
[0129] Create a first startup configuration file;
[0130] The execution result is stored in the first startup configuration file.
[0131] That is, if the first startup configuration file is not found, and the virtual machine only completes the creation and initialization of the virtual machine through the boot process, the virtual machine emulator will record the execution results of each step in the process of completing the virtual machine creation and startup based on the boot process, and after the virtual machine startup is completed, it will create the first startup configuration file in the storage module and store all the recorded execution results at the same time, or store the virtual machine configuration information received from the user at the same time, so that when the virtual machine is created again subsequently, a matching startup configuration file can be quickly found.
[0132] like Fig. 9 As shown, another embodiment of the present invention also provides a virtual machine simulation device, including:
[0133] a determination module, configured to determine whether a first startup configuration file is stored,
[0134] A processing module, used to complete the startup of the virtual machine according to the first startup configuration file and the boot process;
[0135] The first startup configuration file is a pre-stored file, and the first startup configuration file includes multiple execution results, which are generated accordingly during the process of executing the boot process in sequence by the processing module to complete the creation and startup of the virtual machine.
[0136] For example, the virtual machine simulation device may include an open source simulation processor / open source simulation processing software, such as Qemu, Quick EMUlator. After the user starts the virtual machine simulation device and inputs a virtual machine creation instruction to it, the determination module determines whether the virtual machine simulation device stores a first startup configuration file, in which a plurality of execution results are stored, and the plurality of execution results are generated by the processing module in sequence by executing the boot process to complete the creation and startup process of the historical virtual machine. That is, the boot process includes a plurality of boot steps, and when the processor executes a plurality of boot steps in sequence, an execution result will be generated accordingly based on each boot step, and the next boot step will be executed only after the previous boot step completes the execution and generates the corresponding execution result. That is, the execution result of the previous boot step is the trigger condition for executing the next boot step. When the determination module determines that the virtual machine simulation device stores the first startup configuration file, the startup of this virtual machine is completed based on the first startup configuration file and the boot process. Since the first startup configuration file stores part or all of the execution results required in the current virtual machine startup process, when the processing module starts the virtual machine based on the boot process, the execution results in the first startup configuration file can be directly used, so that during the startup process of this virtual machine, the processing results of at least some boot steps do not need to be derived again, thereby saving the startup time of this virtual machine, simplifying the actual boot process, avoiding a large amount of intermediate redundant data generated when deriving each processing result, reducing the data processing load for the electronic device, and speeding up the response speed of the electronic device to the user.
[0137] Therefore, based on the disclosure of the above-mentioned embodiments, it can be known that the beneficial effect of the embodiments of the present application is that by utilizing the execution results corresponding to the historical creation and startup of the virtual machine, the processor is assisted in re-creating and starting the virtual machine based on the boot process, so that in the process of starting the virtual machine this time, at least part of the execution results of the boot steps do not need to be processed and derived again, but the stored execution results can be directly called for data, thereby reducing the processing and derivation process of at least part of the execution results, saving processing and derivation time, thereby reducing the device processing load, shortening the startup time of the virtual machine, and realizing the rapid startup of the virtual machine.
[0138] Furthermore, the boot process includes the following steps:
[0139] Creating the virtual motherboard and virtual memory according to the obtained first virtual machine configuration information;
[0140] Initializing the virtual mainboard;
[0141] Establishing a storage space mapping relationship between virtual hardware and virtual memory in the virtual motherboard;
[0142] Determine a target operating system according to the first virtual machine configuration information, and boot the target operating system;
[0143] Controlling the target virtual mainboard to load the kernel of the target operating system;
[0144] Start the daemon of the target operating system.
[0145] Furthermore, the first startup configuration file also includes first virtual machine configuration information input by a user, and the first virtual machine configuration information includes virtual hardware configuration parameters of the first virtual machine;
[0146] The determining module determines the first startup configuration file, including:
[0147] In response to the virtual machine creation instruction, receiving second virtual machine configuration information input by a user, wherein the second virtual machine configuration information includes virtual hardware configuration parameters of the second virtual machine;
[0148] The first startup configuration file is determined according to the second virtual machine configuration information, wherein the second virtual machine configuration information matches the first virtual machine configuration information.
[0149] Furthermore, the first startup configuration file also includes first virtual machine configuration information input by a user, and the first virtual machine configuration information includes virtual hardware configuration parameters of the first virtual machine;
[0150] The determining module determines the first startup configuration file, including:
[0151] In response to the virtual machine creation instruction, receiving second virtual machine configuration information input by a user, wherein the second virtual machine configuration information includes virtual hardware configuration parameters of the second virtual machine;
[0152] The first startup configuration file is determined according to the second virtual machine configuration information, wherein the virtual motherboard configuration parameters stored in the first virtual machine configuration information match the virtual motherboard configuration parameters in the second virtual machine configuration information.
[0153] Furthermore, the execution module completes the startup of the virtual machine based on the first startup configuration file and the boot process, including:
[0154] Obtaining, from the first startup configuration file, an execution result required for the current virtual machine during startup, wherein the required execution result may be all execution results stored in the first startup configuration file, or an execution result corresponding to a processing process of the virtual mainboard stored in the first startup configuration file;
[0155] Performing a data call on the required execution result, and determining a step corresponding to the boot process based on the called execution result;
[0156] The corresponding steps are skipped in order based on the required execution result, and other steps in the boot process are continued to be executed until the startup of the virtual machine is completed.
[0157] Furthermore, the virtual machine simulation device also includes a storage module, in which a plurality of startup configuration files are stored;
[0158] The determining module determines the first startup configuration file, including:
[0159] Responding to a virtual machine creation instruction input by a user;
[0160] Determining that the second virtual machine configuration information input by the user is not received;
[0161] Determine the startup time of the virtual machine corresponding to each startup configuration file respectively;
[0162] The first startup configuration file is determined from the multiple startup configuration files based on the startup duration.
[0163] Further, the determining module determines the first startup configuration file, including:
[0164] Make sure that the startup configuration file is stored;
[0165] Determine the file content of the startup configuration file;
[0166] Determine, from the startup configuration files, a first startup configuration file including the plurality of execution results based on the file content;
[0167] Further, when the determination module determines that no startup configuration file is stored, or at least determines based on the file content that the stored startup configuration file does not include the multiple execution results, the execution module guides the virtual machine to complete startup based on the boot process.
[0168] Furthermore, the execution module guides the virtual machine to complete creation and startup based on the boot process, including:
[0169] Guiding the first virtual machine to complete startup based on the boot process, and simultaneously recording the execution result of each step in the boot process;
[0170] After the virtual machine is started up based on the boot process, the method further includes:
[0171] Establishing the first startup configuration file in the storage module;
[0172] The execution result is stored in the first startup configuration file.
[0173] like Fig.10 As shown, another embodiment of the present invention further provides an electronic device, including:
[0174] one or more processors;
[0175] A computer readable medium configured to store one or more programs;
[0176] The one or more programs are configured to be executed by the one or more processors, so that the one or more processors implement the method described above.
[0177] Specifically, the one or more programs may be virtual machine simulation programs, and the method includes:
[0178] The one or more processors determine a first startup configuration file, and complete the creation and startup of the virtual machine based on the first startup configuration file and the boot process; wherein the first startup configuration file is a pre-stored file, and the first startup configuration file includes multiple execution results, and the multiple execution results are generated accordingly during the process of the processor executing the boot process in sequence to complete the creation and startup of the virtual machine.
[0179] For example, the one or more programs are programs corresponding to an open source simulation processor / open source simulation processing software, such as Qemu, Quick EMUlator, which can be loaded into the processor. After the user starts the one or more programs through the processor and inputs a virtual machine creation instruction to the processor, the processor determines whether the electronic device stores a first startup configuration file, in which a plurality of execution results are stored, and the plurality of execution results are generated by the processor in sequence to execute the boot process to complete the creation and startup process of the historical virtual machine. That is, the boot process includes a plurality of boot steps. When the processor executes a plurality of boot steps in sequence, an execution result is generated accordingly based on each boot step, and the next boot step needs to be executed after the previous boot step is completed and the corresponding execution result is generated. That is, the execution result of the previous boot step is the trigger condition for executing the next boot step. When the processor determines that the electronic device stores a first startup configuration file, the startup of this virtual machine is completed based on the first startup configuration file and the boot process. Since the first startup configuration file stores part or all of the execution results required in the current virtual machine startup process, when the processor starts the virtual machine based on the boot process, the execution results in the first startup configuration file can be directly used, so that during the startup process of this virtual machine, the processing results of at least some boot steps do not need to be derived again, thereby saving the startup time of this virtual machine, simplifying the actual boot process, avoiding a large amount of intermediate redundant data generated when deriving each processing result, reducing the data processing load for the electronic device, and speeding up the response speed of the electronic device to the user.
[0180] Therefore, based on the disclosure of the above-mentioned embodiments, it can be known that the beneficial effect of the embodiments of the present application is that by utilizing the execution results corresponding to the historical creation and startup of the virtual machine, the processor is assisted in re-creating and starting the virtual machine based on the boot process, so that in the process of starting the virtual machine this time, at least part of the execution results of the boot steps do not need to be processed and derived again, but the stored execution results can be directly called for data, thereby reducing the processing and derivation process of at least part of the execution results, saving processing and derivation time, thereby reducing the device processing load, shortening the startup time of the virtual machine, and realizing the rapid startup of the virtual machine.
[0181] Furthermore, the boot process includes the following steps:
[0182] Creating the virtual motherboard and virtual memory according to the obtained first virtual machine configuration information;
[0183] Initializing the virtual mainboard;
[0184] Establishing a storage space mapping relationship between virtual hardware and virtual memory in the virtual motherboard;
[0185] Determine a target operating system according to the first virtual machine configuration information, and boot the target operating system;
[0186] Controlling the target virtual mainboard to load the kernel of the target operating system;
[0187] Start the daemon of the target operating system.
[0188] Furthermore, the first startup configuration file also includes first virtual machine configuration information input by a user, and the first virtual machine configuration information includes virtual hardware configuration parameters of the first virtual machine;
[0189] The processor determines a first startup configuration file, including:
[0190] In response to the virtual machine creation instruction, receiving second virtual machine configuration information input by a user, wherein the second virtual machine configuration information includes virtual hardware configuration parameters of the second virtual machine;
[0191] The first startup configuration file is determined according to the second virtual machine configuration information, wherein the second virtual machine configuration information matches the first virtual machine configuration information.
[0192] Furthermore, the first startup configuration file also includes first virtual machine configuration information input by a user, and the first virtual machine configuration information includes virtual hardware configuration parameters of the first virtual machine;
[0193] The processor determines a first startup configuration file, including:
[0194] In response to the virtual machine creation instruction, receiving second virtual machine configuration information input by a user, wherein the second virtual machine configuration information includes virtual hardware configuration parameters of the second virtual machine;
[0195] The first startup configuration file is determined according to the second virtual machine configuration information, wherein the virtual motherboard configuration parameters stored in the first virtual machine configuration information match the virtual motherboard configuration parameters in the second virtual machine configuration information.
[0196] Furthermore, the execution module completes the startup of the virtual machine based on the first startup configuration file and the boot process, including:
[0197] Obtaining, from the first startup configuration file, an execution result required for the current virtual machine during startup, wherein the required execution result may be all execution results stored in the first startup configuration file, or an execution result corresponding to a processing process of the virtual mainboard stored in the first startup configuration file;
[0198] Performing a data call on the required execution result, and determining a step corresponding to the boot process based on the called execution result;
[0199] The corresponding steps are skipped in order based on the required execution result, and other steps in the boot process are continued to be executed until the startup of the virtual machine is completed.
[0200] Furthermore, the electronic device further comprises a storage module, wherein a plurality of startup configuration files are stored in the storage module;
[0201] The processor determines a first startup configuration file, including:
[0202] Responding to a virtual machine creation instruction input by a user;
[0203] Determining that the second virtual machine configuration information input by the user is not received;
[0204] Determine the startup time of the virtual machine corresponding to each startup configuration file respectively;
[0205] The first startup configuration file is determined from the multiple startup configuration files based on the startup duration.
[0206] Further, the processor determines the first startup configuration file, including:
[0207] Make sure that the startup configuration file is stored;
[0208] Determine the file content of the startup configuration file;
[0209] Determine, from the startup configuration files, a first startup configuration file including the plurality of execution results based on the file content;
[0210] Further, when the processor determines that no startup configuration file is stored, or at least determines based on the file content that the stored startup configuration file does not include the multiple execution results, the execution module guides the virtual machine to complete startup based on the boot process.
[0211] Furthermore, the execution module guides the virtual machine to complete creation and startup based on the boot process, including:
[0212] Guiding the first virtual machine to complete startup based on the boot process, and simultaneously recording the execution result of each step in the boot process;
[0213] After the virtual machine is started up based on the boot process, the method further includes:
[0214] Establishing the first startup configuration file in the storage module;
[0215] The execution result is stored in the first startup configuration file.
[0216] The above embodiments are only exemplary embodiments of the present application and are not intended to limit the present application. The protection scope of the present application is defined by the claims. Those skilled in the art may make various modifications or equivalent substitutions to the present application within the essence and protection scope of the present application, and such modifications or equivalent substitutions shall also be deemed to fall within the protection scope of the present application.
Claims
1. A method for starting a virtual machine, comprising: Determine a first startup configuration file, where the first startup configuration file is a pre-stored file, the first startup configuration file includes a plurality of execution results, the plurality of execution results are generated accordingly during the process of completing the startup of the first virtual machine based on the boot process, the pre-stored file also includes first virtual machine configuration information input by a user, the first virtual machine configuration information includes virtual hardware configuration parameters of the first virtual machine; Complete startup of the first virtual machine based on the first startup configuration file and the boot process; Wherein, determining the first startup configuration file includes: In response to the virtual machine creation instruction, receiving second virtual machine configuration information input by a user, wherein the second virtual machine configuration information includes virtual hardware configuration parameters of the second virtual machine; and Determining the first startup configuration file according to the second virtual machine configuration information, wherein the second virtual machine configuration information matches the first virtual machine configuration information; Among them, completing the startup of the first virtual machine based on the first startup configuration file and the boot process includes: obtaining the execution result required for the first virtual machine in the startup process from the first startup configuration file; performing data call on the required execution result, and determining the steps corresponding to the boot process based on the called execution result; skipping the corresponding steps in sequence based on the required execution result, and continuing to execute other steps in the boot process until the startup of the first virtual machine is completed.
2. The method according to claim 1, wherein: The boot process includes the following steps: Creating a virtual motherboard and virtual memory according to the obtained first virtual machine configuration information; Initializing the virtual mainboard; Establishing a storage space mapping relationship between virtual hardware and virtual memory in the virtual motherboard; Determine a target operating system according to the first virtual machine configuration information, and boot the target operating system; Controlling the virtual mainboard to load the kernel of the target operating system; Start the daemon of the target operating system.
3. The method according to claim 1, wherein: The first startup configuration file also includes first virtual machine configuration information input by a user, and the first virtual machine configuration information includes virtual hardware configuration parameters of the first virtual machine; The determining of the first startup configuration file comprises: In response to the virtual machine creation instruction, receiving second virtual machine configuration information input by a user, wherein the second virtual machine configuration information includes virtual hardware configuration parameters of the second virtual machine; The first startup configuration file is determined according to the second virtual machine configuration information, wherein the virtual motherboard configuration parameters stored in the first virtual machine configuration information match the virtual motherboard configuration parameters in the second virtual machine configuration information.
4. According to the method of claim 1, the required execution result is either all the execution results stored in the first startup configuration file, or the execution result corresponding to the processing process of the virtual mainboard stored in the first startup configuration file.
5. The method according to claim 1, wherein: Multiple startup configuration files are stored in the virtual machine emulator; The determining of the first startup configuration file comprises: Responding to a virtual machine creation instruction input by a user; Determining that the second virtual machine configuration information input by the user is not received; Determine the startup duration of the first virtual machine corresponding to each startup configuration file respectively; The first startup configuration file is determined from the multiple startup configuration files based on the startup duration.
6. The method according to claim 1, wherein: The determining of the first startup configuration file comprises: Make sure that the startup configuration file is stored; Determine the file content of the startup configuration file; Determine, from the startup configuration files, a first startup configuration file including the plurality of execution results based on the file content; The method further comprises: Determining that no startup configuration file is stored, or at least determining based on the file content that the stored startup configuration file does not include the multiple execution results; The first virtual machine is guided to start up based on the boot process.
7. The method according to claim 6, wherein: The virtual machine emulator guides the first virtual machine to complete startup based on the boot process, including: Guiding the first virtual machine to complete startup based on the boot process, and simultaneously recording the execution result of each step in the boot process; After the first virtual machine is started up based on the boot process, the method further includes: Establishing the first startup configuration file; The execution result is stored in the first startup configuration file.
8. A virtual simulation device, comprising: a determination module, configured to determine a first startup configuration file, wherein the first startup configuration file includes first virtual machine configuration information input by a user, wherein the first virtual machine configuration information includes virtual hardware configuration parameters of the first virtual machine, and determining the first startup configuration file includes: responding to a virtual machine creation instruction, receiving second virtual machine configuration information input by a user, wherein the second virtual machine configuration information includes virtual hardware configuration parameters of the second virtual machine; and determining the first startup configuration file according to the second virtual machine configuration information, wherein the second virtual machine configuration information matches the first virtual machine configuration information; an execution module, which completes the startup of the first virtual machine based on the first startup configuration file and the boot process, including: obtaining the execution result required by the first virtual machine in the startup process from the first startup configuration file; performing data call on the required execution result, and determining the steps corresponding to the boot process based on the called execution result; skipping the corresponding steps in order based on the required execution result, and continuing to execute other steps in the boot process until the startup of the first virtual machine is completed; The first startup configuration file is a pre-stored file, and the first startup configuration file includes a plurality of execution results, and the plurality of execution results are correspondingly generated by the execution module during the process of executing the boot process to complete the startup of the first virtual machine.
9. The virtual simulation device according to claim 8, wherein the determining module is further used for: Make sure that the startup configuration file is stored; Determine the file content of the startup configuration file; Determine, from the startup configuration files, a first startup configuration file including the plurality of execution results based on the file content; When the determining module determines that no startup configuration file is stored, or at least determines based on the file content that the stored startup configuration file does not include the multiple execution results, the executing module is further configured to: The first virtual machine is guided to start up based on the boot process.
