CN111831398A - Virtual machine creation and CPU resource allocation method, device and equipment - Google Patents

Virtual machine creation and CPU resource allocation method, device and equipment Download PDF

Info

Publication number
CN111831398A
CN111831398A CN202010697534.XA CN202010697534A CN111831398A CN 111831398 A CN111831398 A CN 111831398A CN 202010697534 A CN202010697534 A CN 202010697534A CN 111831398 A CN111831398 A CN 111831398A
Authority
CN
China
Prior art keywords
cpu
virtual
virtual machine
physical
physical cpu
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
CN202010697534.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.)
Ping An Technology Shenzhen Co Ltd
Original Assignee
Ping An Technology Shenzhen 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 Ping An Technology Shenzhen Co Ltd filed Critical Ping An Technology Shenzhen Co Ltd
Priority to CN202010697534.XA priority Critical patent/CN111831398A/en
Priority to PCT/CN2020/123210 priority patent/WO2021120841A1/en
Publication of CN111831398A publication Critical patent/CN111831398A/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/5005Allocation of resources, e.g. of the central processing unit [CPU] to service a request
    • G06F9/5027Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals
    • 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

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Stored Programmes (AREA)

Abstract

The invention provides a method, a device, equipment and a storage device for virtual machine creation and CPU resource allocation, wherein the method for virtual machine creation and CPU resource allocation comprises the following steps: acquiring a configuration instruction for a user to create a virtual machine, wherein the configuration instruction comprises the configuration number of virtual CPUs; creating a virtual machine according to the configuration instruction, enabling the virtual machine to comprise the virtual CPUs with the configured number, and allocating a corresponding physical CPU to each virtual CPU, wherein the physical CPU comprises an idle logic core; and allocating at least one of the free logical cores of the physical CPU to the corresponding virtual CPU. The invention can achieve the purposes of avoiding the virtual CPU resource robbery, improving the computing performance of the virtual CPU and meeting the application requirements of clients.

Description

Virtual machine creation and CPU resource allocation method, device and equipment
Technical Field
The present invention relates to the field of virtual computing technologies, and in particular, to a method, an apparatus, a device, and a storage medium for virtual machine creation and CPU resource allocation.
Background
With the rapid development of computer technology and the internet, operating system virtualization technology is becoming mature. The virtualization system allows multiple operating systems to run concurrently on the same physical server, using the same hardware, and without affecting each other.
With the acceleration of the cloud process, the virtual machine is also migrated to the cloud, and more key applications have been migrated to the cloud virtual machine, that is, the cloud host, which requires the virtual machine with high computing performance to meet the service requirements of the user. The virtual CPU is an indispensable part of the virtual machine, the computing capacity of the virtual CPU determines the performance of the virtual machine, the virtual CPU of the traditional virtual machine adopts a random allocation mode, the virtual machine cannot monopolize computing resources, the virtual CPU possibly wins a physical core, and when a key application program runs, the virtual CPU wins to cause overlong waiting time and slow application running.
Therefore, it is an urgent need of users how to improve the computing power of the virtual CPU of the virtual machine, and further improve the performance of the virtual machine to meet the requirements of the key applications.
Disclosure of Invention
The invention provides a method, a device, equipment and a storage device for creating a virtual machine and allocating CPU (Central processing Unit) resources, which can achieve the purposes of avoiding the virtual CPU resources from being contended for and robbed, improving the computing performance of a virtual CPU and meeting the requirements of customer application.
In order to solve the technical problems, the invention adopts a technical scheme that: a virtual machine creating and CPU resource distributing method is provided, which comprises the following steps:
acquiring a configuration instruction for a user to create a virtual machine, wherein the configuration instruction comprises the configuration number of virtual CPUs;
creating a virtual machine according to the configuration instruction, enabling the virtual machine to comprise the virtual CPUs with the configured number, and allocating a corresponding physical CPU to each virtual CPU, wherein the physical CPU comprises an idle logic core; and
and at least one idle logic core of the physical CPU is distributed to the corresponding virtual CPU.
According to an embodiment of the present invention, the method for creating a virtual machine and allocating CPU resources further includes:
and acquiring the resource information of the physical CPU, wherein the resource information comprises the serial number of the idle logic core.
According to an embodiment of the present invention, the allocating at least one of the idle logical cores of the physical CPU to the corresponding virtual CPU includes:
and randomly selecting the idle logic core from the sequence numbers to be distributed to the corresponding virtual CPU according to the physical CPU resource information.
According to an embodiment of the present invention, the configuration instruction further includes a virtual machine name, and the acquiring the physical CPU resource information includes:
and acquiring the physical CPU resource information according to the virtual machine name.
According to one embodiment of the present invention, the virtual CPUs include a first virtual CPU and a second virtual CPU, the physical CPUs include a first physical CPU and a second physical CPU, the first physical CPU corresponding to the first virtual CPU, the second physical CPU corresponding to the second virtual CPU,
the allocating at least one of the idle logical cores of the physical CPU to the corresponding virtual CPU includes:
if the serial number of at least one idle logical core in the first physical CPU is the same as the serial number of at least one idle logical core in the second physical CPU, allocating the idle logical cores of the serial numbers in the first physical CPU and the second physical CPU respectively according to the virtual machine names.
According to an embodiment of the present invention, the configuration instruction further includes an operating system type and a system disk size, and the creating the virtual machine according to the configuration instruction includes:
and creating a virtual disk according to the name of the virtual machine and the size of the system disk, and installing an operating system of the operating system type.
According to an embodiment of the present invention, the method for creating a virtual machine and allocating CPU resources further includes:
inquiring the virtual CPU distribution result according to the virtual machine name, wherein the distribution result comprises the physical CPU distributed by the virtual CPU and the idle logic core corresponding to the physical CPU;
comparing whether the sequence number of the allocated idle logical core is consistent with the sequence number of the allocated idle logical core,
and if the virtual CPU distribution result is consistent with the virtual CPU distribution result, the virtual CPU distribution is completed.
In addition, in order to solve the above technical problems, the present invention further adopts a technical solution in which: provided is a virtual machine creation and CPU resource allocation device, comprising:
the system comprises an acquisition module, a processing module and a control module, wherein the acquisition module is used for acquiring a configuration instruction of a user for creating a virtual machine, and the configuration instruction comprises the configuration number of virtual CPUs;
a creating module, configured to create a virtual machine according to the configuration instruction, so that the virtual machine includes the configured number of virtual CPUs, and allocate a corresponding physical CPU to each virtual CPU, where the physical CPU includes an idle logic core;
and the allocation module is used for allocating at least one idle logic core of the physical CPU to the corresponding virtual CPU.
In addition, in order to solve the above technical problems, the present invention further adopts a technical solution in which: the virtual machine creating and CPU resource allocating device comprises a processor and a memory coupled with the processor, wherein computer readable instructions are stored in the memory, and when the computer readable instructions are executed by the processor, the processor executes the steps of the virtual machine creating and CPU resource allocating method.
In addition, in order to solve the above technical problems, the present invention further adopts a technical solution in which: there is provided a storage medium storing computer readable instructions which, when executed by one or more processors, cause the one or more processors to perform the steps of the virtual machine creation and CPU resource allocation method described above.
According to the virtual machine creation and CPU resource allocation method, device, equipment and storage device, the virtual machine is created and at least one idle logic core of a physical CPU is allocated to the corresponding virtual CPU, so that resource binding of the virtual CPU can be automatically completed in the creation process, the virtual CPU does not contend for and contend for the virtual CPU after allocation is completed, the virtual CPU can stably run, performance and stability of the virtual machine are improved, and customer experience is improved.
Furthermore, the allocation of the virtual CPU resources is completed through the serial numbers and the virtual machine names, so that manual calculation is avoided, manual binding is not needed, and the accuracy of resource allocation is improved.
Furthermore, after the allocation is finished, the correctness of the allocation result is checked through query configuration, and the accuracy of resource allocation is further guaranteed.
Drawings
FIG. 1 is a flowchart illustrating a method for creating a virtual machine and allocating CPU resources according to an embodiment of the present invention;
FIG. 2 is a schematic structural diagram of an apparatus for creating a virtual machine and allocating CPU resources according to an embodiment of the present invention;
FIG. 3 is a schematic structural diagram of a virtual machine creation and CPU resource allocation device according to an embodiment of the present invention;
fig. 4 is a schematic structural diagram of a storage medium according to an embodiment of the present invention.
Detailed Description
The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only a part of the embodiments of the present application, 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 application.
The terms "first", "second" and "third" in this application are used for descriptive purposes only and are not to be construed as indicating or implying relative importance or implying any indication of the number of technical features indicated. Thus, a feature defined as "first," "second," or "third" may explicitly or implicitly include at least one of the feature. In the description of the present application, "plurality" means at least two, e.g., two, three, etc., unless explicitly specifically limited otherwise. All directional indications (such as up, down, left, right, front, and rear … …) in the embodiments of the present application are only used to explain the relative positional relationship between the components, the movement, and the like in a specific posture (as shown in the drawings), and if the specific posture is changed, the directional indication is changed accordingly. Furthermore, the terms "include" and "have," as well as any variations thereof, are intended to cover non-exclusive inclusions. For example, a process, method, system, article, or apparatus that comprises a list of steps or elements is not limited to only those steps or elements listed, but may alternatively include other steps or elements not listed, or inherent to such process, method, article, or apparatus.
Reference herein to "an embodiment" means that a particular feature, structure, or characteristic described in connection with the embodiment can be included in at least one embodiment of the application. The appearances of the phrase in various places in the specification are not necessarily all referring to the same embodiment, nor are separate or alternative embodiments mutually exclusive of other embodiments. It is explicitly and implicitly understood by one skilled in the art that the embodiments described herein can be combined with other embodiments.
Fig. 1 is a flowchart illustrating a virtual machine creation and CPU resource allocation method according to an embodiment of the present invention. The virtual machine creation and CPU resource allocation method can be operated on a local server, a remote server or a remote cloud platform, the local server, the remote server or the remote cloud platform can communicate with a user side through a wireless network such as WIFI or a wired network such as Ethernet, and the user side can be any terminal capable of being operated by a user, such as a mobile phone, a tablet computer, a notebook computer and the like. It should be noted that the method of the present invention is not limited to the flow sequence shown in fig. 1 if the results are substantially the same. As shown in fig. 1, the method comprises the steps of:
step S101: and acquiring a configuration instruction for a user to create the virtual machine, wherein the configuration instruction comprises the configuration number of the virtual CPU.
According to an embodiment of the present invention, the configuration instruction may include a virtual machine name, a configuration number of virtual CPUs, an operating system type, a system disk size, and a memory size, and it can be understood that the virtual machine name, the configuration number of the virtual CPUs, the operating system type, and the system disk size in the configuration instruction may all be specified by a user, and a preset default value may be adopted when the user does not specify, for example, the virtual machine name may adopt a form of preset characters and numbers, and each time one virtual machine is created, the number is increased by 1, and the configuration number default value of the virtual CPUs may be 1.
Step S102: and creating a virtual machine according to the configuration instruction, enabling the virtual machine to comprise the virtual CPUs with the configured number, and allocating a corresponding physical CPU to each virtual CPU, wherein the physical CPU comprises an idle logic core.
The local server, the remote server or the remote cloud platform acquires the configuration instruction, creates a virtual disk according to the name of the virtual machine and the size of the system disk, installs an operating system of the operating system type, then edits a configuration file, such as an XML file, according to the configuration instruction, the configuration file comprises the configuration of the virtual CPUs, the memory size and the like, which configure the configuration number of the virtual CPUs for the name of the virtual machine of the configuration instruction, and simultaneously acquires the physical CPUs including the idle logic cores, and allocates corresponding physical CPUs for each virtual CPU when configuring the virtual machine, so that the physical CPUs allocated for each virtual CPU have idle resources for the virtual CPUs.
According to an embodiment of the present invention, after the initial configuration of the virtual machine is completed, a query may be performed according to the name of the virtual machine, and the physical CPU resource information allocated to the virtual machine at present may be obtained, where the resource information includes the serial number of the idle logical core.
Step S103: and at least one idle logic core of the physical CPU is distributed to the corresponding virtual CPU.
According to an embodiment of the present invention, the allocating at least one idle logical core of the physical CPU to the corresponding virtual CPU may randomly select the idle logical core from the sequence numbers to allocate to the corresponding virtual CPU according to the physical CPU resource information.
According to another embodiment of the present invention, the virtual CPUs include a first virtual CPU and a second virtual CPU, the physical CPUs include a first physical CPU and a second physical CPU, the first physical CPU corresponding to the first virtual CPU and the second physical CPU corresponding to the second virtual CPU, the allocating at least one idle logical core of the physical CPU to the corresponding virtual CPU may further allocate the idle logical cores of the serial numbers in the first physical CPU and the second physical CPU to the first physical CPU and the second physical CPU respectively according to the virtual machine name if the serial number of at least one idle logical core in the first physical CPU is the same as the serial number of at least one idle logical core in the second physical CPU.
The above process is described below by way of specific examples.
A user issues a configuration instruction for creating a virtual machine through a user side, wherein the configuration instruction comprises: the virtual machine name is wp, the system disk size is 50G, the operating system type is a default operating system, the memory size is 2G, the number of the virtual CPUs in configuration is 2, after the server receives the configuration instruction, the system disk size is 50G according to the virtual machine name wp, the operating system type creates a virtual disk for the default operating system and installs the default operating system, meanwhile, according to the memory size being 2G, the number of the virtual CPUs in configuration is 2, a configuration file is generated, 2 physical CPUs including the idle logic core and capable of being allocated to the virtual machine on the current server are obtained, then the virtual machine is configured according to the configuration file, and the 2 physical CPUs are allocated to the 2 virtual CPUs.
In an embodiment, the empty logical core with the sequence number of 3 in the physical CPU1 may be randomly selected to be allocated to the virtual CPU1, and the empty logical core with the sequence number of 10 in the physical CPU2 may be allocated to the virtual CPU1, to the virtual CPU2, if the virtual CPU1 corresponds to the physical CPU1, and the physical CPU1 includes 20 empty logical cores, the number of the empty logical cores is 1 to 20, the virtual CPU2 corresponds to the physical CPU2, and the physical CPU2 includes 15 empty logical cores, and the number of the empty logical cores is 1 to 15. In another embodiment, the idle logical cores with sequence numbers 5 to 9 may also be directly allocated to the virtual machine with the virtual machine name, in this case, the empty logical cores with sequence numbers 5 to 9 in the physical CPU1 are allocated to the virtual CPU1, and the empty logical cores with sequence numbers 5 to 9 in the physical CPU2 are allocated to the virtual CPU 2.
According to an embodiment of the present invention, the method for creating a virtual machine and allocating CPU resources further includes querying, according to the name of the virtual machine, the virtual CPU allocation result, where the allocation result includes the physical CPU allocated by the virtual CPU and the idle logical core corresponding to the physical CPU; and comparing whether the sequence number of the allocated idle logic core is consistent with the sequence number of the allocated idle logic core, if so, finishing the virtual CPU allocation if the allocation result is correct.
According to the virtual machine creation and CPU resource allocation method provided by the invention, the virtual machine is created and at least one idle logic core of a physical CPU is allocated to the corresponding virtual CPU, so that the resource binding of the virtual CPU can be automatically completed in the creation process, the virtual CPU does not contend and run stably after the allocation is completed, the performance and the stability of the virtual machine are improved, and the customer experience is improved.
Furthermore, the allocation of the virtual CPU resources is completed through the serial numbers and the virtual machine names, so that manual calculation is avoided, manual binding is not needed, and the accuracy of resource allocation is improved.
Furthermore, after the allocation is finished, the correctness of the allocation result is checked through query configuration, and the accuracy of resource allocation is further guaranteed.
Fig. 2 is a schematic structural diagram of the virtual machine creating and CPU resource allocating apparatus 1 according to an embodiment of the present invention. As shown in fig. 3, the virtual machine creation and CPU resource allocation apparatus 1 includes an acquisition module 11, a creation module 12, and an allocation module 13.
The obtaining module 11 is configured to obtain a configuration instruction for a user to create a virtual machine, where the configuration instruction includes the configuration number of the virtual CPUs.
According to an embodiment of the present invention, the obtaining module 11 is further configured to obtain the resource information of the physical CPU, where the resource information includes a sequence number of the idle logical core.
According to an embodiment of the present invention, the configuration instruction further includes a virtual machine name, and the obtaining module 11 is further configured to obtain the physical CPU resource information according to the virtual machine name.
A creating module 12, configured to create a virtual machine according to the configuration instruction, so that the virtual machine includes the configured number of virtual CPUs, and allocate a corresponding physical CPU to each virtual CPU, where the physical CPU includes an idle logical core.
According to an embodiment of the present invention, the configuration instruction further includes an operating system type and a system disk size, and the creating module 12 is further configured to create a virtual disk according to the virtual machine name and the system disk size, and install an operating system of the operating system type.
An allocating module 13, configured to allocate at least one idle logical core of the physical CPU to the corresponding virtual CPU.
According to an embodiment of the present invention, the allocating module 13 is further configured to randomly select the idle logical core from the sequence numbers to allocate to the corresponding virtual CPU according to the physical CPU resource information.
According to an embodiment of the present invention, the virtual CPUs include a first virtual CPU and a second virtual CPU, the physical CPUs include a first physical CPU and a second physical CPU, the first physical CPU corresponding to the first virtual CPU and the second physical CPU corresponding to the second virtual CPU, and the allocating module 13 is further configured to allocate the idle logical cores of the serial numbers in the first physical CPU and the second physical CPU to the first virtual CPU and the second virtual CPU respectively according to the virtual machine name if the serial number of at least one of the idle logical cores in the first physical CPU is the same as the serial number of at least one of the idle logical cores in the second physical CPU.
According to an embodiment of the present invention, the allocating module 13 is further configured to query the virtual CPU allocation result according to the virtual machine name, where the allocation result includes the physical CPU allocated by the virtual CPU and the idle logical core corresponding to the physical CPU; and comparing whether the sequence number of the allocated idle logic core is consistent with the sequence number of the allocated idle logic core, if so, finishing the virtual CPU allocation if the allocation result is correct.
It can be understood that specific ways for implementing the functions by the modules of the apparatus may refer to the specific steps corresponding to the above embodiments, and therefore, the detailed description thereof is omitted here.
Referring to fig. 3, fig. 3 is a schematic structural diagram of a virtual machine creating and CPU resource allocating apparatus 30 according to an embodiment of the present invention. As shown in fig. 3, the virtual machine creation and CPU resource allocation apparatus 30 includes a processor 32, a memory 31 coupled to the processor 32, wherein the memory 31 stores therein computer-readable instructions, and the computer-readable instructions when executed by the processor 32 implement the following steps: acquiring a configuration instruction for a user to create a virtual machine, wherein the configuration instruction comprises the configuration number of virtual CPUs; creating a virtual machine according to the configuration instruction, enabling the virtual machine to comprise the virtual CPUs with the configured number, and allocating a corresponding physical CPU to each virtual CPU, wherein the physical CPU comprises an idle logic core; and allocating at least one of the free logical cores of the physical CPU to the corresponding virtual CPU.
According to an embodiment of the present invention, the method for creating a virtual machine and allocating CPU resources further includes: and acquiring the resource information of the physical CPU, wherein the resource information comprises the serial number of the idle logic core.
According to an embodiment of the present invention, the allocating at least one of the idle logical cores of the physical CPU to the corresponding virtual CPU includes: and randomly selecting the idle logic core from the sequence numbers to be distributed to the corresponding virtual CPU according to the physical CPU resource information. According to an embodiment of the present invention, the configuration instruction further includes a virtual machine name, and the acquiring the physical CPU resource information includes: and acquiring the physical CPU resource information according to the virtual machine name.
According to an embodiment of the present invention, the allocating at least one idle logical core of the physical CPU to the corresponding virtual CPU includes: if the serial number of at least one idle logical core in the first physical CPU is the same as the serial number of at least one idle logical core in the second physical CPU, allocating the idle logical cores of the serial numbers in the first physical CPU and the second physical CPU respectively according to the virtual machine names.
According to an embodiment of the present invention, the configuration instruction further includes an operating system type and a system disk size, and the creating the virtual machine according to the configuration instruction includes: and creating a virtual disk according to the name of the virtual machine and the size of the system disk, and installing an operating system of the operating system type.
According to an embodiment of the present invention, the method for creating a virtual machine and allocating CPU resources further includes: inquiring the virtual CPU distribution result according to the virtual machine name, wherein the distribution result comprises the physical CPU distributed by the virtual CPU and the idle logic core corresponding to the physical CPU; and comparing whether the sequence number of the allocated idle logic core is consistent with the sequence number of the allocated idle logic core, if so, finishing the virtual CPU allocation if the allocation result is correct.
Referring to fig. 4, fig. 4 is a schematic structural diagram of a storage medium according to an embodiment of the invention. As shown in fig. 4, a storage medium storing computer readable instructions 41, the computer readable instructions 41, when executed by one or more processors, cause the one or more processors to perform the steps of: acquiring a configuration instruction for a user to create a virtual machine, wherein the configuration instruction comprises the configuration number of virtual CPUs; creating a virtual machine according to the configuration instruction, enabling the virtual machine to comprise the virtual CPUs with the configured number, and allocating a corresponding physical CPU to each virtual CPU, wherein the physical CPU comprises an idle logic core; and allocating at least one of the free logical cores of the physical CPU to the corresponding virtual CPU.
According to an embodiment of the present invention, the method for creating a virtual machine and allocating CPU resources further includes: and acquiring the resource information of the physical CPU, wherein the resource information comprises the serial number of the idle logic core.
According to an embodiment of the present invention, the allocating at least one of the idle logical cores of the physical CPU to the corresponding virtual CPU includes: and randomly selecting the idle logic core from the sequence numbers to be distributed to the corresponding virtual CPU according to the physical CPU resource information. According to an embodiment of the present invention, the configuration instruction further includes a virtual machine name, and the acquiring the physical CPU resource information includes: and acquiring the physical CPU resource information according to the virtual machine name.
According to an embodiment of the present invention, the allocating at least one idle logical core of the physical CPU to the corresponding virtual CPU includes: if the serial number of at least one idle logical core in the first physical CPU is the same as the serial number of at least one idle logical core in the second physical CPU, allocating the idle logical cores of the serial numbers in the first physical CPU and the second physical CPU respectively according to the virtual machine names.
According to an embodiment of the present invention, the configuration instruction further includes an operating system type and a system disk size, and the creating the virtual machine according to the configuration instruction includes: and creating a virtual disk according to the name of the virtual machine and the size of the system disk, and installing an operating system of the operating system type.
According to an embodiment of the present invention, the method for creating a virtual machine and allocating CPU resources further includes: inquiring the virtual CPU distribution result according to the virtual machine name, wherein the distribution result comprises the physical CPU distributed by the virtual CPU and the idle logic core corresponding to the physical CPU; and comparing whether the sequence number of the allocated idle logic core is consistent with the sequence number of the allocated idle logic core, if so, finishing the virtual CPU allocation if the allocation result is correct.
It will be understood by those skilled in the art that all or part of the processes of the methods of the embodiments described above can be implemented by a computer program, which can be stored in a computer-readable storage medium, and can include the processes of the embodiments of the methods described above when the computer program is executed. The storage medium may be a non-volatile storage medium such as a magnetic disk, an optical disk, a Read-only memory (ROM), or a Random Access Memory (RAM).
The technical features of the embodiments described above may be arbitrarily combined, and for the sake of brevity, all possible combinations of the technical features in the embodiments described above are not described, but should be considered as being within the scope of the present specification as long as there is no contradiction between the combinations of the technical features.
The above-mentioned embodiments only express several embodiments of the present invention, and the description thereof is more specific and detailed, but not construed as limiting the scope of the present invention. It should be noted that, for a person skilled in the art, several variations and modifications can be made without departing from the inventive concept, which falls within the scope of the present invention. Therefore, the protection scope of the present patent shall be subject to the appended claims.

Claims (10)

1. A virtual machine creating and CPU resource allocation method is characterized by comprising the following steps:
acquiring a configuration instruction for a user to create a virtual machine, wherein the configuration instruction comprises the configuration number of virtual CPUs;
creating a virtual machine according to the configuration instruction, enabling the virtual machine to comprise the virtual CPUs with the configured number, and allocating a corresponding physical CPU to each virtual CPU, wherein the physical CPU comprises an idle logic core; and
and at least one idle logic core of the physical CPU is distributed to the corresponding virtual CPU.
2. The method for virtual machine creation and CPU resource allocation according to claim 1, wherein the method for virtual machine creation and CPU resource allocation further comprises:
and acquiring the resource information of the physical CPU, wherein the resource information comprises the serial number of the idle logic core.
3. The virtual machine creation and CPU resource allocation method according to claim 2, wherein said allocating at least one of said idle logical cores of said physical CPU to a corresponding said virtual CPU comprises:
and randomly selecting the idle logic core from the sequence numbers to be distributed to the corresponding virtual CPU according to the physical CPU resource information.
4. The method for creating a virtual machine and allocating CPU resources according to claim 2, wherein the configuration instruction further includes a virtual machine name, and the obtaining the physical CPU resource information includes:
and acquiring the physical CPU resource information according to the virtual machine name.
5. The method for creating virtual machine and allocating CPU resource according to claim 4, wherein the virtual CPU comprises a first virtual CPU and a second virtual CPU, the physical CPUs comprise a first physical CPU and a second physical CPU, the first physical CPU corresponding to the first virtual CPU and the second physical CPU corresponding to the second virtual CPU,
the allocating at least one of the idle logical cores of the physical CPU to the corresponding virtual CPU includes:
if the serial number of at least one idle logical core in the first physical CPU is the same as the serial number of at least one idle logical core in the second physical CPU, allocating the idle logical cores of the serial numbers in the first physical CPU and the second physical CPU respectively according to the virtual machine names.
6. The method for creating a virtual machine and allocating CPU resources according to claim 4, wherein the configuration instruction further includes an operating system type and a system disk size, and the creating the virtual machine according to the configuration instruction includes:
and creating a virtual disk according to the name of the virtual machine and the size of the system disk, and installing an operating system of the operating system type.
7. The method for virtual machine creation and CPU resource allocation according to claim 2, wherein the method for virtual machine creation and CPU resource allocation further comprises:
inquiring the virtual CPU distribution result according to the virtual machine name, wherein the distribution result comprises the physical CPU distributed by the virtual CPU and the idle logic core corresponding to the physical CPU;
comparing whether the sequence number of the allocated idle logical core is consistent with the sequence number of the allocated idle logical core,
and if the virtual CPU distribution result is consistent with the virtual CPU distribution result, the virtual CPU distribution is completed.
8. An apparatus for creating a virtual machine and allocating a CPU resource, comprising:
the system comprises an acquisition module, a processing module and a control module, wherein the acquisition module is used for acquiring a configuration instruction of a user for creating a virtual machine, and the configuration instruction comprises the configuration number of virtual CPUs;
a creating module, configured to create a virtual machine according to the configuration instruction, so that the virtual machine includes the configured number of virtual CPUs, and allocate a corresponding physical CPU to each virtual CPU, where the physical CPU includes an idle logic core;
and the allocation module is used for allocating at least one idle logic core of the physical CPU to the corresponding virtual CPU.
9. A virtual machine creation and CPU resource allocation apparatus comprising a processor, a memory coupled to the processor, wherein,
the memory has stored therein computer readable instructions which, when executed by the processor, cause the processor to perform the steps of the virtual machine creation and CPU resource allocation method of any one of claims 1 to 7.
10. A storage medium storing computer readable instructions which, when executed by one or more processors, cause the one or more processors to perform the steps of the virtual machine creation and CPU resource allocation method of any one of claims 1 to 7.
CN202010697534.XA 2020-07-20 2020-07-20 Virtual machine creation and CPU resource allocation method, device and equipment Pending CN111831398A (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN202010697534.XA CN111831398A (en) 2020-07-20 2020-07-20 Virtual machine creation and CPU resource allocation method, device and equipment
PCT/CN2020/123210 WO2021120841A1 (en) 2020-07-20 2020-10-23 Method, apparatus, and device for creating virtual machine and allocating cpu resources

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010697534.XA CN111831398A (en) 2020-07-20 2020-07-20 Virtual machine creation and CPU resource allocation method, device and equipment

Publications (1)

Publication Number Publication Date
CN111831398A true CN111831398A (en) 2020-10-27

Family

ID=72922980

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010697534.XA Pending CN111831398A (en) 2020-07-20 2020-07-20 Virtual machine creation and CPU resource allocation method, device and equipment

Country Status (2)

Country Link
CN (1) CN111831398A (en)
WO (1) WO2021120841A1 (en)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102270159A (en) * 2011-08-11 2011-12-07 浙江大学 Access controlling and load balancing method for virtualized environment
JP2018037047A (en) * 2016-09-02 2018-03-08 日本電信電話株式会社 Resource allocation device, resource allocation method and resource allocation program
WO2019160060A1 (en) * 2018-02-19 2019-08-22 日本電信電話株式会社 Virtual resource management device, virtual resource allocation method, and virtual resource allocation program
CN111104219A (en) * 2019-11-30 2020-05-05 北京浪潮数据技术有限公司 Binding method, device, equipment and storage medium of virtual core and physical core

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2012103728A1 (en) * 2011-06-30 2012-08-09 华为技术有限公司 Method for dispatching central processing unit of hotspot domain virtual machine and virtual machine system
WO2015031274A1 (en) * 2013-08-26 2015-03-05 Vmware, Inc. Virtual machine monitor configured to support latency sensitive virtual machines
CN108255598A (en) * 2016-12-28 2018-07-06 华耀(中国)科技有限公司 The virtual management platform resource distribution system and method for performance guarantee
CN110990114A (en) * 2019-11-08 2020-04-10 浪潮电子信息产业股份有限公司 Virtual machine resource allocation method, device, equipment and readable storage medium

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102270159A (en) * 2011-08-11 2011-12-07 浙江大学 Access controlling and load balancing method for virtualized environment
JP2018037047A (en) * 2016-09-02 2018-03-08 日本電信電話株式会社 Resource allocation device, resource allocation method and resource allocation program
WO2019160060A1 (en) * 2018-02-19 2019-08-22 日本電信電話株式会社 Virtual resource management device, virtual resource allocation method, and virtual resource allocation program
CN111104219A (en) * 2019-11-30 2020-05-05 北京浪潮数据技术有限公司 Binding method, device, equipment and storage medium of virtual core and physical core

Also Published As

Publication number Publication date
WO2021120841A1 (en) 2021-06-24

Similar Documents

Publication Publication Date Title
US11714671B2 (en) Creating virtual machine groups based on request
CN108614726B (en) Virtual machine creation method and device
CN113204428B (en) Resource scheduling method, device, electronic equipment and computer readable storage medium
CN109634718B (en) Method and system for creating mirror image by cloud platform
CN112463363B (en) Resource arranging method, device, equipment and storage medium
CN110166507B (en) Multi-resource scheduling method and device
CN110633130B (en) Virtual memory management method and device based on memory hot plug technology
CN106557366B (en) Task distribution method, device and system
CN114416352A (en) Computing resource allocation method and device, electronic equipment and storage medium
US10761869B2 (en) Cloud platform construction method and cloud platform storing image files in storage backend cluster according to image file type
CN113674131A (en) Hardware accelerator equipment management method and device, electronic equipment and storage medium
US20220229701A1 (en) Dynamic allocation of computing resources
CN110750336A (en) OpenStack virtual machine memory hot-expanding method
CN115729673A (en) Cluster management method, management module, electronic device and medium
CN113986539A (en) Method, device, electronic equipment and readable storage medium for realizing pod fixed IP
CN113672368A (en) Task scheduling method and system
CN111831398A (en) Virtual machine creation and CPU resource allocation method, device and equipment
CN115150268A (en) Network configuration method and device of Kubernetes cluster and electronic equipment
CN109800229B (en) Data access method and related equipment
CN109617954B (en) Method and device for creating cloud host
CN111580935A (en) Network communication method, device, equipment and storage medium
CN113691575A (en) Communication method, device and system
CN113568708B (en) Platform creation method, device and equipment
CN109254871A (en) A kind of online de-redundancy method of efficient virtual-machine data
CN111582398B (en) Data clustering method, device, system, server 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