Virtual machine configuration method, computing device and computer readable storage medium
By pre-injecting configuration parameters before starting the virtual machine, the method addresses the inefficiency of restart-based configurations, enabling faster and more efficient virtual machine setup.
Patent Information
- Application Number
- CN202310749495.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-06-21
- Publication Date
- 2024-12-24
AI Technical Summary
Existing virtual machine configuration methods require restarting the machine during the configuration process, which decreases efficiency due to the time taken for restarts.
Pre-inject configuration parameters before the virtual machine starts, allowing configuration to be completed without restarting, thereby improving efficiency.
The method enables efficient virtual machine configuration by completing setup tasks without requiring a restart, enhancing overall configuration speed and reducing downtime.
Smart Images

Figure CN119179545A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a virtual machine configuration method, a computing device, and a computer-readable storage medium. Background Art
[0002] When users use virtual machines, they usually need to configure the virtual machines, for example, configuring the virtual machine's identity and network, adding the virtual machine to a domain, etc., in order to manage and control the virtual machines.
[0003] In the process of configuring a virtual machine, the related technology usually sends configuration parameters to the computing device set by the virtual machine after the virtual machine is started. After the computing device completes the configuration of the virtual machine's identifier according to the configuration parameters, the virtual machine needs to be restarted and added to the domain after the restart is completed. Since the restart during the virtual machine configuration process takes a certain amount of time, there is a problem of low virtual machine configuration efficiency. Summary of the invention
[0004] The embodiments of the present application provide a virtual machine configuration method, a computing device, and a computer-readable storage medium, which can pre-inject configuration parameters of the virtual machine before the virtual machine is started, thereby eliminating the need to restart the virtual machine during the configuration process, thereby improving the configuration efficiency of the virtual machine.
[0005] In a first aspect, the present application provides a virtual machine configuration method, which is applied to a computing device, and the method includes: receiving a first instruction for a virtual machine to be configured in the computing device, the first instruction being used to instruct the configuration of the virtual machine; in response to the first instruction, obtaining configuration parameters from a configuration file of the virtual machine, the configuration parameters including a first parameter and a second parameter of the virtual machine, the first parameter being used to configure an identifier of the virtual machine, and the second parameter being used to configure a network and a domain of the virtual machine; and completing the configuration of the virtual machine according to the configuration parameters.
[0006] In a possible implementation of the first aspect, completing configuration of a virtual machine according to configuration parameters includes: starting the virtual machine and performing identification configuration of the virtual machine according to a first parameter; after the identification configuration of the virtual machine is completed, performing network configuration and domain configuration of the virtual machine according to a second parameter.
[0007] In a possible implementation of the first aspect, the first parameter includes a target identifier and a first flag bit, the first flag bit is used to indicate whether to configure the virtual machine identifier, and the virtual machine identifier is configured according to the first parameter, including: when the value of the first flag bit is a preset value, the virtual machine identifier is configured as the target identifier.
[0008] In a possible implementation of the first aspect, performing network configuration and domain configuration of the virtual machine according to the second parameter includes: configuring the network of the virtual machine according to the second parameter; and after the network configuration of the virtual machine is completed, configuring the domain of the virtual machine according to the second parameter.
[0009] In a possible implementation of the first aspect, the second parameter includes network card address information and a second flag bit, and the second flag bit is used to indicate whether to configure the network of the virtual machine; configuring the network of the virtual machine according to the second parameter includes: when the value of the second flag bit is a preset value, configuring the network of the virtual machine according to the network card address information.
[0010] In a possible implementation of the first aspect, the second parameter also carries an identifier of a target domain of the virtual machine, and configuring the domain of the virtual machine according to the second parameter includes: determining a domain control server corresponding to the target domain according to the identifier of the target domain; and sending a domain add request to the domain control server, where the domain add request is used to request the virtual machine to join the target domain to complete the domain configuration of the virtual machine.
[0011] In a possible implementation of the first aspect, the second parameter also carries a third flag bit, and the third flag bit is used to indicate whether the domain of the virtual machine is configured; sending a domain add request to the domain control server includes: when the value of the third flag bit is a preset value, sending a domain add request to the domain control server corresponding to the target domain.
[0012] In a possible implementation manner of the first aspect, before receiving the first instruction, the method further includes: receiving a second instruction, the second instruction being used to instruct to store configuration parameters of the virtual machine; and storing the configuration parameters of the virtual machine in a configuration file in response to the second instruction.
[0013] In a second aspect, a computing device is provided, including: a receiving unit, used to receive a first instruction for a virtual machine to be configured in the computing device, the first instruction being used to instruct the configuration of the virtual machine; an acquiring unit, used to obtain configuration parameters from a configuration file of the virtual machine in response to the first instruction, the configuration parameters including a first parameter and a second parameter of the virtual machine, the first parameter being used to configure an identifier of the virtual machine, and the second parameter being used to configure a network and a domain of the virtual machine; and a configuring unit, used to complete the configuration of the virtual machine according to the configuration parameters.
[0014] In a possible implementation of the second aspect, the configuration unit is specifically used to start the virtual machine and perform an identification configuration of the virtual machine according to the first parameter; after the identification configuration of the virtual machine is completed, perform network configuration and domain configuration of the virtual machine according to the second parameter.
[0015] In a possible implementation of the second aspect, the first parameter includes a target identifier and a first flag bit, the first flag bit is used to indicate whether to configure the virtual machine identifier, and the configuration unit is specifically used to configure the virtual machine identifier as the target identifier when the value of the first flag bit is a preset value.
[0016] In a possible implementation manner of the second aspect, the configuration unit is specifically configured to configure a network of the virtual machine according to the second parameter; after the network configuration of the virtual machine is completed, configure a domain of the virtual machine according to the second parameter.
[0017] In a possible implementation of the second aspect, the second parameter includes network card address information and a second flag bit, and the second flag bit is used to indicate whether to configure the network of the virtual machine; the configuration unit is specifically used to perform network configuration of the virtual machine according to the network card address information when the value of the second flag bit is a preset value.
[0018] In a possible implementation of the second aspect, the second parameter also carries an identifier of a target domain of the virtual machine, and the configuration unit is specifically used to determine a domain control server corresponding to the target domain according to the identifier of the target domain; and send a domain add request to the domain control server, where the domain add request is used to request the virtual machine to join the target domain to complete the domain configuration of the virtual machine.
[0019] In a possible implementation of the second aspect, the second parameter also carries a third flag bit, which is used to indicate whether to configure the domain of the virtual machine; the configuration unit is specifically used to send a domain add request to the domain control server corresponding to the target domain when the value of the third flag bit is a preset value.
[0020] In a possible implementation of the second aspect, the above-mentioned device also includes a storage unit, and before receiving the first instruction, the receiving unit is also used to receive a second instruction, and the second instruction is used to instruct to store the configuration parameters of the virtual machine; the storage unit is used to store the configuration parameters of the virtual machine in a configuration file in response to the second instruction.
[0021] In a third aspect, a computing device is provided, which may include: a processor and a memory for storing processor executable instructions; wherein the processor is configured to execute instructions to implement any optional virtual machine configuration method in the first aspect above.
[0022] In a fourth aspect, a computer-readable storage medium is provided, on which computer program instructions are stored. When the computer program instructions are executed by a single board, the virtual machine configuration method of any of the above embodiments is implemented.
[0023] In a fifth aspect, a computer program product is provided, the computer program product comprising computer program instructions, which implement the virtual machine configuration method of any of the above embodiments when executed by a single board.
[0024] The beneficial effect of the technical solution provided in the embodiment of the present application is: before the virtual machine is started, the configuration parameters of the virtual machine are pre-injected, and after the virtual machine is started, it can be configured based on the pre-injected configuration parameters, so that the virtual machine does not need to be restarted during the configuration process, thereby improving the configuration efficiency of the virtual machine. BRIEF DESCRIPTION OF THE DRAWINGS
[0025] In order to more clearly illustrate the technical solution in the present application, the drawings required for use in some embodiments of the present application will be briefly introduced below. Obviously, the drawings described below are only drawings of some embodiments of the present application. For ordinary technicians in this field, other drawings can also be obtained based on these drawings.
[0026] Figure 1 A system architecture diagram of a virtual machine configuration method shown in an embodiment of the present application;
[0027] Figure 2 A schematic diagram of the structure of a virtual machine shown in an embodiment of the present application;
[0028] Figure 3 A flowchart of a virtual machine configuration method shown in an embodiment of the present application;
[0029] Figure 4 A flowchart of another virtual machine configuration method shown in an embodiment of the present application;
[0030] Figure 5 A flowchart of another virtual machine configuration method shown in an embodiment of the present application;
[0031] Figure 6 A schematic diagram of a process of configuring a virtual machine shown in an embodiment of the present application;
[0032] Figure 7 A schematic diagram of another process of configuring a virtual machine shown in an embodiment of the present application;
[0033] Figure 8 A schematic diagram of another process of configuring a virtual machine shown in an embodiment of the present application;
[0034] Fig. 9 A structural block diagram of a computing device shown in an embodiment of the present application;
[0035] Fig.10 A structural block diagram of another computing device shown in an embodiment of the present application. DETAILED DESCRIPTION
[0036] The following will be combined with the drawings in this application to clearly and completely describe the technical solutions in this application. Obviously, the described embodiments are only part of the embodiments of this application, not all of them. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0037] It should be noted that, in this application, words such as "exemplary" or "for example" are used to indicate examples, illustrations or descriptions. Any embodiment or design described as "exemplary" or "for example" in this application should not be interpreted as being more preferred or more advantageous than other embodiments or designs. Specifically, the use of words such as "exemplary" or "for example" is intended to present related concepts in a specific way.
[0038] In the following, the terms "first" and "second" are used for descriptive purposes only and are not to be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of the features.
[0039] In the description of this application, unless otherwise specified, " / " means "or", for example, A / B can mean A or B. "And / or" in this article is only a description of the association relationship of associated objects, indicating that there can be three relationships. For example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone. In addition, "at least one" means one or more, and "multiple" means two or more.
[0040] When users use virtual machines, they usually need to configure the virtual machines, for example, configuring the virtual machine's identity and network, adding the virtual machine to a domain, etc., in order to manage and control the virtual machines.
[0041] In the process of configuring a virtual machine, the related technology usually sends configuration parameters to the computing device set by the virtual machine after the virtual machine is started. After the computing device completes the configuration of the virtual machine's identifier according to the configuration parameters, the virtual machine needs to be restarted and added to the domain after the restart is completed. Since the restart during the virtual machine configuration process takes a certain amount of time, there is a problem of low virtual machine configuration efficiency.
[0042] In view of this, an embodiment of the present application provides a virtual machine configuration method, which is applied to a computing device, and the method includes: in response to an instruction to configure the virtual machine, obtaining the configuration parameters of the virtual machine that are pre-injected from a configuration file, and completing the configuration of the virtual machine according to the configuration parameters. The method provided in the embodiment of the present application can pre-inject the configuration parameters of the virtual machine before the virtual machine is started, and can configure the virtual machine based on the pre-injected configuration parameters after the virtual machine is started, so that the virtual machine does not need to be restarted during the configuration process, thereby improving the configuration efficiency of the virtual machine.
[0043] See also Figure 1 , Figure 1 A system architecture diagram of a virtual machine configuration method provided in an embodiment of the present application is shown. Among them, the computing device 100 is configured with a virtual machine 110 to be configured (hereinafter referred to as virtual machine 110). The computing device 100 receives a first instruction from a cloud management platform 120. Among them, the first instruction is used to instruct the configuration of the virtual machine 110. The computing device 100 responds to the first instruction and obtains the configuration parameters of the virtual machine 110, wherein the configuration parameters are pre-injected by the computing device before receiving the first instruction. The computing device 100 completes the configuration of the virtual machine 110 based on the configuration parameters.
[0044] In one example, see Figure 2 , the computing device 100 is configured with a driver 111 and a service program 112 of the virtual machine 110. In the case where the first instruction is used to indicate the identification, network, and domain configuration of the virtual machine 110, the computing device 100 starts the virtual machine 110 after receiving the first instruction, and then the computing device 100 obtains the configuration parameters of the virtual machine 110 through the driver 111 of the virtual machine 110, and completes the identification configuration of the virtual machine 110 through the driver 111 according to the configuration parameters. After the identification configuration of the virtual machine 110 is completed, the computing device 100 performs network configuration and domain addition on the virtual machine 110 through the service program 112 of the virtual machine 110.
[0045] It should be understood that the computing device can also complete the network configuration of the virtual machine 110 through the driver 111 of the virtual machine 110. In other words, after the computing device completes the identification configuration and network configuration of the virtual machine 110 through the driver 111, the virtual machine 110 is added to the domain through the service program 112. The embodiment of the present application does not specifically limit the process of configuring the network of the virtual machine 110 by the computing device 100.
[0046] The computing device 100 may be any device that has computing processing capabilities and can be configured with a virtual machine 110. For example, the computing device 100 may be a general-purpose computer, a personal computer, a server, etc. The specific implementation method of the computing device 100 is not limited here.
[0047] The operating system of the virtual machine 110 may be a Windows operating system or a Linux operating system, or any other type of operating system. The embodiment of the present application does not impose any particular limitation on the specific implementation of the operating system of the virtual machine.
[0048] It should be understood that the computing device 100 may be configured with one or more virtual machines, and the virtual machine 110 is one of the multiple virtual machines configured with the computing device 100. The embodiment of the present application does not impose any particular limitation on the number of virtual machines configured with the computing device 100.
[0049] Figure 3 A flowchart of a virtual machine configuration method provided in an embodiment of the present application is shown in FIG. Figure 3 As shown, this method can be Figure 1 The computing device 100 shown is executed. The method may include the following steps:
[0050] S301. Receive a first instruction for a virtual machine to be configured in a computing device, where the first instruction is used to instruct configuration of the virtual machine.
[0051] Among them, the first instruction is sent by the cloud management platform that communicates with the computing device, and is used to configure one or more of the identification, network and domain of the virtual machine. It should be understood that configuring the identification of the virtual machine can be to configure the identification of the virtual machine from A to B, or to configure the identification of the virtual machine to B when the virtual machine is not configured with an identification. Configuring the network of the virtual machine can be to modify the network configured for the current virtual machine, or to configure the network for a virtual machine that is not configured with a network. Configuring the domain of the virtual machine can be understood as adding the virtual machine to the target domain to achieve control over the permissions of the virtual machine.
[0052] It should be noted that the above identification, network and domain are only exemplary, and the first instruction may also instruct the computing device to configure other parameters and items of the virtual machine. For example, whether to disable the optical drive of the virtual machine. The embodiment of the present application does not specifically limit the parameters and items that the first instruction instructs the computing device to configure the virtual machine.
[0053] S302: In response to the first instruction, obtain configuration parameters from a configuration file of the virtual machine.
[0054] Specifically, the configuration parameters include a first parameter and a second parameter of the virtual machine, the first parameter is used to configure an identifier of the virtual machine, and the second parameter is used to configure a network and a domain of the virtual machine.
[0055] The configuration parameters are pre-stored in a configuration file of the virtual machine. For example, the configuration file may be a registry corresponding to a System Management BIOS (SMBIOS) item of a basic input output system (BIOS) of the virtual machine. In other words, the configuration parameters are pre-stored in a registry corresponding to an SMBIOS item of the virtual machine. In one example, the computing device starts the virtual machine in response to the first instruction, and then obtains the configuration parameters of the virtual machine from the registry corresponding to the SMBIOS item of the configuration file of the virtual machine through a driver of the virtual machine.
[0056] In one example, when the operating system of the virtual machine is a Windows operating system, the computing device responds to the first instruction, starts the virtual machine, and reads configuration parameters from the registry HKEY_LOCAL_MACHINE\HARDWARE\DESCRIPTION\System\BIOS or HKEY_LOCAL_MACHINE\SYSTEM\HardwareConfig\Current through the driver of the virtual machine.
[0057] In another example, when the operating system of the virtual machine is a Linux operating system, the computing device responds to the first instruction and starts the virtual machine to read the service program of the virtual machine.
[0058] Configuration parameters in the configuration files in the / sys / devices / virtual / dmi directory.
[0059] It should be understood that the configuration parameters of the virtual machine may also be stored in other locations in the configuration file of the virtual machine, and the embodiment of the present application does not impose any particular limitation on the specific location of the pre-injected configuration parameters of the virtual machine.
[0060] In some embodiments, before receiving the first instruction, the method further includes: receiving a second instruction, the second instruction being used to instruct to store configuration parameters of the virtual machine; and storing the configuration parameters of the virtual machine in a configuration file in response to the second instruction.
[0061] Specifically, the second instruction is sent by the cloud management center to the computing device, and the computing device responds to the second instruction by modifying the registry under the smbios item of the virtual machine to store the configuration parameters in the configuration file of the virtual machine.
[0062] From the above, it can be seen that the method provided in the embodiment of the present application pre-injects the configuration parameters of the virtual machine through the second instruction, and can obtain the pre-injected configuration parameters when the computing device receives the first instruction to configure the virtual machine, thereby completing the configuration of the virtual machine, and can avoid restarting the virtual machine during the configuration process, thereby improving the configuration efficiency of the virtual machine.
[0063] S303: Complete the configuration of the virtual machine according to the configuration parameters.
[0064] Specifically, the identification configuration, network configuration and domain configuration of the virtual machine are completed according to the first parameter and the second parameter in the configuration parameters.
[0065] In some embodiments, see Figure 4 The above S303 specifically includes the following steps:
[0066] S3031. Start the virtual machine, and configure the identification of the virtual machine according to the first parameter.
[0067] Specifically, the first parameter carries a target identifier, and the computing device configures the identifier of the virtual machine as the target identifier according to the target identifier carried in the first parameter, thereby completing the identifier configuration of the virtual machine.
[0068] Exemplarily, the target identifier carried in the first parameter is A, and the computing device configures the identifier of the virtual machine to A, ie, completes the identifier configuration of the virtual machine.
[0069] In a possible implementation, the first parameter also includes a first flag bit, which is used to indicate whether to configure the virtual machine's identifier. The virtual machine's identifier is configured according to the first parameter, including: when the value of the first flag bit is a preset value, the virtual machine's identifier is configured as a target identifier.
[0070] Optionally, the value of the first flag bit may be a first value and a second value, wherein the first value is a preset value for instructing the computing device to configure the identifier of the virtual machine, and the second value is for instructing the computing device not to configure the identifier of the virtual machine.
[0071] Exemplarily, the first value is 1 and the second value is 2. When the computing device determines that the value of the first flag is 1, since 1 is a preset value, the computing device configures the identifier of the virtual machine as the target identifier carried in the first parameter. When the computing device determines that the value of the first flag is 2, since 2 is not a preset value, the computing device does not configure the identifier of the virtual machine.
[0072] S3032: After the identification configuration of the virtual machine is completed, perform network configuration and domain configuration of the virtual machine according to the second parameter.
[0073] Specifically, the second parameter carries network card address information and a target domain identifier. The computing device configures the network of the virtual machine according to the network card address information carried in the second parameter. After the network configuration of the virtual machine is completed, the domain of the virtual machine is configured according to the target domain identifier carried in the second parameter.
[0074] In some embodiments, see Figure 5 The above S3032 specifically includes the following steps: performing network configuration and domain configuration of the virtual machine according to the second parameter, including:
[0075] S30321. Configure the network of the virtual machine according to the second parameter.
[0076] In a possible implementation, the first parameter also includes a second flag bit, and the second flag bit is used to indicate whether the network of the virtual machine is configured; the above S30321 specifically includes the following steps: when the value of the second flag bit is a preset value, the network configuration of the virtual machine is performed according to the network card address information.
[0077] Optionally, the value of the second flag bit may be a first value and a second value, wherein the first value is a preset value for instructing the computing device to configure the network of the virtual machine, and the second value is for instructing the computing device not to configure the network of the virtual machine.
[0078] Exemplarily, the first value is 1 and the second value is 2. When the computing device determines that the value of the second flag is 1, since 1 is a preset value, the computing device configures the network of the virtual machine. When the computing device determines that the value of the second flag is 2, since 2 is not a preset value, the computing device does not configure the network of the virtual machine.
[0079] S30322. After the network configuration of the virtual machine is completed, configure the domain of the virtual machine according to the second parameter.
[0080] In a possible implementation, the above S30322 specifically includes the following steps: determining a domain control server corresponding to the target domain according to an identifier of the target domain; sending a domain adding request to the domain control server, where the domain adding request is used to request the virtual machine to join the target domain to complete the domain configuration of the virtual machine.
[0081] Optionally, the second parameter also carries a third flag bit, and the third flag bit is used to indicate whether the domain of the virtual machine is configured; sending a domain add request to the domain control server includes: when the value of the third flag bit is a preset value, sending a domain add request to the domain control server corresponding to the target domain.
[0082] Optionally, the value of the third flag bit may be a first value and a second value, wherein the first value is a preset value for instructing the computing device to configure the domain of the virtual machine, and the second value is for instructing the computing device not to configure the domain of the virtual machine.
[0083] Exemplarily, the first value is 1 and the second value is 2. When the computing device determines that the value of the third flag is 1, since 1 is a preset value, the computing device configures the domain of the virtual machine, that is, sends a domain add request to the domain control server. When the computing device determines that the value of the third flag is 2, since 2 is not a preset value, the computing device does not configure the domain of the virtual machine.
[0084] For easier understanding of this solution, see Figure 6 , Figure 6 Schematic diagram of the process of configuring a virtual machine for a computing device. The specific steps include:
[0085] S601: The computing device starts a virtual machine in response to a first instruction.
[0086] S602: The computing device obtains pre-injected configuration parameters from the configuration file.
[0087] S603: The computing device determines whether to configure the identifier of the virtual machine according to the first flag bit.
[0088] S604: When the first flag bit is a preset value, the computing device configures an identifier of the virtual machine.
[0089] S605: The computing device determines whether to configure the network of the virtual machine according to the second flag bit.
[0090] S606: When the second flag bit is a preset value, the computing device configures a network for the virtual machine.
[0091] S607: Determine whether to configure the domain of the virtual machine according to the third flag bit.
[0092] S608: When the third flag bit is a preset value, the computing device configures the domain of the virtual machine.
[0093] It should be understood that the first flag bit, the second flag bit, and the third flag bit may be the same flag bit or completely different flag bits. For example, when the first flag bit is a preset value, the computing device configures the identification, network, and domain of the virtual machine. The embodiment of the present application does not impose any particular restrictions on the specific implementation of the flag bit.
[0094] It can be seen from the above S301-S303 that the method provided in the embodiment of the present application can pre-inject the configuration parameters of the virtual machine before the virtual machine is started, and can configure the virtual machine based on the pre-injected configuration parameters after the virtual machine is started, so that the virtual machine does not need to be restarted during the configuration process, thereby improving the configuration efficiency of the virtual machine.
[0095] For easier understanding of this solution, see Figure 7 and Figure 8 , the configuration process of the virtual machine is described when the operating system of the virtual machine is a Windows operating system or a Linux operating system.
[0096] See also Figure 7 When the operating system of the virtual machine is a Windows operating system, the configuration process of the virtual machine specifically includes the following steps:
[0097] S701. The cloud management platform sends a second instruction to the computing device. The second instruction carries configuration parameters of the virtual machine input by the user on the cloud management platform.
[0098] S702: The computing device stores the configuration parameters in a configuration file of the virtual machine in response to the second instruction.
[0099] S703: When receiving a first instruction instructing to configure the virtual machine, the computing device starts the virtual machine.
[0100] S704: The computing device obtains configuration parameters from the configuration file through the driver of the virtual machine.
[0101] S705: The computing device completes the identification configuration and network configuration of the virtual machine based on the configuration parameters.
[0102] S706: After the identification configuration and the network configuration are completed, the computing device starts the service program and completes the domain configuration of the virtual machine through the service program of the virtual machine.
[0103] See also Figure 8 When the operating system of the virtual machine is a Linux operating system, the configuration process of the virtual machine specifically includes the following steps:
[0104] S801. The cloud management platform sends a second instruction to the computing device. The second instruction carries configuration parameters of the virtual machine input by the user on the cloud management platform.
[0105] S802: The computing device stores the configuration parameters in a configuration file of the virtual machine in response to the second instruction.
[0106] S803: When receiving a first instruction instructing to configure the virtual machine, the computing device starts the virtual machine.
[0107] S804: The computing device obtains configuration parameters from the configuration file through the service program of the virtual machine.
[0108] S805: The computing device sequentially completes the identification configuration, network configuration and domain configuration of the virtual machine based on the configuration parameters through the service program of the virtual machine.
[0109] The above mainly introduces the scheme of the embodiment of the present application from the perspective of the method. It is understandable that, in order to realize the above functions, the above computing device includes at least one of the hardware structure and software modules corresponding to the execution of each function. It should be easily appreciated by those skilled in the art that, in combination with the units and algorithm steps of each example described in the embodiments disclosed herein, the embodiments of the present application can be implemented in the form of hardware or a combination of hardware and computer software. Whether a function is executed in the form of hardware or computer software driving hardware depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to exceed the scope of the embodiments of the present application.
[0110] The embodiment of the present application can divide the computing device into functional units according to the above method example. For example, each functional unit can be divided according to each function, or two or more functions can be integrated into one unit. The above integrated unit can be implemented in the form of hardware or in the form of software functional units. It should be noted that the division of units in the embodiment of the present application is schematic and is only a logical function division. There may be other division methods in actual implementation.
[0111] Fig. 9 Schematic diagram of a computing device provided in an embodiment of the present application. The computing device can execute the virtual machine configuration method provided in the above method embodiment. Fig. 9 As shown, the computing device includes a receiving unit 901, an acquiring unit 902, and a configuring unit 903. The receiving unit 901 is used to receive a first instruction for a virtual machine to be configured in the computing device, the first instruction being used to instruct to configure the virtual machine; the acquiring unit 902 is used to obtain configuration parameters from a configuration file of the virtual machine in response to the first instruction, the configuration parameters including a first parameter and a second parameter of the virtual machine, the first parameter being used to configure an identifier of the virtual machine, and the second parameter being used to configure a network and a domain of the virtual machine; the configuring unit 903 is used to complete the configuration of the virtual machine according to the configuration parameters.
[0112] Optionally, the configuration unit 903 is specifically used to start the virtual machine and perform identification configuration of the virtual machine according to the first parameter; after the identification configuration of the virtual machine is completed, perform network configuration and domain configuration of the virtual machine according to the second parameter.
[0113] Optionally, the first parameter includes a target identifier and a first flag bit, the first flag bit is used to indicate whether to configure the virtual machine identifier, and the configuration unit 903 is specifically used to configure the virtual machine identifier as the target identifier when the value of the first flag bit is a preset value.
[0114] Optionally, the configuration unit 903 is specifically configured to configure the network of the virtual machine according to the second parameter; after the network configuration of the virtual machine is completed, configure the domain of the virtual machine according to the second parameter.
[0115] Optionally, the second parameter includes network card address information and a second flag bit, and the second flag bit is used to indicate whether to configure the network of the virtual machine; the configuration unit 903 is specifically used to perform network configuration of the virtual machine according to the network card address information when the value of the second flag bit is a preset value.
[0116] Optionally, the second parameter also carries an identifier of the target domain of the virtual machine. The configuration unit 903 is specifically used to determine the domain control server corresponding to the target domain according to the identifier of the target domain; send a domain add request to the domain control server, and the domain add request is used to request the virtual machine to join the target domain to complete the domain configuration of the virtual machine.
[0117] Optionally, the second parameter also carries a third flag, which is used to indicate whether to configure the domain of the virtual machine; the configuration unit 903 is specifically used to send a domain add request to the domain control server corresponding to the target domain when the value of the third flag is a preset value.
[0118] Optionally, the above-mentioned device also includes a storage unit 904. Before receiving the first instruction, the receiving unit 901 is also used to receive a second instruction, and the second instruction is used to instruct to store the configuration parameters of the virtual machine; the storage unit 904 is used to store the configuration parameters of the virtual machine in a configuration file in response to the second instruction.
[0119] In the case of implementing the functions of the above-mentioned integrated modules in the form of hardware, the embodiment of the present application provides a possible structure of the computing device involved in the above-mentioned embodiment. Fig.10 As shown, the computing device 100 includes: a processor 402 and a bus 404. Optionally, the computing device 100 may also include a memory 401. Optionally, the computing device 100 may also include a communication interface 403.
[0120] Processor 402 may be a processor that implements or executes various exemplary logic blocks, modules, and circuits described in conjunction with the embodiments of the present application. The processor 402 may be a central processing unit, a general-purpose processor, a digital signal processor, an application-specific integrated circuit, a field programmable gate array, or other programmable logic devices, transistor logic devices, hardware components, or any combination thereof. It may implement or execute various exemplary logic blocks, modules, and circuits described in conjunction with the embodiments of the present application. The processor 402 may also be a combination that implements computing functions, such as a combination of one or more microprocessors, a combination of a DSP and a microprocessor, and the like.
[0121] The memory 401 may be a read-only memory (ROM) or other types of static storage devices that can store static information and instructions, a random access memory (RAM) or other types of dynamic storage devices that can store information and instructions, or an electrically erasable programmable read-only memory (EEPROM), a disk storage medium or other magnetic storage device, or any other medium that can be used to carry or store desired program codes in the form of instructions or data structures and can be accessed by a computer, but is not limited thereto.
[0122] As a possible implementation, the memory 401 may exist independently of the processor 402, and the memory 401 may be connected to the processor 402 via a bus 404 to store instructions or program codes. When the processor 402 calls and executes the instructions or program codes stored in the memory 401, the test method corresponding to the computing device provided in the embodiment of the present application can be implemented.
[0123] In another possible implementation, the memory 401 may also be integrated with the processor 402 .
[0124] The bus 404 may be an extended industry standard architecture (EISA) bus, etc. The bus 404 may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Fig.10 Only one thick line is used in the diagram, but this does not mean that there is only one bus or only one type of bus.
[0125] Some embodiments of the present application provide a computer-readable storage medium (e.g., a non-transitory computer-readable storage medium), which stores computer program instructions. When the computer program instructions are executed on a computer, the computer executes a virtual machine configuration method such as any of the above embodiments.
[0126] Exemplarily, the above-mentioned computer-readable storage media may include, but are not limited to: magnetic storage devices (e.g., hard disks, floppy disks or magnetic tapes, etc.), optical disks (e.g., compact disks (CD), digital versatile disks (DVD), etc.), smart cards and flash memory devices (e.g., erasable programmable read-only memory (EPROM), cards, sticks or key drives, etc.). The various computer-readable storage media described in this application may represent one or more devices and / or other machine-readable storage media for storing information. The term "machine-readable storage medium" may include, but is not limited to, wireless channels and various other media capable of storing, containing and / or carrying instructions and / or data.
[0127] An embodiment of the present application provides a computer program product including instructions. When the computer program product is run on a computer, the computer is enabled to execute the virtual machine configuration method described in any of the above embodiments.
[0128] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any changes or substitutions within the technical scope disclosed in the present application should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.
Claims
1. A virtual machine configuration method, characterized in that: Applied to a computing device, the method comprises: Receiving a first instruction for a virtual machine to be configured in the computing device, wherein the first instruction is used to instruct to configure the virtual machine; In response to the first instruction, obtaining configuration parameters from a configuration file of the virtual machine, the configuration parameters including a first parameter and a second parameter of the virtual machine, the first parameter being used to configure an identifier of the virtual machine, and the second parameter being used to configure a network and a domain of the virtual machine; The configuration of the virtual machine is completed according to the configuration parameters.
2. The method according to claim 1, characterized in that The completing the configuration of the virtual machine according to the configuration parameters includes: Starting the virtual machine, and performing identification configuration of the virtual machine according to the first parameter; After the identification configuration of the virtual machine is completed, the network configuration and the domain configuration of the virtual machine are performed according to the second parameter.
3. The method according to claim 2, characterized in that The first parameter includes a target identifier and a first flag bit, the first flag bit is used to indicate whether to configure the identifier of the virtual machine, and the configuring the identifier of the virtual machine according to the first parameter includes: When the value of the first flag bit is a preset value, the identifier of the virtual machine is configured as the target identifier.
4. The method according to claim 3, characterized in that The performing network configuration and domain configuration of the virtual machine according to the second parameter includes: Configuring a network of the virtual machine according to the second parameter; After the network configuration of the virtual machine is completed, the domain of the virtual machine is configured according to the second parameter.
5. The method according to claim 4, characterized in that The second parameter includes network card address information and a second flag bit, and the second flag bit is used to indicate whether to configure the network of the virtual machine; Configuring the network of the virtual machine according to the second parameter includes: When the value of the second flag bit is a preset value, the network configuration of the virtual machine is performed according to the network card address information.
6. The method according to claim 5, characterized in that The second parameter also carries an identifier of a target domain of the virtual machine, and configuring the domain of the virtual machine according to the second parameter includes: Determining a domain control server corresponding to the target domain according to the identifier of the target domain; A domain adding request is sent to the domain control server, where the domain adding request is used to request the virtual machine to join the target domain to complete the domain configuration of the virtual machine.
7. The method according to claim 6, characterized in that The second parameter also carries a third flag bit, and the third flag bit is used to indicate whether to configure the domain of the virtual machine; The sending a domain adding request to the domain control server includes: When the value of the third flag bit is a preset value, the domain adding request is sent to a domain control server corresponding to the target domain.
8. The method according to claim 7, characterized in that Before receiving the first instruction, the method further includes: receiving a second instruction, where the second instruction is used to instruct to store configuration parameters of the virtual machine; In response to the second instruction, the configuration parameters of the virtual machine are stored in the configuration file.
9. A computing device, characterized in that The computing device includes A receiving unit, configured to receive a first instruction for a virtual machine to be configured in the server, wherein the first instruction is used to instruct to configure the virtual machine; an acquiring unit, configured to acquire configuration parameters from a configuration file of the virtual machine in response to a first instruction, the configuration parameters comprising a first parameter and a second parameter of the virtual machine, the first parameter being used to configure an identifier of the virtual machine, and the second parameter being used to configure a network and a domain of the virtual machine; A configuration unit is used to complete the configuration of the virtual machine according to the configuration parameters.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores instructions, and when the instructions are executed on a computing device, the computing device can execute the method according to any one of claims 1 to 8.
