CN115390992A - Virtual machine creating method, device, equipment and storage medium - Google Patents

Virtual machine creating method, device, equipment and storage medium Download PDF

Info

Publication number
CN115390992A
CN115390992A CN202211104740.0A CN202211104740A CN115390992A CN 115390992 A CN115390992 A CN 115390992A CN 202211104740 A CN202211104740 A CN 202211104740A CN 115390992 A CN115390992 A CN 115390992A
Authority
CN
China
Prior art keywords
virtual machine
current server
server
target virtual
current
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.)
Pending
Application number
CN202211104740.0A
Other languages
Chinese (zh)
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.)
Shenzhen Weike Software Technology Co ltd
Original Assignee
Shenzhen Weike Software Technology Co ltd
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 Shenzhen Weike Software Technology Co ltd filed Critical Shenzhen Weike Software Technology Co ltd
Priority to CN202211104740.0A priority Critical patent/CN115390992A/en
Publication of CN115390992A publication Critical patent/CN115390992A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45533Hypervisors; Virtual machine monitors
    • G06F9/45558Hypervisor-specific management and integration aspects
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5061Partitioning or combining of resources
    • G06F9/5077Logical partitioning of resources; Management or configuration of virtualized resources
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45533Hypervisors; Virtual machine monitors
    • G06F9/45558Hypervisor-specific management and integration aspects
    • G06F2009/45562Creating, deleting, cloning virtual machine instances
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45533Hypervisors; Virtual machine monitors
    • G06F9/45558Hypervisor-specific management and integration aspects
    • G06F2009/45583Memory management, e.g. access or allocation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45533Hypervisors; Virtual machine monitors
    • G06F9/45558Hypervisor-specific management and integration aspects
    • G06F2009/45591Monitoring or debugging support

Abstract

The invention discloses a virtual machine creating method, a virtual machine creating device, virtual machine creating equipment and a storage medium. The method comprises the following steps: receiving a virtual machine creation request, the virtual machine creation request comprising: the method comprises the steps that target virtual machine type information corresponding to a target virtual machine to be created currently and target virtual machine resource information required when the target virtual machine is created; acquiring current server state information corresponding to a current server for creating a virtual machine; if the current server state information is detected to be available state information, current server type information and current server residual resource information corresponding to the current server are obtained; and if the current server type information is matched with the target virtual machine type information and the current server residual resource information is greater than or equal to the target virtual machine resource information, establishing the target virtual machine on the current server. The technical scheme of the invention can ensure the successful creation of the virtual machine, avoid the situation of server blocking or rushing, and improve the user experience.

Description

Virtual machine creating method, device, equipment and storage medium
Technical Field
The present invention relates to the field of computer technologies, and in particular, to a method, an apparatus, a device, and a storage medium for creating a virtual machine.
Background
With the development of computer technology, the use of virtual machines is becoming more and more common. Virtual machines are typically created and used in servers. Currently, it is common to create a virtual machine using an analog processor (QEMU) or a KVM (Keyboard Video Mouse). The creation is to create the virtual machine directly on the server.
However, in this way of directly creating a virtual machine, there may be a case where the creation fails, and even if the virtual machine is successfully created in the server, the server may be stuck or even crashed when the virtual machine is running. Once the server crashes, all the virtual machines on the server disappear, and need to be created again, which wastes time and labor, and greatly reduces the user experience.
Disclosure of Invention
The invention provides a virtual machine creating method, which is used for ensuring the successful creation of a virtual machine and avoiding the situation of server blocking or rushing, thereby improving the user experience.
According to an aspect of the present invention, there is provided a virtual machine creation method, including:
receiving a virtual machine creation request, the virtual machine creation request comprising: the method comprises the steps that target virtual machine type information corresponding to a target virtual machine to be created currently and target virtual machine resource information required when the target virtual machine is created;
acquiring current server state information corresponding to a current server for creating a virtual machine;
if the current server state information is detected to be available state information, current server type information and current server residual resource information corresponding to the current server are obtained;
and if the type information of the current server is matched with the type information of the target virtual machine and the residual resource information of the current server is greater than or equal to the resource information of the target virtual machine, establishing the target virtual machine on the current server.
According to another aspect of the present invention, there is provided a virtual machine creation apparatus including:
a request receiving module, configured to receive a virtual machine creation request, where the virtual machine creation request includes: the method comprises the steps that target virtual machine type information corresponding to a target virtual machine to be created currently and target virtual machine resource information required when the target virtual machine is created;
the server state acquisition module is used for acquiring current server state information corresponding to a current server for creating the virtual machine;
the server information acquisition module is used for acquiring current server type information and current server residual resource information corresponding to the current server if the current server state information is detected to be available state information;
and the virtual machine creating module is used for creating the target virtual machine on the current server if the current server type information is matched with the target virtual machine type information and the current server residual resource information is greater than or equal to the target virtual machine resource information.
According to another aspect of the present invention, there is provided an electronic apparatus including:
at least one processor; and
a memory communicatively coupled to the at least one processor; wherein the content of the first and second substances,
the memory stores a computer program executable by the at least one processor, the computer program being executable by the at least one processor to enable the at least one processor to perform the virtual machine creation method of any embodiment of the present invention.
According to another aspect of the present invention, there is provided a computer-readable storage medium storing computer instructions for causing a processor to implement the virtual machine creation method according to any embodiment of the present invention when the computer instructions are executed.
According to the technical scheme of the embodiment of the invention, the virtual machine creation request is received, and comprises the following steps: the method comprises the steps that target virtual machine type information corresponding to a target virtual machine to be created currently and target virtual machine resource information required when the target virtual machine is created; acquiring current server state information corresponding to a current server for creating a virtual machine; if the current server state information is detected to be available state information, current server type information and current server residual resource information corresponding to the current server are obtained; if the type information of the current server is matched with the type information of the target virtual machine and the residual resource information of the current server is larger than or equal to the resource information of the target virtual machine, the target virtual machine is established on the current server so as to reasonably establish the virtual machine on the server based on the actual resource condition of the server, thereby ensuring the successful establishment of the virtual machine, avoiding the occurrence of the condition of server blocking or rushing, and improving the user experience.
It should be understood that the statements in this section do not necessarily identify key or critical features of the embodiments of the present invention, nor do they necessarily limit the scope of the invention. Other features of the present invention will become apparent from the following description.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings required to be used in the description of the embodiments are briefly introduced below, and it is obvious that the drawings in the description below are only some embodiments of the present invention, and it is obvious for those skilled in the art that other drawings can be obtained according to the drawings without creative efforts.
Fig. 1 is a flowchart of a virtual machine creation method according to an embodiment of the present invention;
fig. 2 is a flowchart of another virtual machine creation method according to a second embodiment of the present invention;
fig. 3 is a flowchart of another virtual machine creation method according to a third embodiment of the present invention;
fig. 4 is a schematic structural diagram of a virtual machine creation apparatus according to a fourth embodiment of the present invention;
fig. 5 is a schematic structural diagram of an electronic device implementing the virtual machine creation method according to the embodiment of the present invention.
Detailed Description
In order to make the technical solutions of the present invention better understood, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
It should be noted that the terms "first," "second," and the like in the description and claims of the present invention and in the drawings described above are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used is interchangeable under appropriate circumstances such that the embodiments of the invention described herein are capable of operation in other sequences than those illustrated or described herein. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed, but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
Example one
Fig. 1 is a flowchart of a virtual machine creation method according to an embodiment of the present invention, where the present embodiment is applicable to a case where a virtual machine is created in a server, and the method may be executed by a virtual machine creation apparatus, where the virtual machine creation apparatus may be implemented in a form of hardware and/or software and integrated in an electronic device. As shown in fig. 1, the method includes:
s110, receiving a virtual machine creating request, wherein the virtual machine creating request comprises: the type information of the target virtual machine corresponding to the target virtual machine to be created currently and the resource information of the target virtual machine required when the target virtual machine is created.
The virtual machine may refer to a complete computer system which has complete hardware system functions and is simulated by software and runs in a completely isolated environment. For example, the Virtual machine may be a VM, a Virtual Box, or a Virtual PC, etc. The target virtual machine may refer to a virtual machine to be created. The number of target virtual machines may be one or more. The virtual machine type information may include a Central Processing Unit (CPU) or a Graphics Processing Unit (GPU) type corresponding to the target virtual machine. Illustratively, the target virtual machine resource information may include: the CPU core number, the operation memory size and the display card memory size corresponding to the target virtual machine.
Specifically, when a user wants to create a virtual machine, a virtual machine creation operation may be triggered on a user terminal, a virtual machine creation request is generated based on the virtual machine creation operation triggered by the user, and the virtual machine creation request is sent to a controller for performing creation control on the virtual machine, so that the controller receives the virtual machine creation request, and determines, based on the received virtual machine creation request, target virtual machine type information (such as a CPU type or a CPU + GPU type) corresponding to a target virtual machine to be created currently and target virtual machine resource information (such as a 4-core CPU, an 8G operating memory, and a 2G display memory) required when the target virtual machine is created.
For example, if a teacher of software a needs to apply for teaching 200 virtual machines with software a, information such as software a to be used, the number of virtual machines, the type of virtual machine, the memory of virtual machine, and the running memory of virtual machine may be input into the user terminal, so that the user terminal generates a virtual machine creation request based on the information and sends the virtual machine creation request to the controller.
If there are a plurality of target virtual machines, the target virtual machines may be created one by one based on the target virtual machine type information corresponding to each target virtual machine and the target virtual machine resource information required for creating the target virtual machine.
And S120, acquiring current server state information corresponding to a current server for creating the virtual machine.
The server state information may refer to information about whether the server is in an available state, and may be divided into available state information and unavailable state information. For example, when the server cannot perform the task of creating a virtual machine in the phases of restarting, installing other software, and upgrading other services, the server is in a non-available state, i.e., a non-distributable machine state. The current server state information may refer to state information of the current server.
In addition, in the case where only one server exists, the controller may use the server as the current server to acquire the current server state information. When a plurality of servers, that is, server clusters exist, the server with the first rank may be used as the current server based on the server creation order corresponding to the server clusters, and current server state information of the server may be obtained. And if the state of the current server is not suitable for creating the virtual machine, taking the next server of the current server as the current server, and acquiring the state information of the current server corresponding to the current server again.
Specifically, the controller may obtain current server state information corresponding to the current server, and determine whether the current server for creating the virtual machine is in a state in which the virtual machine can be created based on the current server state information.
Exemplarily, before S120, the method may further include: a first server in the server cluster is determined to be a current server for creating the virtual machine.
A server may refer to a server that manages computing resources, among other things. For example, a server may be, but is not limited to, a computer. A server cluster may be a cluster consisting of a plurality of servers. The servers in the server cluster are arranged in a certain order. The current server may refer to a server that is ranked first in a cluster of servers to create a virtual machine.
Specifically, if there is a server cluster composed of a plurality of servers, a server ranked first among the servers may be determined as a current server for creating the virtual machine.
And S130, if the current server state information is detected to be available state information, acquiring current server type information and current server residual resource information corresponding to the current server.
The current server type information may include a CPU or GPU type corresponding to the current server. For example, the remaining resource information of the current server may include the number of remaining CPU cores, the size of remaining operating memory, and the size of remaining graphics card memory corresponding to the current server. The remaining number of CPU cores may refer to the number of cores that the server can create. For example, if the server uses 8 cores of CPU, the remaining number of CPU cores may be 4 cores and 8 cores.
Specifically, if it is detected that the current server state information is available state information, which indicates that the current state of the current server is a state in which a virtual machine can be created, current server type information (for example, a CPU type) and current server remaining resource information (for example, 4-core CPU and 100G running memory) corresponding to the current server may be obtained.
And S140, if the type information of the current server is matched with the type information of the target virtual machine and the residual resource information of the current server is greater than or equal to the resource information of the target virtual machine, establishing the target virtual machine on the current server.
Specifically, if it is detected that the type information of the current server is matched with the type information of the target virtual machine, for example, a processor of the current server is CPU + GPU, and a processor for creating the target virtual machine is also CPU + GPU, the type information matching between the two is successful, and each item of information in the remaining resource information of the previous server is matched with corresponding information in the resource information of the target virtual machine, and if each item of information in the remaining resource information of the current server is greater than or equal to the information corresponding to the resource information of the target virtual machine, the resource information matching is successful, so that the current server with all the successfully matched type information and resource information performs creation of the target virtual machine, thereby accurately allocating allocable resources of the computing server, avoiding server crash caused by virtual machine creation exceeding the allocable resources, and ensuring normal operation of the virtual machines in the server if the number of the created virtual machines exceeds the server limit, thereby improving user experience.
For example, based on the detection operation on the server, it can be determined that a teacher in teaching of software a needs to apply for 200 corresponding servers that are created by the virtual machines with software a one by one, and create the virtual machines, so that the situation that 200 virtual machines are stuck or even crashed when the teacher goes to school is avoided, and the normal use of the virtual machines by the teacher during the class period can be ensured.
Illustratively, if it is detected that the current server state information is non-available state information, the current server type information does not match the target virtual machine type information, or the remaining resource information of the current server is smaller than the target virtual machine resource information, based on the server arrangement order corresponding to the server cluster, the next server of the current server is taken as the current server, and the operation of obtaining the current server state information corresponding to the current server for creating the virtual machine is returned and executed.
Specifically, if it is detected that the current server state information is non-available state information, the current server type information is not matched with the target virtual machine type information, and the remaining resource information of the current server is less than at least one item of the target virtual machine resource information, it indicates that the current server cannot create the target virtual machine, and based on the server arrangement sequence corresponding to the server cluster, the next server of the current server is taken as the current server, and the operation of S120 is returned to be executed until a server meeting the creation condition of the target virtual machine is detected, or detection is stopped after all servers in the server cluster are traversed.
Illustratively, if all the servers in the server cluster do not meet the condition for creating the target virtual machine, traversing and matching the servers in the server cluster again after a preset time interval until the target virtual machine is created in the target server meeting the condition.
The preset interval duration may be a preset interval duration, and is used for restarting traversal matching tasks of virtual machines, which are not created yet by traversing all servers in the server cluster, after the preset interval duration is met.
Specifically, if all the servers in the server cluster do not meet the condition for creating the target virtual machine, the creation of the target virtual machine is stopped, and the detection and creation of other target virtual machines are continued. After the creation stop duration of the target virtual machine reaches the interval preset duration, traversal matching can be performed again on the servers in the server cluster based on the target virtual machine until the target virtual machine is created in the target server meeting the condition.
According to the technical scheme of the embodiment of the invention, the virtual machine creation request is received, and comprises the following steps: the method comprises the steps that target virtual machine type information corresponding to a target virtual machine to be created currently and target virtual machine resource information required when the target virtual machine is created; acquiring current server state information corresponding to a current server for creating a virtual machine; if the current server state information is detected to be available state information, current server type information and current server residual resource information corresponding to the current server are obtained; if the type information of the current server is matched with the type information of the target virtual machine and the residual resource information of the current server is larger than or equal to the resource information of the target virtual machine, the target virtual machine is established on the current server so as to reasonably establish the virtual machine on the server based on the actual resource condition of the server, thereby ensuring the successful establishment of the virtual machine, avoiding the occurrence of the condition of server blocking or rushing, and improving the user experience.
Example two
Fig. 2 is a flowchart of a virtual machine creation method according to a second embodiment of the present invention, and this embodiment describes details of a process of creating a target virtual machine on a current server based on the foregoing embodiment. Wherein explanations of the same or corresponding terms as those of the above embodiments are omitted. As shown in fig. 2, the method includes:
s210, receiving a virtual machine creating request, wherein the virtual machine creating request comprises: the type information of the target virtual machine corresponding to the target virtual machine to be created currently and the resource information of the target virtual machine required when the target virtual machine is created.
And S220, acquiring current server state information corresponding to a current server for creating the virtual machine.
And S230, if the current server state information is detected to be available state information, acquiring current server type information and current server residual resource information corresponding to the current server.
Illustratively, S230 may include: and if the current server state information is detected to be the server state of the allocable resources except the server restart state, the software installation state and the software upgrading state, acquiring the current server type information and the current server residual resource information corresponding to the current server.
The non-available state may include a server restart state, a software installation state, and a software upgrade state, among others.
Specifically, through detection of the main server, if it is detected that the current server state information is a server state of allocable resources except for a server restart state, a software installation state, and a software upgrade state, that is, it is detected that there is a current server whose current server state is an available state, current server type information and current server remaining resource information corresponding to the current server are obtained.
S240, if it is detected that the type information of the current server is matched with the type information of the target virtual machine and the remaining resource information of the current server is greater than or equal to the resource information of the target virtual machine, acquiring the number of current total virtual machines to be created and the number of virtual machines to be created corresponding to the current server.
The total current creating virtual machine number may include the number of virtual machines that have been created currently, the number of virtual machines that are currently being created, and the number of virtual machines to be created currently.
And S250, if the fact that the number of the current total created virtual machines is smaller than a first number threshold value and the number of the current virtual machines to be created is smaller than a second number threshold value is detected, creating the target virtual machine on the current server.
The first number threshold may refer to a maximum number of virtual machines that the current server is allowed to create when the current server is not stuck and crashed. The second number threshold may refer to a maximum number that the current server presets to create the virtual machine queue to accommodate.
Specifically, for the case that only one server exists, if it is detected that the number of target creation virtual machines is greater than or equal to a first number threshold, or the number of current virtual machines to be created is greater than or equal to a second number threshold, that is, any one of the number is satisfied, indicating that no server capable of creating a virtual machine exists currently, the creation may be directly exited. When multiple servers, that is, server clusters exist, a next server of a current server may be used as the current server based on a server creation order corresponding to the server clusters, and for each current server, if it is detected that the number of target created virtual machines is greater than or equal to a first number threshold, or the number of current virtual machines to be created is greater than or equal to a second number threshold, that is, any one of the number of target created virtual machines is satisfied, which indicates that the current server does not satisfy a condition for creating virtual machines, the step S220 may be returned to execute, and the condition detection may be performed until the current server capable of creating the target virtual machines is matched, or until all servers fail to be matched, and the cycle ends.
It should be noted that the server cannot always create a virtual machine and run the created virtual machine. If the number of created virtual machines and the number of running virtual machines exceed the tolerance range of the server, the running of the server is blocked or crashed, so that the number of the currently total created virtual machines of the server is limited. For example, a browser may run stuck or crash when it opens across multiple pages. Meanwhile, when too many virtual machines are created at the same time, the server CPU continues to be excessively high and jammed, and other created complete virtual machines are affected.
On the basis of the above technical solution, the "virtual machine creation request" in S210 further includes: identifying information of a target image file corresponding to the target virtual machine; the "creating the target virtual machine on the current server" in S240 may include: acquiring a target image file corresponding to the identification information of the target image file; and creating a target virtual machine on the current server by running the target image file.
Wherein, the virtual machine creation request may include: the method comprises the steps of obtaining target virtual machine type information corresponding to a target virtual machine to be created currently, target virtual machine resource information required when the target virtual machine is created, and target image file identification information corresponding to the target virtual machine. Mirroring may refer to a form of file storage. An image file may mean that data on one disk has an identical copy file on another disk. The target image file may refer to an image file containing software and files required to be used in the target virtual machine, and is used for generating the target virtual machine. The image file identification information may refer to unique identification information of the image file, and is used to distinguish each image file.
Specifically, the controller may obtain a target image file corresponding to the target image file identification information based on the target image file identification information corresponding to the target virtual machine in the virtual machine creation request, and run the target image file in the current server that determines to create the target virtual machine, thereby creating the target virtual machine on the current server. It should be noted that the target image file does not disappear after the target virtual machine is created by running, the corresponding virtual machine can be created by running for multiple times, multiple generation of the image file is avoided, the virtual machine creation efficiency is improved, and meanwhile, only one corresponding image file needs to be generated in advance for creating the virtual machine, so that the storage resource is saved.
It should be noted that the virtual machine is created by an image file. If all the virtual machines created based on the image file need to be closed or eliminated, all the virtual machines created based on the image file can be closed or eliminated only by automatically inquiring the virtual machines with the identification information of the image file and carrying out batch operation, so that the batch operation of creating the virtual machines through the same image is realized, and the time cost and the storage resources of the server are saved.
According to the technical scheme of the embodiment of the invention, the number of the current total created virtual machines corresponding to the current server is limited by using the first number threshold, the situation that the server is stuck or crashed due to the fact that the number of the created virtual machines and the number of the operated virtual machines exceed the bearing range of the server is avoided, the number of the virtual machines to be created at present is limited by using the second number threshold, the situation that when too many virtual machines are created at the same time, a CPU of the server is continuously sharp and high to form stuck, the situation that other completely created virtual machines are influenced is avoided, meanwhile, the situation that the number of the virtual machines created at the same time by the server does not exceed the maximum number which can be borne by the server is avoided, the situation that the number of the created virtual machines exceeds the maximum number limit at the same time to cause the stuck or even crashed of the server is avoided, and the user experience is further improved.
EXAMPLE III
Fig. 3 is a flowchart of a virtual machine creation method provided by a third embodiment of the present invention, and this embodiment provides a preferred implementation manner. Wherein explanations of the same or corresponding terms as those of the above embodiments are omitted. As shown in fig. 3, the method includes:
s310, receiving a virtual machine creation request.
S320, traversing all servers, and determining whether undetected servers exist according to the arrangement sequence of the servers. If yes, go to S330; if not, go to S391.
It should be noted that the virtual machine that quits creating may send the virtual machine creating request to the controller again based on the virtual machine that is not created after the virtual machine creating request is completely executed for a period of time.
S330, taking the undetected server as a current server for creating the virtual machines, and acquiring current server state information, current server type information, the current total created virtual machine number, the current virtual machine number to be created and the current server residual resource information corresponding to the current server.
S340, detecting whether the current server state information is available. If yes, executing 350 to carry out the next detection; if not, go to S320.
And S350, detecting whether the current server type information accords with the type required by the target virtual machine. If yes, executing 360 to carry out the next detection; if not, go to S320.
And S360, detecting whether the number of the current total creation virtual machines reaches a preset creation upper limit corresponding to the current server.
If not, executing 370 to perform the next detection; if yes, go to S320.
And S370, detecting whether the number of the virtual machines to be created currently reaches the preset upper limit to be created corresponding to the current server.
If not, executing S380 to carry out the next detection; if yes, go to S320.
And S380, detecting whether the current server residual resource information can support the creation of the target virtual machine. If yes, go to step S390, otherwise go to step S320.
And S390, creating a target virtual machine in the current server.
And S391, quitting creation.
According to the embodiment of the invention, in the virtual machine creating process, a virtual machine creating requester does not need to pay attention to the creation of the virtual machine, and only needs to provide the relevant information for creating the virtual machine, so that the resource use condition of the server is combined on the basis of simplifying the virtual machine creating process, and the blocking and even collapse conditions of the server are greatly reduced by controlling the virtual machine creating frequency.
The following is an embodiment of a virtual machine creation apparatus provided in an embodiment of the present invention, and the apparatus and the virtual machine creation method in the foregoing embodiments belong to the same inventive concept, and details that are not described in detail in the embodiment of the virtual machine creation apparatus may refer to the embodiment of the virtual machine creation method described above.
Example four
Fig. 4 is a schematic structural diagram of a virtual machine creating apparatus according to a fourth embodiment of the present invention. As shown in fig. 4, the apparatus includes: a request receiving module 410, a server state obtaining module 420, a server information obtaining module 430, and a virtual machine creating module 440.
The request receiving module 410 is configured to receive a virtual machine creation request, where the virtual machine creation request includes: the method comprises the steps that target virtual machine type information corresponding to a target virtual machine to be created currently and target virtual machine resource information required when the target virtual machine is created; a server state obtaining module 420, configured to obtain current server state information corresponding to a current server used for creating a virtual machine; a server information obtaining module 430, configured to obtain current server type information and current server remaining resource information corresponding to a current server if it is detected that current server state information is available state information; the virtual machine creating module 440 is configured to create a target virtual machine on the current server if it is detected that the current server type information matches the target virtual machine type information and the current server remaining resource information is greater than or equal to the target virtual machine resource information.
According to the technical scheme of the embodiment of the invention, the virtual machine creation request is received, and comprises the following steps: the method comprises the steps that target virtual machine type information corresponding to a target virtual machine to be created currently and target virtual machine resource information required when the target virtual machine is created; acquiring current server state information corresponding to a current server for creating a virtual machine; if the current server state information is detected to be available state information, current server type information and current server residual resource information corresponding to the current server are obtained; if the type information of the current server is matched with the type information of the target virtual machine and the residual resource information of the current server is larger than or equal to the resource information of the target virtual machine, the target virtual machine is established on the current server so as to reasonably establish the virtual machine on the server based on the actual resource condition of the server, thereby ensuring the successful establishment of the virtual machine, avoiding the occurrence of the condition of server blocking or rushing, and improving the user experience.
Optionally, the apparatus further comprises:
the current server determining module is used for determining a first server in the server cluster as a current server for creating the virtual machine before acquiring current server state information corresponding to the current server for creating the virtual machine;
and the current server changing module is used for returning and executing the operation of acquiring the current server state information corresponding to the current server for creating the virtual machine by taking the next server of the current server as the current server based on the server arrangement sequence corresponding to the server cluster if the current server state information is detected to be the non-available state information, the current server type information is not matched with the target virtual machine type information, or the remaining resource information of the current server is smaller than the target virtual machine resource information.
Optionally, the apparatus further comprises:
and the re-traversing server module is used for re-traversing and matching the servers in the server cluster after a preset time interval if all the servers in the server cluster do not meet the condition of creating the target virtual machine until the target virtual machine is created in the target server meeting the condition.
Optionally, the virtual machine creating module 440 may include:
the current server number obtaining submodule is used for obtaining the number of current total virtual machines to be created and the number of virtual machines to be created corresponding to the current server;
and the target virtual machine creating submodule is used for creating the target virtual machine on the current server if the fact that the number of the current total created virtual machines is smaller than a first number threshold and the number of the current virtual machines to be created is smaller than a second number threshold is detected.
Optionally, the server information obtaining module 430 is specifically configured to:
and if the current server state information is detected to be the server state of the allocable resources except the server restart state, the software installation state and the software upgrading state, acquiring the current server type information and the current server residual resource information corresponding to the current server.
Optionally, the virtual machine creation request further includes: identifying information of a target image file corresponding to the target virtual machine; the virtual machine creation module 440 is specifically configured to: acquiring a target image file corresponding to the identification information of the target image file; and creating a target virtual machine on the current server by running the target image file.
Optionally, the target virtual machine resource information includes: the number of CPU cores, the size of an operating memory and the size of a display card memory corresponding to the target virtual machine;
the current server remaining resource information includes: the residual CPU core number, the residual operation memory size and the residual display card memory size corresponding to the current server.
The virtual machine creation device provided by the embodiment of the invention can execute the virtual machine creation method provided by any embodiment of the invention, and has corresponding functional modules and beneficial effects of the execution method.
It should be noted that, in the embodiment of the virtual machine creation apparatus, each module included in the embodiment is only divided according to functional logic, but is not limited to the above division as long as the corresponding function can be implemented; in addition, the specific names of the functional modules are only for the convenience of distinguishing from each other, and are not used for limiting the protection scope of the present invention.
EXAMPLE five
FIG. 5 illustrates a schematic diagram of an electronic device 10 that may be used to implement an embodiment of the invention. Electronic devices are intended to represent various forms of digital computers, such as laptops, desktops, workstations, personal digital assistants, servers, blade servers, mainframes, and other appropriate computers. The electronic device may also represent various forms of mobile devices, such as personal digital assistants, cellular phones, smart phones, wearable devices (e.g., helmets, glasses, watches, etc.), and other similar computing devices. The components shown herein, their connections and relationships, and their functions, are meant to be exemplary only, and are not meant to limit implementations of the inventions described and/or claimed herein.
As shown in fig. 5, the electronic device 10 includes at least one processor 11, and a memory communicatively connected to the at least one processor 11, such as a Read Only Memory (ROM) 12, a Random Access Memory (RAM) 13, and the like, wherein the memory stores a computer program executable by the at least one processor, and the processor 11 can perform various suitable actions and processes according to the computer program stored in the Read Only Memory (ROM) 12 or the computer program loaded from a storage unit 18 into the Random Access Memory (RAM) 13. In the RAM 13, various programs and data necessary for the operation of the electronic apparatus 10 may also be stored. The processor 11, the ROM 12, and the RAM 13 are connected to each other via a bus 14. An input/output (I/O) interface 15 is also connected to bus 14.
A number of components in the electronic device 10 are connected to the I/O interface 15, including: an input unit 16 such as a keyboard, a mouse, or the like; an output unit 17 such as various types of displays, speakers, and the like; a storage unit 18 such as a magnetic disk, an optical disk, or the like; and a communication unit 19 such as a network card, modem, wireless communication transceiver, etc. The communication unit 19 allows the electronic device 10 to exchange information/data with other devices via a computer network such as the internet and/or various telecommunication networks.
The processor 11 may be a variety of general and/or special purpose processing components having processing and computing capabilities. Some examples of processor 11 include, but are not limited to, a Central Processing Unit (CPU), a Graphics Processing Unit (GPU), various specialized Artificial Intelligence (AI) computing chips, various processors running machine learning model algorithms, a Digital Signal Processor (DSP), and any suitable processor, controller, microcontroller, or the like. The processor 11 performs the various methods and processes described above, such as the virtual machine creation method.
In some embodiments, the virtual machine creation method may be implemented as a computer program tangibly embodied in a computer-readable storage medium, such as storage unit 18. In some embodiments, part or all of the computer program may be loaded and/or installed onto the electronic device 10 via the ROM 12 and/or the communication unit 19. When the computer program is loaded into RAM 13 and executed by processor 11, one or more steps of the virtual machine creation method described above may be performed. Alternatively, in other embodiments, the processor 11 may be configured to perform the virtual machine creation method by any other suitable means (e.g., by means of firmware).
Various implementations of the systems and techniques described here above may be implemented in digital electronic circuitry, integrated circuitry, field Programmable Gate Arrays (FPGAs), application Specific Integrated Circuits (ASICs), application Specific Standard Products (ASSPs), system on a chip (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and/or combinations thereof. These various embodiments may include: implemented in one or more computer programs that are executable and/or interpretable on a programmable system including at least one programmable processor, which may be special or general purpose, receiving data and instructions from, and transmitting data and instructions to, a storage system, at least one input device, and at least one output device.
A computer program for implementing the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general purpose computer, special purpose computer, or other programmable data processing apparatus, such that the computer programs, when executed by the processor, cause the functions/acts specified in the flowchart and/or block diagram block or blocks to be performed. A computer program can execute entirely on a machine, partly on a machine, as a stand-alone software package partly on a machine and partly on a remote machine or entirely on a remote machine or server.
In the context of the present invention, a computer-readable storage medium may be a tangible medium that can contain, or store a computer program for use by or in connection with an instruction execution system, apparatus, or device. A computer readable storage medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. Alternatively, the computer readable storage medium may be a machine readable signal medium. More specific examples of a machine-readable storage medium would include an electrical connection based on one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
To provide for interaction with a user, the systems and techniques described here can be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to a user; and a keyboard and a pointing device (e.g., a mouse or a trackball) by which a user can provide input to the electronic device. Other kinds of devices may also be used to provide for interaction with a user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form, including acoustic, speech, or tactile input.
The systems and techniques described here can be implemented in a computing system that includes a back-end component (e.g., as a data server), or that includes a middleware component (e.g., an application server), or that includes a front-end component (e.g., a user computer having a graphical user interface or a web browser through which a user can interact with an implementation of the systems and techniques described here), or any combination of such back-end, middleware, or front-end components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: local Area Networks (LANs), wide Area Networks (WANs), blockchain networks, and the internet.
The computing system may include clients and servers. A client and server are generally remote from each other and typically interact through a communication network. The relationship of client and server arises by virtue of computer programs running on the respective computers and having a client-server relationship to each other. The server can be a cloud server, also called a cloud computing server or a cloud host, and is a host product in a cloud computing service system, so that the defects of high management difficulty and weak service expansibility in the traditional physical host and VPS service are overcome.
It should be understood that various forms of the flows shown above, reordering, adding or deleting steps, may be used. For example, the steps described in the present invention may be executed in parallel, sequentially, or in different orders, and are not limited herein as long as the desired result of the technical solution of the present invention can be achieved.
The above-described embodiments should not be construed as limiting the scope of the invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions may be made in accordance with design requirements and other factors. Any modification, equivalent replacement, and improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.

Claims (10)

1. A virtual machine creation method, comprising:
receiving a virtual machine creation request, the virtual machine creation request comprising: the method comprises the steps that target virtual machine type information corresponding to a target virtual machine to be created currently and target virtual machine resource information required when the target virtual machine is created are obtained;
acquiring current server state information corresponding to a current server for creating a virtual machine;
if the current server state information is detected to be available state information, current server type information and current server residual resource information corresponding to the current server are obtained;
and if the current server type information is matched with the target virtual machine type information and the current server residual resource information is greater than or equal to the target virtual machine resource information, establishing the target virtual machine on the current server.
2. The method of claim 1, prior to obtaining current server state information corresponding to a current server used to create the virtual machine, further comprising:
determining a first server in the server cluster as a current server for creating the virtual machine;
the method further comprises the following steps:
and if the current server state information is detected to be non-available state information, the current server type information is not matched with the target virtual machine type information, or the remaining resource information of the current server is smaller than the target virtual machine resource information, based on the server arrangement sequence corresponding to the server cluster, taking the next server of the current server as the current server, and returning to execute the operation of acquiring the current server state information corresponding to the current server for creating the virtual machine.
3. The method of claim 2, further comprising:
and if all the servers in the server cluster do not meet the condition for creating the target virtual machine, traversing and matching the servers in the server cluster again after a preset time interval until the target virtual machine is created in the target server meeting the condition.
4. The method of claim 1, wherein creating the target virtual machine on the current server comprises:
acquiring the number of current total created virtual machines and the number of current virtual machines to be created corresponding to the current server;
and if the current total created virtual machine number is smaller than a first number threshold value and the current virtual machine number to be created is smaller than a second number threshold value, creating the target virtual machine on the current server.
5. The method of claim 1, wherein if it is detected that the current server status information is available status information, acquiring current server type information and current server remaining resource information corresponding to the current server comprises:
and if the current server state information is detected to be the server state of the allocable resources except the server restart state, the software installation state and the software upgrading state, acquiring the current server type information and the current server residual resource information corresponding to the current server.
6. The method of claim 1, wherein the virtual machine creation request further comprises: identifying information of a target image file corresponding to the target virtual machine;
creating the target virtual machine on the current server, comprising:
acquiring a target image file corresponding to the identification information of the target image file;
and creating the target virtual machine on the current server by operating the target image file.
7. The method of any of claims 1-6, wherein the target virtual machine resource information comprises: the number of CPU cores, the size of an operating memory and the size of a display card memory corresponding to the target virtual machine;
the current server remaining resource information includes: the residual CPU core number, the residual operation memory size and the residual display card memory size corresponding to the current server.
8. A virtual machine creation apparatus, comprising:
a request receiving module, configured to receive a virtual machine creation request, where the virtual machine creation request includes: the method comprises the steps that target virtual machine type information corresponding to a target virtual machine to be created currently and target virtual machine resource information required when the target virtual machine is created;
the server state acquisition module is used for acquiring current server state information corresponding to a current server for creating the virtual machine;
the server information acquisition module is used for acquiring current server type information and current server residual resource information corresponding to the current server if the current server state information is detected to be available state information;
and the virtual machine creating module is used for creating the target virtual machine on the current server if the current server type information is matched with the target virtual machine type information and the current server residual resource information is greater than or equal to the target virtual machine resource information.
9. An electronic device, characterized in that the electronic device comprises:
at least one processor; and
a memory communicatively coupled to the at least one processor; wherein, the first and the second end of the pipe are connected with each other,
the memory stores a computer program executable by the at least one processor to enable the at least one processor to perform the virtual machine creation method of any one of claims 1-7.
10. A computer-readable storage medium storing computer instructions for causing a processor to implement the virtual machine creation method of any one of claims 1 to 7 when executed.
CN202211104740.0A 2022-09-09 2022-09-09 Virtual machine creating method, device, equipment and storage medium Pending CN115390992A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211104740.0A CN115390992A (en) 2022-09-09 2022-09-09 Virtual machine creating method, device, equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211104740.0A CN115390992A (en) 2022-09-09 2022-09-09 Virtual machine creating method, device, equipment and storage medium

Publications (1)

Publication Number Publication Date
CN115390992A true CN115390992A (en) 2022-11-25

Family

ID=84127378

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211104740.0A Pending CN115390992A (en) 2022-09-09 2022-09-09 Virtual machine creating method, device, equipment and storage medium

Country Status (1)

Country Link
CN (1) CN115390992A (en)

Similar Documents

Publication Publication Date Title
CN114328098B (en) Slow node detection method and device, electronic equipment and storage medium
KR20210156243A (en) Training methods of deep-running frameworks, devices and storage media
CN114936173B (en) Read-write method, device, equipment and storage medium of eMMC device
CN114968567A (en) Method, apparatus and medium for allocating computing resources of a compute node
CN111125057A (en) Service request processing method and device and computer system
CN113778644A (en) Task processing method, device, equipment and storage medium
CN113760638A (en) Log service method and device based on kubernets cluster
CN113377295B (en) Data storage and reading method, device and equipment for multi-producer single-consumer
CN115658311A (en) Resource scheduling method, device, equipment and medium
CN115756828A (en) Multithreading data file processing method, equipment and medium
CN115390992A (en) Virtual machine creating method, device, equipment and storage medium
CN111488316B (en) File cache recovery method and device
CN114416357A (en) Method and device for creating container group, electronic equipment and medium
CN113747423A (en) Cloud mobile phone state synchronization method, device, equipment, storage medium and program product
CN113656239A (en) Monitoring method and device for middleware and computer program product
CN114816758B (en) Resource allocation method and device
CN114546705B (en) Operation response method, operation response device, electronic apparatus, and storage medium
CN115617616A (en) Operation monitoring method, device and equipment of server FRU and storage medium
CN116775299A (en) Verification code picture acquisition method and device, electronic equipment and storage medium
CN115934246A (en) Virtual machine creating method, device, equipment and medium
CN114706578A (en) Data processing method, device, equipment and medium
CN115061817A (en) Operation and maintenance method, device, system and computer program product
CN115454660A (en) Task management method and device, electronic equipment and storage medium
CN115495312A (en) Service request processing method and device
CN115913954A (en) Cluster management information interaction method, device, equipment and storage 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
CB02 Change of applicant information
CB02 Change of applicant information

Address after: 518000 702, block 5D, software industry base, 14 Haitian 2nd Road, Binhai community, Yuehai street, Nanshan District, Shenzhen City, Guangdong Province

Applicant after: Shenzhen Weike Software Technology Co.,Ltd.

Address before: 518000 7022, block 5D, software industry base, No. 14, Haitian Second Road, Binhai community, Yuehai street, Nanshan District, Shenzhen, Guangdong

Applicant before: Shenzhen Weike Software Technology Co.,Ltd.