CN114301771B - Virtual machine configuration method and device and electronic equipment - Google Patents

Virtual machine configuration method and device and electronic equipment Download PDF

Info

Publication number
CN114301771B
CN114301771B CN202111595571.0A CN202111595571A CN114301771B CN 114301771 B CN114301771 B CN 114301771B CN 202111595571 A CN202111595571 A CN 202111595571A CN 114301771 B CN114301771 B CN 114301771B
Authority
CN
China
Prior art keywords
virtual machine
target virtual
configuration
configuration instruction
instruction
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202111595571.0A
Other languages
Chinese (zh)
Other versions
CN114301771A (en
Inventor
唐一帆
胡从兴
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Agricultural Bank of China
Original Assignee
Agricultural Bank of China
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Agricultural Bank of China filed Critical Agricultural Bank of China
Priority to CN202111595571.0A priority Critical patent/CN114301771B/en
Publication of CN114301771A publication Critical patent/CN114301771A/en
Application granted granted Critical
Publication of CN114301771B publication Critical patent/CN114301771B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Landscapes

  • Stored Programmes (AREA)

Abstract

The application provides a virtual machine configuration method, a virtual machine configuration device and electronic equipment, wherein the trigger instruction is used for indicating a target virtual machine and sending a first configuration instruction to the target virtual machine, and the first configuration instruction is used for configuring domain information of the virtual machine; receiving response information sent by the target virtual machine, wherein the response information is used for representing domain information configuration results of the target virtual machine; and according to the response information, if the domain information of the target virtual machine is configured successfully, sending a second configuration instruction to the target virtual machine, wherein the second configuration instruction is used for activating an operating system of the target virtual machine. Because the first configuration step is sent to the target virtual machine, and the second configuration instruction is sent to the target virtual machine after the domain information is successfully configured based on the execution result of the first configuration step, the target virtual machine can be ensured to be successfully activated, and the configuration efficiency and the success rate of the target virtual machine are improved.

Description

Virtual machine configuration method and device and electronic equipment
Technical Field
The present disclosure relates to the field of computer technologies, and in particular, to a virtual machine configuration method and apparatus, and an electronic device.
Background
Currently, a data center is used as a compact production operation place, hundreds of virtual machines are required to be deployed as servers or terminals, and various application software is installed for each virtual machine in an initialized state to serve as daily generation operation work. In this process, a plurality of virtual machine configuration steps, such as configuring a network, activating an operating system, etc., need to be completed first, and then corresponding application software is installed for each department and service.
In the prior art, in the process of configuring the virtual machines, because of the sequential dependency relationship among the steps, the steps are usually manually and sequentially configured to ensure the correct configuration of each virtual machine. However, the inventor finds that with the increase of the deployment scale of the virtual machine, the scheme in the prior art has the problems of low configuration efficiency, long time consumption, high error rate and the like.
Disclosure of Invention
The application provides a virtual machine configuration method, a virtual machine configuration device and electronic equipment, which are used for solving the problems of low virtual machine configuration efficiency, long time consumption and high error rate in the prior art.
In a first aspect, the present application provides a virtual machine configuration method, applied to a configuration server, where the method includes:
Responding to a trigger instruction, wherein the trigger instruction is used for indicating a target virtual machine and sending a first configuration instruction to the target virtual machine, and the first configuration instruction is used for configuring domain information of the virtual machine; receiving response information sent by the target virtual machine, wherein the response information is used for representing domain information configuration results of the target virtual machine; and according to the response information, if the domain information of the target virtual machine is configured successfully, a second configuration instruction is sent to the target virtual machine, wherein the second configuration instruction is used for activating an operating system of the target virtual machine.
In one possible implementation, the first configuration instruction includes a network configuration instruction and a domain configuration instruction, where the network configuration instruction is used to configure a network address of the target virtual machine; the domain configuration instruction is used for configuring the target virtual machine as a target domain user, wherein the target domain user is a domain user with authentication authority; the network configuration instruction and the domain configuration instruction are sequentially executed by the target virtual machine to configure domain information of the target virtual machine.
In one possible implementation manner, the network address of the target virtual machine includes an IP address and a DNS address, and the network configuration instruction is configured to obtain a current active network card of the target virtual machine after being executed by the pre-configured virtual machine, and determine, based on the active network card, a corresponding IP address and DNS address.
In one possible implementation manner, the second configuration instruction is configured to control the target virtual machine to send activation request information to an activation server, and activate an operating system of the target virtual machine based on activation response information returned by the activation server, where the activation request information includes identity information corresponding to the target virtual machine, and the identity information is used to verify authentication rights of the target virtual machine.
In one possible implementation, after sending the second configuration instruction to the target virtual machine, the method further includes: and sending a third configuration instruction to the target virtual machine, wherein the third configuration instruction is used for updating an operating system of the target virtual machine.
In one possible implementation manner, the third configuration instruction is used for controlling the operating system to acquire the number of patches to be installed, and based on the number of patches to be installed, downloading and installing the patches to be installed or restarting.
In one possible implementation, before responding to the trigger instruction, the method further includes: acquiring connection state information of an initialization virtual machine, wherein the initialization virtual machine is a virtual machine in an unconfigured state provided by a virtual machine platform, and the connection state information is used for representing the network connection state of the initialization virtual machine and the configuration server; and receiving a trigger instruction aiming at the initialized virtual machine according to the connection state information of the initialized virtual machine.
In one possible implementation, the method further includes: and sending a fourth configuration instruction to the target virtual machine, wherein the fourth configuration instruction is used for initializing a non-system disk of the target virtual machine.
In a second aspect, the present application provides a virtual machine configuration apparatus, applied to a configuration server, the apparatus including:
the first configuration module is used for responding to a trigger instruction, the trigger instruction is used for indicating a target virtual machine and sending a first configuration instruction to the target virtual machine, wherein the first configuration instruction is used for configuring domain information of the virtual machine;
the receiving module is used for receiving response information sent by the target virtual machine, wherein the response information is used for representing domain information configuration results of the target virtual machine;
and the second configuration module is used for sending a second configuration instruction to the target virtual machine according to the response information if the domain information of the target virtual machine is configured successfully, wherein the second configuration instruction is used for activating an operating system of the target virtual machine.
In one possible implementation, the first configuration instruction includes a network configuration instruction and a domain configuration instruction, where the network configuration instruction is used to configure a network address of the target virtual machine; the domain configuration instruction is used for configuring the target virtual machine as a target domain user, wherein the target domain user is a domain user with authentication authority; the network configuration instruction and the domain configuration instruction are sequentially executed by the target virtual machine to configure domain information of the target virtual machine.
In one possible implementation manner, the network address of the target virtual machine includes an IP address and a DNS address, and the network configuration instruction is configured to obtain a current active network card of the target virtual machine after being executed by the pre-configured virtual machine, and determine, based on the active network card, a corresponding IP address and DNS address.
In one possible implementation manner, the second configuration instruction is configured to control the target virtual machine to send activation request information to an activation server, and activate an operating system of the target virtual machine based on activation response information returned by the activation server, where the activation request information includes identity information corresponding to the target virtual machine, and the identity information is used to verify authentication rights of the target virtual machine.
In one possible implementation manner, after sending the second configuration instruction to the target virtual machine, the apparatus further includes: and the third configuration module is used for sending a third configuration instruction to the target virtual machine, and the third configuration instruction is used for updating the operating system of the target virtual machine.
In one possible implementation manner, the third configuration instruction is used for controlling the operating system to acquire the number of patches to be installed, and based on the number of patches to be installed, downloading and installing the patches to be installed or restarting.
In one possible implementation, the apparatus further includes: the state detection module is used for acquiring connection state information of an initialized virtual machine before responding to the trigger instruction, wherein the initialized virtual machine is a virtual machine in an unconfigured state provided by a virtual machine platform, and the connection state information is used for representing the network connection state of the initialized virtual machine and the configuration server; and receiving a trigger instruction aiming at the initialized virtual machine according to the connection state information of the initialized virtual machine.
In one possible implementation, the apparatus further includes: and the fourth configuration module is used for sending a fourth configuration instruction to the target virtual machine, wherein the fourth configuration instruction is used for initializing a non-system disk of the target virtual machine.
In a third aspect, the present application provides an electronic device, including: a processor, and a memory communicatively coupled to the processor;
the memory stores computer-executable instructions;
the processor executes the computer-executable instructions stored in the memory to implement the virtual machine configuration method according to any one of the first aspect of the embodiments of the present application.
In a fourth aspect, the present application provides a computer-readable storage medium having stored therein computer-executable instructions, which when executed by a processor, are configured to implement a virtual machine configuration method according to any one of the first aspects of the embodiments of the present application.
According to a fifth aspect of embodiments of the present application, there is provided a computer program product comprising a computer program which, when executed by a processor, implements the virtual machine configuration method of any one of the first aspects above.
According to the virtual machine configuration method, the virtual machine configuration device and the electronic equipment, the trigger instruction is used for indicating the target virtual machine and sending a first configuration instruction to the target virtual machine, wherein the first configuration instruction is used for configuring domain information of the virtual machine; receiving response information sent by the target virtual machine, wherein the response information is used for representing domain information configuration results of the target virtual machine; and according to the response information, if the domain information of the target virtual machine is configured successfully, a second configuration instruction is sent to the target virtual machine, wherein the second configuration instruction is used for activating an operating system of the target virtual machine. Because the first configuration step is sent to the target virtual machine, and the second configuration instruction is sent to the target virtual machine after the domain information is successfully configured based on the execution result of the first configuration step, the target virtual machine can be ensured to be successfully activated, and the configuration efficiency and the success rate of the target virtual machine are improved.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the application and together with the description, serve to explain the principles of the application.
Fig. 1 is an application scenario diagram of a virtual machine configuration method provided in an embodiment of the present application;
FIG. 2 is a flowchart of a method for configuring a virtual machine according to one embodiment of the present application;
FIG. 3 is a schematic diagram of a process for activating an operating system of the target virtual machine according to an embodiment of the present disclosure;
FIG. 4 is a flowchart of a method for configuring a virtual machine according to another embodiment of the present application;
FIG. 5 is a schematic diagram of a process of updating an operating system by a target virtual machine according to rule information;
FIG. 6 is a schematic structural diagram of a virtual machine configuration apparatus according to an embodiment of the present application;
fig. 7 is a schematic structural diagram of a virtual machine configuration apparatus according to another embodiment of the present application;
FIG. 8 is a schematic diagram of an electronic device according to one embodiment of the present application;
fig. 9 is a block diagram of a terminal device according to an exemplary embodiment of the present application.
Specific embodiments thereof have been shown by way of example in the drawings and will herein be described in more detail. These drawings and the written description are not intended to limit the scope of the inventive concepts in any way, but to illustrate the concepts of the present application to those skilled in the art by reference to specific embodiments.
Detailed Description
Reference will now be made in detail to exemplary embodiments, examples of which are illustrated in the accompanying drawings. When the following description refers to the accompanying drawings, the same numbers in different drawings refer to the same or similar elements, unless otherwise indicated. The implementations described in the following exemplary examples are not representative of all implementations consistent with the present application. Rather, they are merely examples of apparatus and methods consistent with some aspects of the present application as detailed in the accompanying claims.
The application scenario of the embodiment of the present application is explained below:
fig. 1 is an application scenario diagram of a virtual machine configuration method provided by an embodiment of the present application, where the virtual machine configuration method provided by the embodiment of the present application may be applied to an application scenario of virtual machine initialization configuration of a data center, and by way of example, an execution main body of the method provided by the embodiment of the present application may be a configuration server, where the configuration server is in communication connection with a virtual machine platform, where the virtual machine platform is a platform for providing virtual machine resources for the data center, the virtual machine platform is deployed with a corresponding platform system, and the configuration server may implement deployment, setting, and other tasks of a virtual machine by accessing the platform system. Specifically, as shown in fig. 1, the configuration server sends a plurality of configuration instructions to the virtual machine of the data center by running the program script corresponding to the method provided by the present embodiment, and the virtual machine executes the configuration action based on the configuration instructions, thereby completing configuration tasks such as system configuration, application installation, and the like.
Currently, in the process of configuring a virtual machine, one of the key configuration steps is to activate an operating system, taking a windows operating system as an example, in order to ensure that the virtual machine can normally install and run various application software, the used windows operating system must be ensured to be in an activated state. However, before the operating system is activated, the identity information of the virtual machine needs to be correctly configured, so that the successful activation of the operating system can be ensured, and due to the fact that the precedence dependence exists among the steps, the precedence dependence among the configuration steps cannot be processed in the scheme in the prior art, that is, the fact that the identity information of the virtual machine is correctly set before the operating system is activated cannot be ensured, so that the operating system cannot be ensured to be successfully activated. Therefore, the current process mainly sends configuration instructions through manual operation to ensure the correct configuration of each step. However, the inventor finds that with the increase of the deployment scale of the virtual machine, the scheme in the prior art has the problems of low configuration efficiency, long time consumption, high error rate and the like. Therefore, a virtual machine configuration method is needed at present, which can process the dependency relationship between the configuration steps, automatically complete the setting and verification of the identity information of the virtual machine and the activation of the operating system, thereby improving the configuration efficiency and the configuration accuracy in the application scene of large-scale virtual machine configuration.
The following describes the technical solutions of the present application and how the technical solutions of the present application solve the above technical problems in detail with specific embodiments. The following embodiments may be combined with each other, and the same or similar concepts or processes may not be described in detail in some embodiments. Embodiments of the present application will be described below with reference to the accompanying drawings.
Fig. 2 is a flowchart of a virtual machine configuration method according to an embodiment of the present application, and as shown in fig. 2, the virtual machine configuration method according to the embodiment includes the following steps:
step S101, responding to a trigger instruction, wherein the trigger instruction is used for indicating a target virtual machine and sending a first configuration instruction to the target virtual machine, and the first configuration instruction is used for configuring domain information of the virtual machine.
The virtual machine configuration method provided in this embodiment may be applied to a configuration server, but this is not limited to this, and other terminal devices having computing and communication functions may also apply the method provided in this embodiment, and in this embodiment, the configuration server is described as an example. Specifically, the configuration server receives the trigger instruction and responds to the trigger instruction to realize the configuration process of the target virtual machine. In one possible implementation manner, the configuration server may communicate with other terminal devices and receive the trigger instruction sent by the terminal devices, and in another possible implementation manner, the configuration server receives the operation instruction of the user through the man-machine interaction device, so as to generate the trigger instruction. The trigger instruction may be implemented based on an operating system or interactive software of the configuration server, and the trigger instruction includes information for indicating the target virtual machine, for example, a machine identifier corresponding to the target virtual machine, etc. More specifically, the triggering instruction may be implemented based on a selection operation of a user, that is, the triggering instruction is used to select an unconfigured virtual machine through a man-machine interaction device (such as a mouse and a keyboard), so as to configure the unconfigured virtual machine, so that the unconfigured virtual machine at least completes a configuration target of the activation of an operating system. The operating system deployed by the virtual machine in this embodiment is illustratively a windows operating system.
Further, the configuration server communicates with the template virtual machine indicated by the trigger instruction through the virtual machine platform, and sends a first configuration instruction to the target virtual machine, and after the target virtual machine receives and executes the first configuration instruction, domain information configuration of the target virtual machine is completed. Illustratively, the first configuration instruction includes a network configuration instruction and a domain configuration instruction, where the network configuration instruction is used to configure a network address of the target virtual machine, and specifically, the network configuration instruction includes parameter information for configuring the network address, including an IP address, for example 10.237.234.120; subnet masks, such as 255.255.255.128; default gateway, e.g. 10.237.234.126.
Further, the network configuration instruction further includes parameter information for configuring DNS (domain name resolution server) addresses, specifically, preferred DNS server addresses, for example 10.237.234.225; and a backup DNS server address, such as 10.237.234.226. After the network configuration instruction is executed, the configuration of the network address (including the IP address, the DNS server address, etc.) of the target virtual machine can be completed.
Among them, there is a certain constraint relation among IP address, subnet mask, default gateway and DNS server address, for example, IP address, default gateway and DNS server are in the same network segment (10.237.234. X), it can be ensured that IP address configuration is correct, thus realizing specific network access authority. The information of the constraint relation is contained in the network configuration instruction, and after the target virtual machine executes the network configuration instruction, the parameter information for configuring the network address is generated based on the network card information of the target virtual machine and the constraint relation carried in the network configuration instruction, so that the accuracy of network address configuration is ensured.
The domain configuration instruction is used for configuring the target virtual machine as a target domain user, wherein the target domain user is a domain user with authentication authority. Specifically, a domain is a form of computer network under windows operating system in which all user accounts, computers, printers and other security principals are registered in a central database located on one or more central computer clusters known as domain controllers. Authentication takes place on the domain controller. A user using a computer in a domain corresponds to a unique account, which can then be assigned access rights to the resources in the domain. The target virtual machine sends a joining request to the domain controller by responding to the domain configuration instruction, and becomes a target domain user, namely a domain user with authentication authority after the authentication of the domain controller is obtained. The authentication authority is, for example, a network authority with a corresponding level and an area, so that the target virtual machine with the authentication authority can complete the subsequent step of activating an operating system (windows operating system in the embodiment) and realize other service functions.
The domain configuration instruction may specifically include configuration parameters for configuring domain information, for example, including a domain name, a domain user name, a corresponding password, and the like. By executing the domain configuration instruction, the target virtual machine can achieve the purpose of configuring domain information of the virtual machine. However, to complete authentication and obtain rights through the domain controller, access to the domain controller is first required. This step needs to ensure that the network address of the target virtual machine is configured correctly. Thus, the network configuration instructions and domain configuration instructions are illustratively executed sequentially by the target virtual machine to configure domain information of the target virtual machine.
Step S102, receiving response information sent by the target virtual machine, wherein the response information is used for representing domain information configuration results of the target virtual machine.
For example, after the first configuration instruction is sent to the target virtual machine, the target virtual machine responds to the first configuration instruction to perform configuration of the domain information, but problems such as configuration failure, for example, an IP address conflict, may occur, resulting in configuration failure. Therefore, after the target virtual machine executes the first configuration instruction, response information is returned to the configuration server, wherein the response information is used for representing domain information configuration results of the target virtual machine, so that the configuration server determines the current configuration state of the target virtual machine.
Further, the response information may be expressed in different forms, both states, namely a success state or a failure state. For example, the response information includes a state identifier, when the state identifier is 1, the domain information configuration of the target virtual machine is successfully represented, otherwise, when the state identifier is 0, the domain information configuration of the target virtual machine is failed. The configuration server can obtain a specific state identifier by analyzing the response information, so as to judge whether the domain information is successfully configured. And further, according to the domain information configuration result, executing the subsequent steps to activate the system, or outputting error information to prompt.
Step S103, if the domain information of the target virtual machine is configured successfully according to the response information, a second configuration instruction is sent to the target virtual machine, wherein the second configuration instruction is used for activating an operating system of the target virtual machine.
When the configuration server judges that the domain information of the target virtual machine is successfully configured according to the response information, the target virtual machine is indicated to be the target domain user with authentication authority, and at the moment, the operating system of the target virtual machine is activated by sending a configuration instruction to the target virtual machine, so that the probability of failure in activation of the operating system can be avoided or reduced.
Specifically, the second configuration instruction sent to the target virtual machine accesses the activation server after being executed by the target virtual machine, and sends activation request information to the activation server. In this embodiment, the activation server is a KMS server for activating a windows operating system. And after the activation server verifies according to the activation request information, returning activation response information so as to activate the windows operating system of the target virtual machine. The activation request information comprises identity information corresponding to the target virtual machine, the activation server verifies the authentication authority of the target virtual machine according to the identity information, and if the authentication is passed, activation response information is returned to the target virtual machine so as to activate an operating system of the target virtual machine.
FIG. 3 is a schematic diagram of a process of activating an operating system of a target virtual machine according to an embodiment of the present application, where, as shown in FIG. 3, after a configuration server sends a first configuration instruction to the target virtual machine, the target virtual machine responds to the first configuration instruction, performs domain information configuration, and returns a configuration result, that is, response information, to the configuration server, where the configuration server determines based on the response information, on one hand, if the domain information of the target virtual machine is configured successfully, the target virtual machine continues to send a second configuration instruction to the target virtual machine, and the target virtual machine continues to execute the second configuration instruction, so as to complete an action of activating the operating system; on the other hand, if the configuration of the domain information of the target virtual machine fails, the configuration server re-sends a first configuration instruction to the target virtual machine, and again tries to configure the domain information of the target virtual machine, and if the configuration of the domain information of the target virtual machine still fails after the cycle is performed for N times, the error information is output. By the virtual machine configuration method, the setting and verification of the identity information of the virtual machine and the activation of the operating system can be automatically completed based on the sequence dependency relationship among the configuration steps, so that the configuration success rate is improved, and the configuration efficiency is improved.
The first configuration instruction and the second configuration instruction in the steps of the embodiment may be generated based on a preset program script, more specifically, the program script is generated by a command line tool of a Windows operating system, and then the steps of generating and sending the first configuration instruction and the second configuration instruction in the steps are implemented based on a script execution tool. The command line tool is VBS, powershell, for example, and may be configured according to specific needs, and the specific usage method and principle of the command line tool are known to those skilled in the art, and are not described herein.
In this embodiment, the trigger instruction is configured to instruct the target virtual machine by responding to the trigger instruction, and send a first configuration instruction to the target virtual machine, where the first configuration instruction is configured to configure domain information of the virtual machine; receiving response information sent by the target virtual machine, wherein the response information is used for representing domain information configuration results of the target virtual machine; and according to the response information, if the domain information of the target virtual machine is configured successfully, sending a second configuration instruction to the target virtual machine, wherein the second configuration instruction is used for activating an operating system of the target virtual machine. Because the first configuration step is sent to the target virtual machine, and the second configuration instruction is sent to the target virtual machine after the domain information is successfully configured based on the execution result of the first configuration step, the target virtual machine can be ensured to be successfully activated, and the configuration efficiency and the success rate of the target virtual machine are improved.
Fig. 4 is a flowchart of a virtual machine configuration method according to another embodiment of the present application, and as shown in fig. 4, the virtual machine configuration method according to this embodiment adds steps of connection status determination, system update and initialization of a non-system disk for a target virtual machine on the basis of the virtual machine configuration method according to the embodiment shown in fig. 2, and further refines, and then the virtual machine configuration method according to this embodiment includes the following steps:
step S201, obtaining connection state information of an initialization virtual machine, where the initialization virtual machine is a virtual machine in an unconfigured state provided by a virtual machine platform, and the connection state information is used to characterize a network connection state of the initialization virtual machine and a configuration server.
Step S202, according to the connection state information of the initialized virtual machine, a trigger instruction for initializing the virtual machine is received.
For example, after a new virtual machine is recorded on a virtual machine platform (e.g. VMWare), the virtual machine in an initialized state is the initialized virtual machine referred to in the step of this embodiment. The initialization virtual machine is internally provided with a client used for communicating with the configuration server, and the client is deployed in the virtual machine when the virtual machine is recorded on the virtual machine platform through a preset virtual machine template, so that the recorded initialization virtual machine can communicate with the configuration server after being started. Meanwhile, the configuration server can also check the connection state of the initialized virtual machine in real time. Specifically, after the initialization virtual machine is started, a preset client is automatically operated, and connection state information is sent to the configuration server through the client, so that the configuration server can determine the network connection state between the initialization virtual machine and the configuration server.
Further, according to the connection state information of the initialized virtual machine, when the initialized virtual machine is normally connected with the network state of the configuration server, the initialized virtual machine can be configured. For example, the initialized virtual machine is set to be in a selectable state, and a user can output a trigger instruction for the initialized virtual machine through the man-machine interaction device, so that the initialized virtual machine is used as a target virtual machine to perform a subsequent system configuration process, and finally, the activation of an operating system is realized.
In step S203, in response to the trigger instruction, the trigger instruction is used to instruct the target virtual machine, and a first configuration instruction is sent to the target virtual machine, where the first configuration instruction is used to configure domain information of the virtual machine.
Step S204, receiving response information sent by the target virtual machine, wherein the response information is used for representing domain information configuration results of the target virtual machine.
Step S205, if the domain information of the target virtual machine is configured successfully according to the response information, a second configuration instruction is sent to the target virtual machine, wherein the second configuration instruction is used for activating an operating system of the target virtual machine.
Step S206, a third configuration instruction is sent to the target virtual machine, wherein the third configuration instruction is used for updating the operating system of the target virtual machine.
For example, after the operating system of the target virtual machine is activated, in order to implement a more complete virtual machine configuration process, the operating system of the target virtual machine needs to be updated, for example, a necessary security patch is installed, so as to improve the running security and stability of the operating system. Optionally, after the target virtual machine successfully activates the operating system, the response information is returned to the configuration server again, the configuration server sends a third configuration instruction to the target virtual machine after receiving the response information, and the target virtual machine updates the current operating system after receiving and responding to the third configuration instruction.
The third configuration instruction is used for controlling the operating system to acquire the number of the patches to be installed, and downloading and installing the patches to be installed or restarting the system based on the number of the patches to be installed.
The third configuration instruction contains rule information for indicating the target virtual machine to update the system, and the target virtual machine downloads and installs the system patch according to the rule information after receiving the third configuration instruction, thereby completing the updating of the operating system. Fig. 5 is a schematic process diagram of updating the operating system by the target virtual machine according to the rule information, as shown in fig. 5, after obtaining the rule information according to the third configuration instruction, the target virtual machine sequentially executes:
Step S2061: searching for patches to be installed.
Step S2062: the number of patches to be installed is calculated.
Step S2063: judging whether the number of patches to be installed is 0, if so, executing step S2065; if not, go to step S2064.
Step S2064: and downloading and installing the patch to be installed.
Step S2065: judging whether restarting is needed, if yes, returning to execute step S2061; if not, ending.
Specifically, the target virtual machine searches for available patch lists by connecting to windows upgrade server (Windows Server Update Services, WSUS), creates updateSession, updateSearcher objects in turn, and searches for uninstalled patches by the Search method of updateSearcher. After the patch search is completed, the patch quantity is obtained, and the process of searching the patch to be installed and calculating the patch quantity to be installed can be realized by using a searchresult. And then, based on specific judgment logic, downloading and installing, if the virtual machine needs to be restarted, restarting and searching for the patch to be installed, and if the virtual machine does not need to be restarted, updating is completed, and ending the flow.
Through the steps of the embodiment, one or more patches to be installed of the current operating system can be installed, and patch installation which needs restarting in the middle process is supported, so that the updating of the operating system is realized.
Step S207, a fourth configuration instruction is sent to the target virtual machine, wherein the fourth configuration instruction is used for initializing a non-system disk of the target virtual machine.
For example, when the virtual machine platform creates the virtual machine, the disk except for the system disk (i.e. the disk on which the operating system is installed) is mounted in the form of a data disk, so that the disk needs to be subjected to online, initialization and formatting operations, thereby improving the disk running speed and security in the subsequent use process of the virtual machine. Specifically, after the target virtual machine successfully activates the operating system, response information is returned to the configuration server again, after the configuration server receives the response information, a fourth configuration instruction is sent to the target virtual machine, and after the target virtual machine receives and responds to the fourth configuration instruction, the current non-system disk is initialized, so that the purposes of disk character adjustment, hard disk initialization, hard disk formatting, hard disk merging and the like are achieved.
The order between steps S206 and S207 is not necessarily the same, and may be changed as needed. And will not be described in detail herein.
In this embodiment, the implementation manner of step S203 to step S205 is the same as the implementation manner of step S101 to step S103 in the embodiment shown in fig. 2 of the present application, and will not be described in detail here.
Fig. 6 is a schematic structural diagram of a virtual machine configuration apparatus according to an embodiment of the present application, and as shown in fig. 6, a virtual machine configuration apparatus 3 according to the embodiment includes:
the first configuration module 31 is configured to respond to a trigger instruction, where the trigger instruction is used to instruct the target virtual machine, and send a first configuration instruction to the target virtual machine, where the first configuration instruction is used to configure domain information of the virtual machine;
the receiving module 32 receives response information sent by the target virtual machine, wherein the response information is used for representing domain information configuration results of the target virtual machine;
and the second configuration module 33 sends a second configuration instruction to the target virtual machine according to the response information if the domain information of the target virtual machine is configured successfully, wherein the second configuration instruction is used for activating the operating system of the target virtual machine.
The first configuration module 31, the receiving module 32 and the second configuration module 33 are sequentially connected. The virtual machine configuration apparatus provided in this embodiment may execute the technical scheme of the method embodiment shown in fig. 2, and its implementation principle and technical effects are similar, and are not described herein again.
Fig. 7 is a schematic structural diagram of a virtual machine configuration apparatus according to another embodiment of the present application, as shown in fig. 7, in the virtual machine configuration apparatus 4 according to this embodiment, a third configuration module 34, a state detection module 35, and a third configuration module 36 are added on the basis of the virtual machine configuration apparatus 3 according to the embodiment shown in fig. 6.
In one possible implementation, the first configuration instruction includes a network configuration instruction and a domain configuration instruction, where the network configuration instruction is used to configure a network address of the target virtual machine; the domain configuration instruction is used for configuring the target virtual machine as a target domain user, wherein the target domain user is a domain user with authentication authority; the network configuration instruction and the domain configuration instruction are sequentially executed by the target virtual machine to configure domain information of the target virtual machine.
In one possible implementation, the network address of the target virtual machine includes an IP address and a DNS address, and the network configuration instruction is configured to obtain a current active network card of the target virtual machine after being executed by the pre-configured virtual machine, and determine, based on the active network card, a corresponding IP address and DNS address.
In one possible implementation manner, the second configuration instruction is used for controlling the target virtual machine to send activation request information to the activation server, activating an operating system of the target virtual machine based on activation response information returned by the activation server, wherein the activation request information comprises identity information corresponding to the target virtual machine, and the identity information is used for verifying authentication authority of the target virtual machine.
In one possible implementation, after sending the second configuration instruction to the target virtual machine, the apparatus further includes: and a third configuration module 34, configured to send a third configuration instruction to the target virtual machine, where the third configuration instruction is used to update the operating system of the target virtual machine.
In one possible implementation, the third configuration instruction is configured to control the operating system to obtain the number of patches to be installed, and download and install the patches to be installed or restart based on the number of patches to be installed.
In one possible implementation, the apparatus further includes: the state detection module 35 is configured to obtain connection state information of an initialized virtual machine, where the initialized virtual machine is a virtual machine in an unconfigured state provided by a virtual machine platform, before responding to a trigger instruction, and the connection state information is used to characterize a network connection state of the initialized virtual machine and a configuration server; and receiving a trigger instruction aiming at the initialized virtual machine according to the connection state information of the initialized virtual machine.
In one possible implementation, the apparatus further includes: a fourth configuration module 36, configured to send a fourth configuration instruction to the target virtual machine, where the fourth configuration instruction is used to initialize a non-system disk of the target virtual machine.
The state detection module 35, the first configuration module 31, the receiving module 32, and the second configuration module 33 are sequentially connected, and the third configuration module 34 and the fourth configuration module 35 are respectively connected with the second configuration module 33. The virtual machine configuration apparatus provided in this embodiment may execute the technical scheme of the method embodiment shown in any one of fig. 2 to 5, and its implementation principle and technical effect are similar, and will not be described herein again.
Fig. 8 is a schematic diagram of an electronic device according to an embodiment of the present application, and as shown in fig. 8, the electronic device 5 provided in this embodiment includes: a processor 51, and a memory 52 communicatively coupled to the processor 51.
Wherein the memory 52 stores computer-executable instructions;
the processor 51 executes computer-executable instructions stored in the memory 52 to implement the virtual machine configuration method provided in any of the embodiments corresponding to fig. 2-5 of the present application.
Wherein the memory 51 and the processor 52 are connected by a bus 53.
The relevant descriptions and effects corresponding to the steps in the embodiments corresponding to fig. 2-5 may be understood correspondingly, and are not described in detail herein.
An embodiment of the present application provides a computer readable storage medium having a computer program stored thereon, where the computer program is executed by a processor to implement a virtual machine configuration method provided in any of the embodiments corresponding to fig. 2-5 of the present application.
The computer readable storage medium may be, among other things, ROM, random Access Memory (RAM), CD-ROM, magnetic tape, floppy disk, optical data storage device, etc.
An embodiment of the present application provides a computer program product, including a computer program, which when executed by a processor implements a virtual machine configuration method provided in any of the embodiments corresponding to fig. 2-5 of the present application.
Fig. 9 is a block diagram of a terminal device 800, which may be a mobile phone, a computer, a digital broadcast terminal, a messaging device, a game console, a tablet device, a medical device, an exercise device, a personal digital assistant, etc., as shown in an exemplary embodiment of the present application.
Terminal device 800 can include one or more of the following components: a processing component 802, a memory 804, a power component 806, a multimedia component 808, an audio component 810, an input/output (I/O) interface 812, a sensor component 814, and a communication component 816.
The processing component 802 generally controls overall operation of the terminal device 800, such as operations associated with display, telephone calls, data communications, camera operations, and recording operations. The processing component 802 may include one or more processors 820 to execute instructions to perform all or part of the steps of the methods described above. Further, the processing component 802 can include one or more modules that facilitate interactions between the processing component 802 and other components. For example, the processing component 802 can include a multimedia module to facilitate interaction between the multimedia component 808 and the processing component 802.
The memory 804 is configured to store various types of data to support operations at the terminal device 800. Examples of such data include instructions for any application or method operating on terminal device 800, contact data, phonebook data, messages, pictures, video, and the like. The memory 804 may be implemented by any type or combination of volatile or nonvolatile memory devices such as Static Random Access Memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic or optical disk.
The power supply component 806 provides power to the various components of the terminal device 800. The power components 806 may include a power management system, one or more power sources, and other components associated with generating, managing, and distributing power for the terminal device 800.
The multimedia component 808 includes a screen between the terminal device 800 and the user that provides an output interface. In some embodiments, the screen may include a Liquid Crystal Display (LCD) and a Touch Panel (TP). If the screen includes a touch panel, the screen may be implemented as a touch screen to receive input signals from a user. The touch panel includes one or more touch sensors to sense touches, swipes, and gestures on the touch panel. The touch sensor may sense not only the boundary of a touch or sliding action, but also the duration and pressure associated with the touch or sliding operation. In some embodiments, the multimedia component 808 includes a front camera and/or a rear camera. The front camera and/or the rear camera may receive external multimedia data when the terminal device 800 is in an operation mode, such as a photographing mode or a video mode. Each front camera and rear camera may be a fixed optical lens system or have focal length and optical zoom capabilities.
The audio component 810 is configured to output and/or input audio signals. For example, the audio component 810 includes a Microphone (MIC) configured to receive external audio signals when the terminal device 800 is in an operational mode, such as a call mode, a recording mode, and a voice recognition mode. The received audio signals may be further stored in the memory 804 or transmitted via the communication component 816. In some embodiments, audio component 810 further includes a speaker for outputting audio signals.
The I/O interface 812 provides an interface between the processing component 802 and peripheral interface modules, which may be a keyboard, click wheel, buttons, etc. These buttons may include, but are not limited to: homepage button, volume button, start button, and lock button.
The sensor assembly 814 includes one or more sensors for providing status assessment of various aspects of the terminal device 800. For example, the sensor assembly 814 may detect an on/off state of the terminal device 800, a relative positioning of the assemblies, such as a display and keypad of the terminal device 800, the sensor assembly 814 may also detect a change in position of the terminal device 800 or a component of the terminal device 800, the presence or absence of a user's contact with the terminal device 800, an orientation or acceleration/deceleration of the terminal device 800, and a change in temperature of the terminal device 800. The sensor assembly 814 may include a proximity sensor configured to detect the presence of nearby objects without any physical contact. The sensor assembly 814 may also include a light sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, the sensor assembly 814 may also include an acceleration sensor, a gyroscopic sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.
The communication component 816 is configured to facilitate communication between the terminal device 800 and other devices, either wired or wireless. The terminal device 800 may access a wireless network based on a communication standard, such as WiFi,3G, 4G, 5G, or other standard communication networks, or a combination thereof. In one exemplary embodiment, the communication component 816 receives broadcast signals or broadcast related information from an external broadcast management system via a broadcast channel. In one exemplary embodiment, the communication component 816 further includes a Near Field Communication (NFC) module to facilitate short range communications. For example, the NFC module may be implemented based on Radio Frequency Identification (RFID) technology, infrared data association (IrDA) technology, ultra Wideband (UWB) technology, bluetooth (BT) technology, and other technologies.
In an exemplary embodiment, the terminal device 800 may be implemented by one or more Application Specific Integrated Circuits (ASICs), digital Signal Processors (DSPs), digital Signal Processing Devices (DSPDs), programmable Logic Devices (PLDs), field Programmable Gate Arrays (FPGAs), controllers, microcontrollers, microprocessors or other electronic elements for performing the methods provided in any one of the embodiments described above and corresponding to fig. 2-5 of the present application.
In an exemplary embodiment, a non-transitory computer readable storage medium is also provided, such as memory 804 including instructions executable by processor 820 of terminal device 800 to perform the above-described method. For example, the non-transitory computer readable storage medium may be ROM, random Access Memory (RAM), CD-ROM, magnetic tape, floppy disk, optical data storage device, etc.
Embodiments of the present application also provide a non-transitory computer readable storage medium, which when executed by a processor of a terminal device, causes the terminal device 800 to perform the method provided in any of the embodiments corresponding to fig. 2-5 of the present application.
In the several embodiments provided in this application, it should be understood that the disclosed apparatus and method may be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative, e.g., the division of modules is merely a logical function division, and there may be additional divisions of actual implementation, e.g., multiple modules or components may be combined or integrated into another system, or some features may be omitted, or not performed. Alternatively, the coupling or direct coupling or communication connection shown or discussed with each other may be an indirect coupling or communication connection via some interfaces, devices or modules, which may be in electrical, mechanical, or other forms.
Other embodiments of the present application will be apparent to those skilled in the art from consideration of the specification and practice of the application disclosed herein. This application is intended to cover any variations, uses, or adaptations of the application following, in general, the principles of the application and including such departures from the present disclosure as come within known or customary practice within the art to which the application pertains. It is intended that the specification and examples be considered as exemplary only, with a true scope and spirit of the application being indicated by the following claims.
It is to be understood that the present application is not limited to the precise arrangements and instrumentalities shown in the drawings, which have been described above, and that various modifications and changes may be effected without departing from the scope thereof. The scope of the application is limited only by the appended claims.

Claims (9)

1. A virtual machine configuration method, applied to a configuration server, the method comprising:
responding to a trigger instruction, wherein the trigger instruction is used for indicating a target virtual machine and sending a first configuration instruction to the target virtual machine, and the first configuration instruction is used for configuring domain information of the virtual machine;
receiving response information sent by the target virtual machine, wherein the response information is used for representing domain information configuration results of the target virtual machine;
According to the response information, if the domain information of the target virtual machine is configured successfully, a second configuration instruction is sent to the target virtual machine, and the second configuration instruction is used for activating an operating system of the target virtual machine;
if the domain information of the target virtual machine fails to be configured, a first configuration instruction is sent to the target virtual machine again, and the domain information of the target virtual machine is configured; if the domain information of the target virtual machine is configured to fail after the cycle is performed for N times, outputting error information;
the first configuration instruction comprises a network configuration instruction and a domain configuration instruction, wherein the network configuration instruction is used for configuring a network address of the target virtual machine; the domain configuration instruction is used for configuring the target virtual machine as a target domain user, wherein the target domain user is a domain user with authentication authority;
the network configuration instruction and the domain configuration instruction are sequentially executed by the target virtual machine to configure domain information of the target virtual machine.
2. The method of claim 1, wherein the network address of the target virtual machine comprises an IP address and a DNS address, and wherein the network configuration instructions, after being executed by the pre-configured virtual machine, are configured to obtain a current active network card of the target virtual machine, and determine, based on the active network card, a corresponding IP address and DNS address.
3. The method of claim 1, wherein the second configuration instruction is configured to control the target virtual machine to send activation request information to an activation server, and activate an operating system of the target virtual machine based on activation response information returned by the activation server, where the activation request information includes identity information corresponding to the target virtual machine, and the identity information is used to verify authentication rights of the target virtual machine.
4. A method according to any of claims 1-3, wherein after sending the second configuration instruction to the target virtual machine, the method further comprises:
and sending a third configuration instruction to the target virtual machine, wherein the third configuration instruction is used for updating an operating system of the target virtual machine.
5. The method of claim 4, wherein the third configuration instructions are configured to control the operating system to obtain a number of system patches to be installed and to download and install the system patches to be installed or to restart based on the number of system patches to be installed.
6. A method according to any one of claims 1-3, wherein prior to responding to the trigger instruction, the method further comprises:
Acquiring connection state information of an initialization virtual machine, wherein the initialization virtual machine is a virtual machine in an unconfigured state provided by a virtual machine platform, and the connection state information is used for representing the network connection state of the initialization virtual machine and the configuration server;
and receiving a trigger instruction aiming at the initialized virtual machine according to the connection state information of the initialized virtual machine.
7. A method according to any one of claims 1-3, wherein the method further comprises:
and sending a fourth configuration instruction to the target virtual machine, wherein the fourth configuration instruction is used for initializing a non-system disk of the target virtual machine.
8. A virtual machine configuration apparatus for use with a configuration server, the apparatus comprising:
the first configuration module is used for responding to a trigger instruction, the trigger instruction is used for indicating a target virtual machine and sending a first configuration instruction to the target virtual machine, wherein the first configuration instruction is used for configuring domain information of the virtual machine;
the receiving module is used for receiving response information sent by the target virtual machine, wherein the response information is used for representing domain information configuration results of the target virtual machine;
The second configuration module is used for sending a second configuration instruction to the target virtual machine according to the response information if the domain information of the target virtual machine is successfully configured, wherein the second configuration instruction is used for activating an operating system of the target virtual machine;
if the domain information of the target virtual machine fails to be configured, a first configuration instruction is sent to the target virtual machine again, and the domain information of the target virtual machine is configured; if the domain information of the target virtual machine is configured to fail after the cycle is performed for N times, outputting error information;
the first configuration instruction comprises a network configuration instruction and a domain configuration instruction, wherein the network configuration instruction is used for configuring a network address of the target virtual machine; the domain configuration instruction is used for configuring the target virtual machine as a target domain user, wherein the target domain user is a domain user with authentication authority;
the network configuration instruction and the domain configuration instruction are sequentially executed by the target virtual machine to configure domain information of the target virtual machine.
9. An electronic device, comprising: a processor, and a memory communicatively coupled to the processor;
the memory stores computer-executable instructions;
The processor executes computer-executable instructions stored by the memory to implement the virtual machine configuration method of any one of claims 1 to 7.
CN202111595571.0A 2021-12-23 2021-12-23 Virtual machine configuration method and device and electronic equipment Active CN114301771B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111595571.0A CN114301771B (en) 2021-12-23 2021-12-23 Virtual machine configuration method and device and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111595571.0A CN114301771B (en) 2021-12-23 2021-12-23 Virtual machine configuration method and device and electronic equipment

Publications (2)

Publication Number Publication Date
CN114301771A CN114301771A (en) 2022-04-08
CN114301771B true CN114301771B (en) 2024-03-12

Family

ID=80969401

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111595571.0A Active CN114301771B (en) 2021-12-23 2021-12-23 Virtual machine configuration method and device and electronic equipment

Country Status (1)

Country Link
CN (1) CN114301771B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115086387B (en) * 2022-05-24 2024-01-26 福瑞泰克智能系统有限公司 Control method and device of domain controller, storage medium and electronic device

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103441867A (en) * 2013-08-15 2013-12-11 国云科技股份有限公司 Method for updating internal network resource allocation of virtual machine
CN111651235A (en) * 2020-04-17 2020-09-11 北京奇艺世纪科技有限公司 Virtual machine set task management method and device
CN112162825A (en) * 2020-10-12 2021-01-01 北京首都在线科技股份有限公司 Equipment configuration method, device, equipment and storage medium
CN113238835A (en) * 2021-06-02 2021-08-10 中国联合网络通信集团有限公司 Virtual machine configuration method, device, server and system

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103441867A (en) * 2013-08-15 2013-12-11 国云科技股份有限公司 Method for updating internal network resource allocation of virtual machine
CN111651235A (en) * 2020-04-17 2020-09-11 北京奇艺世纪科技有限公司 Virtual machine set task management method and device
CN112162825A (en) * 2020-10-12 2021-01-01 北京首都在线科技股份有限公司 Equipment configuration method, device, equipment and storage medium
CN113238835A (en) * 2021-06-02 2021-08-10 中国联合网络通信集团有限公司 Virtual machine configuration method, device, server and system

Also Published As

Publication number Publication date
CN114301771A (en) 2022-04-08

Similar Documents

Publication Publication Date Title
CN107967141B (en) Operating system upgrading method and device and terminal
EP3716656A1 (en) Profile generation method, profile acquisition method, and related device and storage medium
CN112099829A (en) Vehicle upgrade control method and system, OTA background and vehicle
CN110008690B (en) Authority management method, device, equipment and medium for terminal application
CN111221559B (en) Application updating method, device, storage medium, terminal and server
CN111198706A (en) Method for updating system function, apparatus for updating system function and storage medium
CN114301771B (en) Virtual machine configuration method and device and electronic equipment
CN107395624B (en) Information processing method and device
CN112463199A (en) System upgrading method and terminal
CN114610406A (en) Code injection method, device, storage medium and electronic equipment
CN112584547B (en) Method, device, storage medium and terminal equipment for establishing data connection
CN110865823B (en) Pre-installation application control method, pre-installation application control device and storage medium
CN106375350B (en) Flashing verification method and device
CN111488163B (en) Firmware updating method and device, electronic equipment and storage medium
CN105099765B (en) Data-updating method and device
CN110008668B (en) Data processing method, device and storage medium
CN114416127A (en) Terminal software upgrading method, terminal software upgrading device and storage medium
CN116546062A (en) Cloud mobile phone control method and device, cloud server and storage medium
CN116360979A (en) Memory allocation method and device, electronic equipment and readable storage medium
KR101206639B1 (en) Server and Method for updating firmware in Mobile communication terminal
US11269699B2 (en) Method and device for processing an application
CN114826567A (en) Terminal password updating method and device, electronic equipment, medium and product
CN112947970A (en) Upgrading method, device and storage medium
CN111294230B (en) Parameter acquisition method and device
CN113448672A (en) Device control method, target terminal, cloud, virtual desktop server and medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant