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

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

Info

Publication number
CN115934246A
CN115934246A CN202211369850.XA CN202211369850A CN115934246A CN 115934246 A CN115934246 A CN 115934246A CN 202211369850 A CN202211369850 A CN 202211369850A CN 115934246 A CN115934246 A CN 115934246A
Authority
CN
China
Prior art keywords
machine room
resource information
current
virtual machine
current machine
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
CN202211369850.XA
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 CN202211369850.XA priority Critical patent/CN115934246A/en
Publication of CN115934246A publication Critical patent/CN115934246A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The invention discloses a virtual machine creating method, a virtual machine creating device, virtual machine creating equipment and a virtual machine creating medium. The method comprises the following steps: receiving a virtual machine creation request, the virtual machine creation request comprising: target virtual machine resource information required by a current target virtual machine to be created; traversing a plurality of machine rooms, and acquiring current machine room available resource information and current machine room pre-allocation resource information corresponding to the current machine room traversed currently; determining the residual resource information of the current machine room corresponding to the current machine room based on the available resource information of the current machine room and the pre-distributed resource information of the current machine room; and if the detected residual resource information of the current machine room is greater than or equal to the resource information of the target virtual machine, distributing the target virtual machine to the current machine room for creation, so that the creation power of the virtual machine is improved in a multi-machine room scene.

Description

Virtual machine creating method, device, equipment and 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 medium for creating a virtual machine.
Background
With the development of computer technology, the use of virtual machines is becoming more and more common. The virtual machine is usually created in a physical machine of a computer room and used. At present, the process of creating virtual machines in a multi-machine room scene is performed asynchronously, that is, each machine room can create multiple virtual machines at the same time, so as to improve the virtual machine creation efficiency.
However, in a multi-computer-room scenario, there may be a case of creating failure in the manner of using the virtual machine creation, so that the power of creating the virtual machine is reduced, and the virtual machine that is not successfully created needs to be manually re-checked and determined and re-created, which is time-consuming and labor-consuming, and greatly reduces the user experience.
Disclosure of Invention
The invention provides a virtual machine creation method, a virtual machine creation device, virtual machine creation equipment and a virtual machine creation medium, which are used for improving the virtual machine creation power under a multi-computer-room scene.
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: target virtual machine resource information required by a target virtual machine to be created currently;
traversing a plurality of machine rooms, and acquiring current machine room available resource information and current machine room pre-allocation resource information corresponding to the current machine room traversed currently;
determining the residual resource information of the current machine room corresponding to the current machine room based on the available resource information of the current machine room and the pre-allocated resource information of the current machine room;
and if the fact that the residual resource information of the current machine room is larger than or equal to the resource information of the target virtual machine is detected, the target virtual machine is distributed to the current machine room to be created.
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: target virtual machine resource information required by a current target virtual machine to be created;
the resource information acquisition module is used for traversing a plurality of machine rooms and acquiring current machine room available resource information corresponding to the current machine room traversed currently and current machine room pre-allocation resource information;
a residual resource determining module, configured to determine, based on the current available resource information of the machine room and the pre-allocated resource information of the current machine room, residual resource information of the current machine room corresponding to the current machine room;
and the virtual machine allocation module is used for allocating the target virtual machine to the current machine room for creation if the condition that the residual resource information of the current machine room is greater than or equal to the resource information of the target virtual machine is detected.
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 of the embodiments of the 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 one of the embodiments 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: target virtual machine resource information required by a target virtual machine to be created currently; traversing a plurality of machine rooms, and acquiring current machine room available resource information and current machine room pre-allocation resource information corresponding to the current machine room traversed currently; determining the residual resource information of the current machine room corresponding to the current machine room based on the available resource information of the current machine room and the pre-allocated resource information of the current machine room; if the fact that the residual resource information of the current machine room is larger than or equal to the resource information of the target virtual machine is detected, the target virtual machine is allocated to the current machine room for creation, so that the machine rooms capable of allocating and creating the target virtual machine can be automatically selected from the multiple machine rooms based on the actually available resource information of the machine rooms, manual operation is avoided, the allocation efficiency and accuracy of the target virtual machine are improved, and the creation power of the virtual machine can be improved under the scene of multiple machine rooms.
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 needed to be used in the description of the embodiments will be briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without creative efforts.
Fig. 1 is a flowchart of a virtual machine creating method according to an embodiment of the present invention;
fig. 2 is a flowchart of a virtual machine creating method according to a second embodiment of the present invention;
fig. 3 is a schematic structural diagram of a virtual machine creating apparatus according to a third embodiment of the present invention;
fig. 4 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 sequences other than those illustrated or described herein. Moreover, 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 creating method according to an embodiment of the present invention, where the embodiment is applicable to a case where a virtual machine is created in a multi-computer-room scenario, and the method may be executed by a virtual machine creating apparatus, where the virtual machine creating apparatus may be implemented in a form of hardware and/or software, and the virtual machine creating apparatus may be configured 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: and target virtual machine resource information required by the current target virtual machine to be 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, virtualBox, virtualPC, or the like. The target virtual machine may refer to a virtual machine currently to be created. The number of target virtual machines may be one or more. The target virtual machine resource information may include a hard disk memory size required for creating the target virtual machine, a running memory size required for running the target virtual machine, and a Central Processing Unit (CPU) core number.
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 the scheduling server; the dispatch server may be used to assign and create the target virtual machine to the room. The scheduling server may determine, based on the received virtual machine creation request, a size of a hard disk memory required to create the target virtual machine, a size of a running memory required when the target virtual machine runs, and a Central Processing Unit (CPU) core number.
And S120, traversing the plurality of machine rooms, and acquiring the available resource information of the current machine room corresponding to the current machine room traversed currently and the pre-allocated resource information of the current machine room.
The current machine room may refer to a machine room in which virtual machine creation task allocation is performed. The available resource information of the current computer room may refer to resource information available for creating a virtual machine in the current computer room. The available resources of the current computer room may be, but are not limited to, the size of the hard disk memory, the size of the operating memory, and the number of CPU cores available in the current computer room. The pre-allocation resource information of the current computer room may refer to resource information required for executing a virtual machine creation task allocated to the current computer room. The information of the pre-allocated resources of the current computer room can be, but is not limited to, the size of the hard disk memory of the current computer room, the size of the running memory and the number of the CPU cores required for executing the virtual machine creation task allocated to the current computer room.
Specifically, traversing a plurality of machine rooms, selecting one machine room as a current machine room, and acquiring available resource information of the current machine room corresponding to the current machine room traversed by the current machine room and pre-allocated resource information of the current machine room based on a machine room resource information traversal result. For example, a plurality of machine rooms are traversed, an idle machine room can be used as a current machine room, and available resource information of the current machine room corresponding to the current machine room traversed and pre-distributed resource information of the current machine room are obtained based on a machine room resource information traversal result. The current machine room available resource information can comprise a hard disk memory 100GB, an operating memory 16GB and a 32-core CPU. The information of pre-allocated resources of the current machine room can comprise a hard disk memory 50GB, an operation memory 8GB and a 16-core CPU.
Exemplarily, the "traversing multiple rooms" in S120 may include: determining a first machine room as a current machine room traversed for the first time; and if the fact that the residual resource information of the current machine room is smaller than the resource information of the target virtual machine is detected, based on a preset machine room sequence, taking the next machine room of the current machine room as the current machine room traversed next time.
The preset machine room sequence may be a sequence formed by preset machine room traversal sequences.
Specifically, in the process of traversing a plurality of machine rooms, a first machine room can be determined as a current machine room traversed for the first time, and available resource information of the current machine room corresponding to the current machine room traversed and pre-allocated resource information of the current machine room are obtained; and determining the residual resource information of the current machine room based on the available resource information of the current machine room corresponding to the current machine room and the pre-allocated resource information of the current machine room. Comparing the residual resource information of the current machine room with the resource information of the target virtual machine; if the fact that the residual resource information of the current machine room is smaller than the resource information of the target virtual machine is detected, and the fact that resources for creating the target virtual machine do not exist in the current machine room is indicated, based on a preset machine room sequence, the next machine room of the current machine room is used as the current machine room traversed next time, and the operations from S120 to S140 are repeated until the machine room which can be used for creating the target virtual machine is determined, so that machine rooms which can be distributed and used for creating the target virtual machine can be automatically selected from a plurality of machine rooms based on creating conditions, manual operation is avoided, and the distributing efficiency and the distributing accuracy of the target virtual machine are improved.
S130, determining the residual resource information of the current machine room corresponding to the current machine room based on the available resource information of the current machine room and the pre-distributed resource information of the current machine room.
The resource information of the current machine room may refer to resource information of the current machine room remaining after all tasks in the virtual machine creation queue are executed.
Specifically, the available resource information of the current machine room and the pre-allocated resource information of the current machine room are subtracted, and the remaining resource information of the current machine room corresponding to the current machine room is determined.
And S140, if the fact that the residual resource information of the current machine room is larger than or equal to the resource information of the target virtual machine is detected, the target virtual machine is allocated to the current machine room to be created.
Specifically, if it is detected that the remaining resource information of the current machine room is greater than or equal to the resource information of the target virtual machine, the target virtual machine is allocated to the current machine room for creation.
For example, the current available resource information of the machine room may include 100GB of a hard disk memory, 16GB of a running memory, and 32-core CPU; the pre-allocated resource information of the current machine room can comprise a hard disk memory 50GB, an operating memory 8GB and a 16-core CPU; through subtraction processing, the remaining resource information of the current machine room can be determined, and the remaining resource information can include a hard disk memory 50GB, an operating memory 8GB and a 16-core CPU. If the resource information of the target virtual machine can include 25GB of hard disk memory, 4GB of running memory and 8-core CPU, two target virtual machines can be allocated to the current machine room for creation.
It should be noted that Mi may be used to represent pre-allocation resource information of the ith machine room. There are n virtual machine creation tasks in the queue in the ith machine room. The resource information required by the jth virtual machine queued to be created in the ith computer room can be represented by Vij. The machine room pre-allocation resource information of the ith machine room can be identified as follows:
Mi=∑Vij(1≤j≤n)
namely, the pre-allocation resource information of the machine room in the ith machine room is the sum of the resource information required by all the virtual machines waiting to be created in the ith machine room.
According to the technical scheme of the embodiment of the invention, the virtual machine creation request is received, and comprises the following steps: target virtual machine resource information required by a target virtual machine to be created currently; traversing a plurality of machine rooms, and acquiring current machine room available resource information and current machine room pre-allocation resource information corresponding to the current machine room traversed currently; determining the residual resource information of the current machine room corresponding to the current machine room based on the available resource information of the current machine room and the pre-distributed resource information of the current machine room; if the fact that the residual resource information of the current machine room is larger than or equal to the resource information of the target virtual machine is detected, the target virtual machine is allocated to the current machine room for creation, so that the machine rooms capable of allocating and creating the target virtual machine can be automatically selected from the multiple machine rooms based on the actually available resource information of the machine rooms, manual operation is avoided, the allocation efficiency and accuracy of the target virtual machine are improved, and the creation power of the virtual machine can be improved under the scene of multiple machine rooms.
On the basis of the technical scheme, the method further comprises the following steps: and if the last traversed current machine room residual resource information corresponding to the current machine room is smaller than the target virtual machine resource information, traversing the plurality of machine rooms again after a preset time interval until the machine room which meets the condition that the current machine room residual resource information is larger than or equal to the target virtual machine resource information is obtained.
Specifically, if the last traversed current machine room remaining resource information corresponding to the current machine room is less than the target virtual machine resource information, it is indicated that the current machine room is not allocated with the target virtual machine creation task, and after a preset time period, the multiple machine rooms need to be traversed again until the machine room meeting the condition that the current machine room remaining resource information is greater than or equal to the target virtual machine resource information is obtained, so that manual participation is not needed until all the target virtual machine creation tasks are completely allocated.
Example two
Fig. 2 is a flowchart of a virtual machine creating method according to a second embodiment of the present invention, where this embodiment describes in detail a process of determining remaining resource information of a current machine room corresponding to the current machine room based on available resource information of the current machine room and pre-allocated resource information of the current machine room on the basis of the above 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: and target virtual machine resource information required by the current target virtual machine to be created.
S220, traversing the plurality of machine rooms, and acquiring the available resource information of the current machine room corresponding to the current machine room traversed currently and the pre-allocated resource information of the current machine room.
For example, the current machine room available resource information may include 100GB of hard disk memory, 16GB of running memory, and 32-core CPU. The information of pre-allocated resources of the current machine room can comprise a hard disk memory 50GB, an operation memory 8GB and a 16-core CPU.
For example, the step S220 of "obtaining the available resource information of the current machine room corresponding to the current machine room traversed currently" may include: acquiring available resource information of a current physical machine corresponding to each physical machine in a current machine room traversed currently; and adding the current physical machine available resource information corresponding to all the physical machines to obtain the current machine room available resource information corresponding to the current machine room.
In particular, there may be at least one physical machine in each room. And acquiring the available resource information of the current physical machine corresponding to each physical machine in the current machine room traversed currently. For example, two physical machines with the same total resources exist in the current machine room; the information of the current available resource of the physical machine corresponding to the first physical machine may be, but is not limited to, 50GB of hard disk memory, 8GB of running memory, and 16-core CPU. The current available resource information of the physical machines corresponding to all the physical machines is added to obtain the current available resource information of the machine room corresponding to the current machine room, so that the current available resource information of the machine room corresponding to the current machine room can be determined based on each physical machine, the current available resource information of the machine room is prevented from being directly obtained, and the accuracy is improved. For example, the available resource information of the current machine room corresponding to the current machine room may be, but is not limited to, the hard disk memory 100GB, the operating memory 16GB, and the 32-core CPU.
For example, the step S220 of "obtaining the pre-allocated resource information of the current machine room corresponding to the current machine room traversed currently" may include: acquiring a virtual machine creation queue corresponding to a current machine room traversed currently, wherein the virtual machine creation queue comprises at least one virtual machine creation task; and adding the resource information required by the virtual machine creation in each virtual machine creation task to obtain the pre-distributed resource information of the current machine room corresponding to the current machine room.
The virtual machine creation queue may include a task that is performing a virtual machine creation operation and a task that is waiting to perform the virtual machine creation operation. After the task that is executing the virtual machine creation operation is executed, the available resource information of the current machine room corresponding to the current machine room can be updated.
In particular, there may be at least one physical machine in each room. And acquiring a virtual machine creation queue corresponding to the current machine room traversed currently. For example, two same virtual machines are created in the current machine room; the resource information required for creating the virtual machine in the first virtual machine creation task may be, but is not limited to, a hard disk memory 25GB, a running memory 4GB, and an 8-core CPU. The resource information required by the virtual machine creation in each virtual machine creation task is added to obtain the pre-allocation resource information of the current machine room corresponding to the current machine room, so that the pre-allocation resource information of the current machine room corresponding to the current machine room can be determined based on each physical machine, the pre-allocation resource information of the current machine room of the machine room is prevented from being directly obtained, and the accuracy is improved. For example, the information of the pre-allocated resources of the current machine room corresponding to the current machine room may be, but is not limited to, 50GB of hard disk memory, 8GB of running memory, and 16-core CPU.
S230, acquiring current machine room operation resource information required when the current machine room operates the non-virtual machine task; adding the pre-distributed resource information of the current machine room and the operating resource information of the current machine room, and subtracting the available resource information of the current machine room from the addition result to obtain the residual resource information of the current machine room corresponding to the current machine room.
The current machine room running resource information may be resource information required when the current machine room normally runs a non-virtual machine task. For example, the current machine room operation resource information may be, but is not limited to, an operation memory.
Specifically, each physical machine may need to run non-virtual machine tasks in addition to running virtual machines. In order to ensure that the physical machine can normally run virtual machine tasks and non-virtual machine tasks at the same time. The method can obtain the current machine room running resource information required when the current machine room runs the non-virtual machine task, such as 2GB of running memory; and adding the pre-allocated resource information of the current machine room and the operating resource information of the current machine room, and subtracting the available resource information of the current machine room from the addition result to obtain the residual resource information of the current machine room corresponding to the current machine room. For example, the remaining resource information of the current machine room corresponding to the current machine room may be, but is not limited to, 50GB, 6GB of running memory, and 16-core CPU.
And S240, if the detected residual resource information of the current machine room is greater than or equal to the resource information of the target virtual machine, allocating the target virtual machine to the current machine room for creation.
For example, the information of the pre-allocated resources of the current machine room may include a hard disk memory 50GB, an operating memory 8GB, and a 16-core CPU; the current machine room operation resource information comprises an operation memory 2GB; through addition processing, subtraction processing is carried out on the available resource information of the current machine room and the processing result, and the residual resource information of the current machine room corresponding to the current machine room can be obtained; the available resource information of the current machine room can comprise a hard disk memory 100GB, an operation memory 16GB and a 32-core CPU; the current machine room residual resource information can comprise a hard disk memory 50GB, an operation memory 6GB and a 16-core CPU; if the resource information of the target virtual machine may include 25GB of the hard disk memory, 4GB of the operating memory, and 8-core CPU, one target virtual machine may be allocated to the current machine room for creation, and the next machine room is used as the current machine room, and the operations from S220 to S240 are executed until all the virtual machine tasks are allocated to the machine room for creation.
According to the technical scheme of the embodiment of the invention, the information of the current machine room running resources required when the current machine room runs the non-virtual machine task is obtained; and adding the pre-allocated resource information of the current machine room and the operating resource information of the current machine room, and subtracting the available resource information of the current machine room from the addition result to obtain the residual resource information of the current machine room corresponding to the current machine room. If the residual resource information of the current machine room is detected to be larger than or equal to the resource information of the target virtual machine, the target virtual machine is allocated to the current machine room for creation, so that the non-virtual machine task can be operated in the physical machine while the normal operation of the virtual machine is ensured, the utilization rate of the physical machine is improved, the target virtual machine is reasonably allocated to the machine room, the allocation efficiency and accuracy of the target virtual machine are further improved, and the creation power of the virtual machine can be further improved in a multi-machine room scene.
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 III
Fig. 3 is a schematic structural diagram of a virtual machine creating apparatus according to a third embodiment of the present invention. As shown in fig. 3, the apparatus includes: a request receiving module 310, a resource information obtaining module 320, a remaining resource determining module 330, and a virtual machine allocating module 340.
The request receiving module 310 is configured to receive a virtual machine creation request, where the virtual machine creation request includes: target virtual machine resource information required by a target virtual machine to be created currently; the resource information acquisition module 320 is configured to traverse multiple computer rooms, and acquire current computer room available resource information and current computer room pre-allocation resource information corresponding to a current computer room traversed currently; the residual resource determining module 330 is configured to determine, based on the current available resource information of the machine room and the pre-allocated resource information of the current machine room, current machine room residual resource information corresponding to the current machine room; and the virtual machine allocation module 340 is configured to allocate the target virtual machine to the current machine room for creation if it is detected that the remaining resource information of the current machine room is greater than or equal to the resource information of the target virtual machine.
According to the technical scheme of the embodiment of the invention, the virtual machine creation request is received, and comprises the following steps: target virtual machine resource information required by a target virtual machine to be created currently; traversing a plurality of machine rooms, and acquiring current machine room available resource information and current machine room pre-allocation resource information corresponding to the current machine room traversed currently; determining the residual resource information of the current machine room corresponding to the current machine room based on the available resource information of the current machine room and the pre-allocated resource information of the current machine room; if the fact that the residual resource information of the current machine room is larger than or equal to the resource information of the target virtual machine is detected, the target virtual machine is allocated to the current machine room for creation, so that the machine rooms capable of allocating and creating the target virtual machine can be automatically selected from the multiple machine rooms based on the actually available resource information of the machine rooms, manual operation is avoided, the allocation efficiency and accuracy of the target virtual machine are improved, and the creation power of the virtual machine can be improved under the scene of multiple machine rooms.
Optionally, the resource information obtaining module 320 is specifically configured to: determining a first machine room as a current machine room traversed for the first time; and if the detected residual resource information of the current machine room is smaller than the resource information of the target virtual machine, based on a preset machine room sequence, taking the next machine room of the current machine room as the current machine room traversed next time.
Optionally, the apparatus further comprises:
and the re-traversing module is used for re-traversing the plurality of machine rooms after a preset time interval if the residual resource information of the current machine room corresponding to the last traversed current machine room is less than the resource information of the target virtual machine until the machine room meeting the condition that the residual resource information of the current machine room is greater than or equal to the resource information of the target virtual machine is obtained.
Optionally, the resource information obtaining module 320 is further specifically configured to: acquiring available resource information of a current physical machine corresponding to each physical machine in a current machine room traversed currently; and adding the current physical machine available resource information corresponding to all the physical machines to obtain the current machine room available resource information corresponding to the current machine room.
Optionally, the resource information obtaining module 320 is further specifically configured to: acquiring a virtual machine creation queue corresponding to a current machine room traversed currently, wherein the virtual machine creation queue comprises at least one virtual machine creation task; and adding the resource information required by the virtual machine creation in each virtual machine creation task to obtain the pre-allocated resource information of the current machine room corresponding to the current machine room.
Optionally, the remaining resource determining module 330 specifically includes: acquiring current machine room operation resource information required when a current machine room operates a non-virtual machine task; and adding the pre-allocated resource information of the current machine room and the operating resource information of the current machine room, and subtracting the available resource information of the current machine room from the addition result to obtain the residual resource information of the current machine room corresponding to the current machine room.
Optionally, the target virtual machine resource information includes: and establishing the size of a hard disk memory required by the target virtual machine, the size of an operation memory required by the target virtual machine during operation and the number of CPU cores.
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 convenience of distinguishing from each other and are not used for limiting the protection scope of the present invention.
Example four
FIG. 4 shows a schematic block 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. 4, 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 RAM13, various programs and data necessary for the operation of the electronic apparatus 10 can also be stored. The processor 11, the ROM12, and the RAM13 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.
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 ROM12 and/or the communication unit 19. When the computer program is loaded into RAM13 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 may 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 may 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 may be used, with steps reordered, added, or deleted. 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 results 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: target virtual machine resource information required by a target virtual machine to be created currently;
traversing a plurality of machine rooms, and acquiring current machine room available resource information and current machine room pre-allocation resource information corresponding to the current machine room traversed currently;
determining the residual resource information of the current machine room corresponding to the current machine room based on the available resource information of the current machine room and the pre-allocated resource information of the current machine room;
and if the fact that the residual resource information of the current machine room is larger than or equal to the resource information of the target virtual machine is detected, the target virtual machine is distributed to the current machine room to be created.
2. The method of claim 1, wherein traversing a plurality of rooms comprises:
determining a first machine room as a current machine room traversed for the first time;
and if the fact that the residual resource information of the current machine room is smaller than the resource information of the target virtual machine is detected, based on a preset machine room sequence, taking the next machine room of the current machine room as the current machine room traversed next time.
3. The method of claim 2, further comprising:
and if the last traversed current machine room residual resource information corresponding to the current machine room is smaller than the target virtual machine resource information, traversing the plurality of machine rooms again after a preset time interval until the machine room which meets the condition that the current machine room residual resource information is larger than or equal to the target virtual machine resource information is obtained.
4. The method of claim 1, wherein obtaining the available resource information of the current machine room corresponding to the current machine room traversed currently comprises:
acquiring available resource information of a current physical machine corresponding to each physical machine in a current machine room traversed currently;
and adding the current physical machine available resource information corresponding to all the physical machines to obtain the current machine room available resource information corresponding to the current machine room.
5. The method of claim 1, wherein obtaining pre-allocated resource information of a current machine room corresponding to a current machine room traversed currently comprises:
acquiring a virtual machine creation queue corresponding to a current machine room traversed currently, wherein the virtual machine creation queue comprises at least one virtual machine creation task;
and adding the resource information required by the virtual machine creation in each virtual machine creation task to obtain the pre-allocated resource information of the current machine room corresponding to the current machine room.
6. The method of claim 1, wherein the determining the remaining resource information of the current machine room corresponding to the current machine room based on the available resource information of the current machine room and the pre-allocated resource information of the current machine room comprises:
acquiring current machine room operation resource information required when a current machine room operates a non-virtual machine task;
and adding the pre-allocated resource information of the current machine room and the operating resource information of the current machine room, and subtracting the available resource information of the current machine room from the addition result to obtain the residual resource information of the current machine room corresponding to the current machine room.
7. The method of any of claims 1-6, wherein the target virtual machine resource information comprises: and establishing the size of a hard disk memory required by the target virtual machine, the size of an operation memory required by the target virtual machine during operation and the number of CPU cores.
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: target virtual machine resource information required by a target virtual machine to be created currently;
the resource information acquisition module is used for traversing a plurality of machine rooms and acquiring current machine room available resource information corresponding to the current machine room traversed currently and current machine room pre-allocation resource information;
a residual resource determining module, configured to determine, based on the current available resource information of the machine room and the pre-allocated resource information of the current machine room, residual resource information of the current machine room corresponding to the current machine room;
and the virtual machine allocation module is used for allocating the target virtual machine to the current machine room for creation if the condition that the residual resource information of the current machine room is greater than or equal to the resource information of the target virtual machine is detected.
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 content of the first and second substances,
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.
CN202211369850.XA 2022-11-03 2022-11-03 Virtual machine creating method, device, equipment and medium Pending CN115934246A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211369850.XA CN115934246A (en) 2022-11-03 2022-11-03 Virtual machine creating method, device, equipment and medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211369850.XA CN115934246A (en) 2022-11-03 2022-11-03 Virtual machine creating method, device, equipment and medium

Publications (1)

Publication Number Publication Date
CN115934246A true CN115934246A (en) 2023-04-07

Family

ID=86551477

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211369850.XA Pending CN115934246A (en) 2022-11-03 2022-11-03 Virtual machine creating method, device, equipment and medium

Country Status (1)

Country Link
CN (1) CN115934246A (en)

Similar Documents

Publication Publication Date Title
CN113641457A (en) Container creation method, device, apparatus, medium, and program product
CN115658311A (en) Resource scheduling method, device, equipment and medium
CN112905314A (en) Asynchronous processing method and device, electronic equipment, storage medium and road side equipment
CN112506581A (en) Method and device for rendering small program, electronic equipment and readable storage medium
CN114968567A (en) Method, apparatus and medium for allocating computing resources of a compute node
CN114924745A (en) Operation method and device of deep learning compiler and electronic equipment
CN113986497A (en) Queue scheduling method, device and system based on multi-tenant technology
CN115952054A (en) Simulation task resource management method, device, equipment and medium
CN115438007A (en) File merging method and device, electronic equipment and medium
CN113051051B (en) Scheduling method, device, equipment and storage medium of video equipment
CN115934246A (en) Virtual machine creating method, device, equipment and medium
CN114564149A (en) Data storage method, device, equipment and storage medium
CN114090247A (en) Method, device, equipment and storage medium for processing data
CN114327918A (en) Method and device for adjusting resource amount, electronic equipment and storage medium
CN114416357A (en) Method and device for creating container group, electronic equipment and medium
CN114237902A (en) Service deployment method and device, electronic equipment and computer readable medium
CN115344359A (en) Computing power resource allocation method, device, computer readable storage medium and equipment
CN113032092A (en) Distributed computing method, device and platform
CN114816758B (en) Resource allocation method and device
CN115086327B (en) Edge calculation method, device, equipment and storage medium
CN116069474A (en) Task scheduling method, device, equipment and medium
CN115309568A (en) Method, device, equipment and medium for realizing multi-process file sharing
CN115269112A (en) Connection establishing method and device, electronic equipment and storage medium
CN115390992A (en) Virtual machine creating method, device, equipment and storage medium
CN115145725A (en) Cloud equipment distribution method and device, electronic 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