CN112988320A - Method and device for creating virtual machine - Google Patents

Method and device for creating virtual machine Download PDF

Info

Publication number
CN112988320A
CN112988320A CN201911276872.XA CN201911276872A CN112988320A CN 112988320 A CN112988320 A CN 112988320A CN 201911276872 A CN201911276872 A CN 201911276872A CN 112988320 A CN112988320 A CN 112988320A
Authority
CN
China
Prior art keywords
tor
host
network
controller
virtual machines
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
CN201911276872.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.)
Huawei Technologies Co Ltd
Original Assignee
Huawei Technologies 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 Huawei Technologies Co Ltd filed Critical Huawei Technologies Co Ltd
Priority to CN201911276872.XA priority Critical patent/CN112988320A/en
Publication of CN112988320A publication Critical patent/CN112988320A/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/45504Abstract machines for programme code execution, e.g. Java virtual machine [JVM], interpreters, emulators
    • 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/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45533Hypervisors; Virtual machine monitors
    • G06F9/45558Hypervisor-specific management and integration aspects
    • G06F2009/45562Creating, deleting, cloning virtual machine instances
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45533Hypervisors; Virtual machine monitors
    • G06F9/45558Hypervisor-specific management and integration aspects
    • G06F2009/45595Network integration; Enabling network access in 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)
  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

The application discloses a method and a device for creating a virtual machine, and belongs to the field of communication. The method comprises the following steps: the method comprises the steps that a controller receives a creation request, wherein the creation request comprises network information of a tenant network to which a virtual machine to be created belongs; the controller determines a TOR of a data center switch, which meets a first condition and corresponds to the tenant network, of load information according to the network information; and the controller creates the virtual machine to be created on the host connected with the TOR according to the network information. The method and the device can reduce the load of the TOR, and avoid the problems of network congestion and the like on the TOR.

Description

Method and device for creating virtual machine
Technical Field
The present application relates to the field of communications, and in particular, to a method and an apparatus for creating a virtual machine.
Background
A virtualization management software (vCenter) of a cloud computing data center virtualization software company is a virtualization management platform, and may include a plurality of hosts, each of which is connected to a top of rank (TOR) in a network. A user may establish a virtual machine on a host included in the vCenter, and the virtual machine located on the host may transmit traffic over the network via a TOR connected to the host.
Currently, when a user needs to create a virtual machine, it is common to randomly select one of the multiple hosts included in the vCenter and then create the virtual machine on that host. Because the hosts are randomly selected, for some TORs in the network, the hosts connected to the TOR may be frequently selected, which results in a large number of virtual machines being established on the hosts, and thus the large number of virtual machines transmit traffic through the TOR, so that the traffic transmitted on the TOR is large, which results in a large load on the TOR, and network congestion is easily caused on the TOR.
Disclosure of Invention
The application provides a method and a device for creating a virtual machine, so as to reduce the load of a TOR and avoid the problems of network congestion and the like formed on the TOR. The technical scheme is as follows:
in a first aspect, the present application provides a method for creating a virtual machine, in which a controller receives a creation request including network information of a tenant network to which a virtual machine to be created belongs. The controller determines, according to the network information, a TOR of which the load information satisfies a first condition and corresponds to the tenant network. And the controller creates a virtual machine to be created on the host connected with the TOR according to the network information. Because the TOR with the load information meeting the first condition is selected from the TORs corresponding to the tenant network, and then the virtual machine is established on the host connected with the TORs, load balancing between the TORs corresponding to the tenant network can be achieved, the problem that the number of services transmitted on the TORs is large due to the fact that a certain TOR is frequently selected is avoided, the load of the TORs is reduced, and the problem that the network congestion and the like are caused by the TORs corresponding to the tenant network is avoided.
In one possible implementation, the load information of the TOR includes a number of logical ports in the TOR, and the number of logical ports is used for reflecting the number of traffic transmitted on the TOR. And the controller acquires the number of the logic ports in each TOR corresponding to the tenant network according to the network information. The controller selects one TOR with the smallest number of logical ports from each TOR, or selects one TOR with the number of logical ports smaller than a first threshold. Because the TOR with the minimum number of the logical ports or the TOR with the number of the logical ports smaller than the first threshold is selected, and the number of the logical ports is used for reflecting the number of the services transmitted on the TOR, the number of the services transmitted on the selected TOR is ensured to be relatively small, so that after the virtual machine to be created is created, when the virtual machine to be created uses the selected TOR to transmit the services, the problems of network congestion and the like cannot occur.
In another possible implementation manner, the controller determines each TOR corresponding to the tenant network according to the correspondence between the network information of the tenant network and the device identifier of the TOR and the network information. And the controller acquires the number of the logical ports in each TOR from the corresponding relation between the device identifier of each TOR and the number of the logical ports according to the device identifier of each TOR. Because the controller stores the corresponding relationship between the network information of the tenant network and the device identifier of the TOR, and the corresponding relationship between the device identifier of the TOR and the number of the logical ports, the controller can acquire the number of the logical ports of each TOR corresponding to the tenant network through the two corresponding relationships, and thus load balancing can be performed on each TOR based on the number of the logical ports of each TOR.
In another possible implementation manner, the controller obtains the number of virtual machines included in each host connected to the selected TOR, and selects a host whose number of virtual machines satisfies the second condition. The controller creates a virtual machine to be created on the selected host according to the network information. And for each host connected with the selected TOR, the number of the virtual machines in each host is also acquired, the hosts of which the number meets a second condition are selected from each host, and the virtual machines are established on the selected hosts, so that load balancing can be realized among the hosts, and the phenomenon that the service operation is influenced due to the overlarge load of a certain host is avoided.
In another possible implementation manner, the controller obtains the device identifier of each host connected to the selected TOR from a network topology map of a network managed by the controller, where the network includes the selected TOR and each host. And the controller acquires the number of the virtual machines in each host from the corresponding relation between the equipment identification of the host and the number of the virtual machines according to the equipment identification of each host. Because the controller includes the network topology map, the device identifier of each host connected to the TOR can be obtained based on the network topology map, and the number of virtual machines in each host can be obtained from the corresponding relationship based on the device identifier of each host, so that load balancing between each host can be realized based on the number of virtual machines in each host.
In another possible implementation, the controller selects the host with the smallest number of virtual machines, or selects the host with the number of virtual machines smaller than the second threshold. Because the host with the minimum number of the virtual machines or the host with the number of the virtual machines smaller than the second threshold value is selected, the load on the selected host is relatively small, and the virtual machines are established on the selected host, the load on the selected host is not too large, and the service operation is not influenced.
In another possible implementation, the controller calculates a ratio between the total amount of computing resources included in each host and the number of virtual machines. The controller selects the master with the largest ratio or selects the master with the ratio larger than the third threshold. The larger the ratio of the hosts is, the more idle resources available for creating the virtual machine on the hosts are, so that the controller selects the host with the largest ratio or the host with the ratio larger than the third threshold, and creates the virtual machine on the selected host, so that the load of some hosts is not larger, and the load of some hosts is smaller, thereby avoiding the phenomenon of load imbalance.
In a second aspect, the present application provides an apparatus for creating a virtual machine, configured to perform the method of the first aspect or any one of the possible implementations of the first aspect. In particular, the apparatus comprises means for performing the method of the first aspect or any one of its possible implementations.
In a third aspect, the present application provides an apparatus for creating a virtual machine, the apparatus comprising: a processor, a memory, and a transceiver. The processor, the memory and the transceiver can be connected through a bus system. The memory is configured to store one or more programs, and the processor is configured to execute the one or more programs in the memory, so that the migration apparatus performs the method of the first aspect or any possible implementation manner of the first aspect.
In a fourth aspect, the present application provides a computer-readable storage medium having program code stored therein, which when run on a computer, causes the computer to perform the method of the first aspect or any possible implementation manner of the first aspect.
In a fifth aspect, the present application provides a computer program product comprising program code which, when run on a computer, causes the computer to perform the method of the first aspect or any possible implementation manner of the first aspect.
Drawings
Fig. 1 is a schematic diagram of a network architecture provided in an embodiment of the present application;
fig. 2 is a flowchart of a method for creating a virtual machine according to an embodiment of the present application;
fig. 3 is a flowchart for determining each TOR and load information of each TOR corresponding to a tenant network according to an embodiment of the present disclosure;
fig. 4 is a schematic structural diagram of an apparatus for creating a virtual machine according to an embodiment of the present application;
fig. 5 is a schematic structural diagram of another apparatus for creating a virtual machine according to an embodiment of the present application.
Detailed Description
Embodiments of the present application will be described in further detail below with reference to the accompanying drawings.
Referring to fig. 1, the present application provides a network architecture including a controller, a vCenter, and a data center network. The controller may manage the vCenter and the data center network.
The vCenter comprises a plurality of hosts, and the data center network comprises network devices such as at least one Gateway (GW), at least one backbone switch (Spine) and at least one TOR.
For any TOR in the data center network, the TOR is connected with at least one host in the vCenter, and the TOR is also connected with one or more Spine. For any Spine, the Spine is also connected to one or more GWs, and each GW may also be connected to a wide area network. For example, the GW may be connected to an edge router (PE) of the wide area network.
The controller can establish network connection with network equipment in the data center network, and the controller can manage the network equipment in the data center network through the network connection so as to realize management of the data center network. And a network connection can be established between the controller and the host in the vCenter, and the controller can manage the host in the vCenter through the network connection so as to realize the management of the vCenter.
In this network architecture, a user can deploy services in a host of a vCenter. The user may be a business, organization, or individual, etc. When a user needs to deploy a service, the user can send a service application request to the controller through the corresponding device, the controller allocates a network identifier of a tenant network, applies for network segment information corresponding to the tenant network and a network identifier of a VLAN, and allocates at least one TOR for the tenant network. Such that a user can create at least one virtual machine on a host connected to the at least one TOR, use the at least one virtual machine to run the service, and the tenant network includes the at least one virtual machine.
One TOR can be allocated to a plurality of different tenant networks, and virtual machines belonging to different tenant networks can be created on a host connected to the TOR.
Optionally, the controller stores a correspondence between the network information of the tenant network and the device identifier of the TOR. After the controller allocates at least one TOR to a tenant network, the controller may store the network information of the tenant network and the device identifier of each allocated TOR in a corresponding relationship between the network information of the tenant network and the device identifier of the TOR.
The network information of the tenant network may include a network identifier of the tenant network, network segment information corresponding to the tenant network, and a network identifier of a VLAN corresponding to the tenant network. The network segment information corresponding to the tenant network may be an address segment, and the address segment may be an Internet Protocol (IP) address segment or a Media Access Control (MAC) address segment. For example, taking the address segment as an IP address segment as an example, the network segment information allocated by the controller for the tenant network is an IP address segment, and it is assumed that the IP address segment may be 192.168.1.0 to 192.168.1.10. In addition, it is assumed that the network identifier of the tenant network assigned by the controller is N1, and the network identifier of the VLAN corresponding to the tenant network applied is V1, so that the network information of the tenant network may include the network identifier N1 of the tenant network, the network segment information "192.168.1.0 to 192.168.1.10" and the network identifier V1 of the VLAN.
Further, it is assumed that the TOR allocated by the controller for the tenant network includes TOR1 and TOR2, so that the controller can store the network information of the tenant network, the device identifier T1 of the allocated TOR1 and the device identifier T2 of the TOR2 in the correspondence relationship between the network information of the tenant network and the device identifier of the TOR as shown in expression 1 below
TABLE 1
Figure BDA0002315799700000041
For any host in the vCenter, the host includes a computing resource required for the virtual machine to run, and the computing resource may be a Central Processing Unit (CPU) or a memory.
After applying for the tenant network, the user may request the controller to create a virtual machine. The controller may create a virtual machine on a host in the vCenter at the request of the user, and the virtual machine may be used to run a service corresponding to the tenant network. The virtual machine can be accessed to a data center network through the TOR connected with the host, and can transmit the service message belonging to the service on the data center network. The detailed process of the controller creating the virtual machine on the host will be described in the following embodiment shown in fig. 2, and will not be described in detail here.
For a TOR connected to the host, the TOR may include at least one logical port, and for each logical port, the logical port corresponds to a service. For a virtual machine running on the host and for a service running on the virtual machine, the virtual machine may establish a network connection with the TOR, where the network connection is used to connect the virtual machine and a logical port corresponding to the service on the TOR. Thus, the virtual machine may send the service packet of the service to the TOR through the network connection, the TOR receives the service packet of the service through the logical port, and sends the service packet of the service to the wide area network through the Spine and the GW that are connected to the TOR. Or, the TOR may receive a service packet of the service from the wide area network, and send the service packet of the service to the virtual machine through a logical port corresponding to the service.
The TOR establishes network connection with the virtual machine through the logical port, and transmits the service of the virtual machine operation through the logical port. The more logical ports in a TOR, the more virtual machines representing network connections established with the TOR, and the more traffic transmitted in the TOR.
Optionally, the controller further stores a correspondence between the device identifier of the TOR and the load information. The corresponding relationship stores the device identifier of each TOR and the load information of each TOR in the data center network. The load information of a TOR may be the number of logical ports in the TOR, and the like.
Optionally, for any TOR in the data center network, the controller obtains load information of the TOR, and stores the device identifier of the TOR and the load information of the TOR in a corresponding relationship between the device identifier of the TOR and the load information. When the load information in the TOR changes, the controller further obtains the load information after the TOR changes, and updates the load information of the TOR to the changed load information in the corresponding relationship between the device identifier of the TOR and the load information.
For example, taking the load information as the number of logical ports as an example, for the TORs 1 and 2 included in the data center network shown in fig. 1, the controller may obtain the number of logical ports included in the TOR1, assuming that the number of logical ports included in the TOR1 is 50, and obtain the number of logical ports included in the TOR2, assuming that the number of logical ports included in the TOR2 is 80. The device identifier T1 of the TOR1 and the number 50 of logical ports included in the TOR1 are correspondingly stored in the correspondence relationship between the device identifier of the TOR and the number of logical ports as shown in table 2 below. And correspondingly storing the device identifier T2 of the TOR2 and the number 80 of logical ports included in the TOR2 in the correspondence relationship between the device identifier and the number of logical ports of the TOR as shown in the following table 2.
TABLE 2
Device identification of TOR Number of logical ports
T1 50
T2 80
…… ……
Optionally, the controller further stores a correspondence between the device identifier of the host and the number of the virtual machines. The correspondence relationship stores the device identifier of each host in the vCenter and the number of virtual machines in each host. For any host in vCenter, the controller obtains the number of virtual machines included in the host, and correspondingly stores the device identification of the host and the number of virtual machines included in the host in the corresponding relation between the device identification of the host and the number of virtual machines. When the number of the virtual machines included in the host changes, the controller also obtains the number of the virtual machines after the change of the host, and updates the number of the virtual machines included in the host into the number of the virtual machines after the change in the corresponding relation between the device identifier of the host and the number of the virtual machines.
For example, for the host 1 included in the vCenter shown in fig. 1, the controller may obtain the number of virtual machines included in the host 1, and assuming that the number of logical ports included in the host 1 is 20, correspondingly store the device identifier H1 of the host 1 and the number of virtual machines 20 included in the host 1 in the correspondence relationship between the device identifier of the host and the number of virtual machines shown in table 3 below. For the hosts, such as host 2, host 3, host 4, and host 5, included in the vCenter shown in fig. 1, the controller also stores the device identification H2 and the number of virtual machines 25 of host 2, the device identification H3 and the number of virtual machines 5 of host 3, the device identification H4 and the number of virtual machines 30 of host 4, and the device identification H5 and the number of virtual machines 50 of host 5 in the correspondence between the device identification and the number of virtual machines of the host shown in table 3 below.
TABLE 3
Device identification of host Number of virtual machines
H1 20
H2 25
H3 5
H4 30
H5 50
…… ……
For any one host in a vCenter, the virtual machine running on that host may be user-requested that the controller be established on that host. When a user needs to establish a virtual machine, a device corresponding to the user may send a creation request for requesting to create the virtual machine to the controller. The controller receives the create request and may provide a method of creating a virtual machine on one host of the vCenter by the embodiment shown in fig. 2 below. The method implementation process for creating a virtual machine will be described in detail below.
Referring to fig. 2, an embodiment of the present application provides a method for creating a virtual machine, where the method may be applied to the network architecture shown in fig. 1, and includes:
step 201: the controller receives a creation request including network information of a tenant network to which a virtual machine to be created belongs.
The network information of the tenant network may include a network identifier of the tenant network, network segment information corresponding to the tenant network, and a network identifier of a VLAN corresponding to the tenant network.
The tenant network corresponds to a service, and for a service packet belonging to the service, a packet header of the service packet may include network information of the tenant network. When receiving a service packet belonging to the service, a network device in the data center network may transmit the service packet based on network information of the tenant network included in the service packet.
In this step, when a user needs to create a virtual machine for running a service, the user may input network information of a tenant network corresponding to the service on a device corresponding to the user. The device acquires information of the tenant network, generates a creation request including the network information of the tenant network, and sends the creation request to the controller.
For example, in the network architecture shown in fig. 1, it is assumed that a device corresponding to a user sends a creation request to a controller, where the creation request includes network information of a tenant network, where the network information includes a network identifier N1 of the tenant network, network segment information "192.168.1.0 to 192.168.1.10" corresponding to the tenant network, and a network identifier V1 of a VLAN corresponding to the tenant network.
Step 202: the controller determines each TOR corresponding to the tenant network and load information of each TOR according to the network information of the tenant network.
In this step, referring to fig. 3, the controller may be implemented by the following steps 2021 to 2022. The steps 2021 to 2022 are:
2021: and the controller determines each TOR corresponding to the tenant network according to the corresponding relationship between the network information of the tenant network and the device identifier of the TOR and the network information of the tenant network.
In this step, the controller obtains the device identifier of each corresponding TOR from the correspondence between the network information of the tenant network and the device identifier of the TOR according to the network information of the tenant network, and determines the TOR corresponding to the device identifier of each TOR as the TOR corresponding to the tenant network.
For example, according to the network identifier N1 of the tenant network, the segment information "192.168.1.0 to 192.168.1.10" corresponding to the tenant network, and the network identifier V1 of the VLAN corresponding to the tenant network, which are included in the network information, the controller obtains the device identifiers of the TORs corresponding to the tenant network, which include T1 and T2, from the correspondence between the network information of the tenant network and the device identifiers of the TORs, which is shown in table 1. And determining that the TOR corresponding to the tenant network comprises a TOR1 corresponding to a device identifier T1 and a TOR2 corresponding to a device identifier T2.
2022: and the controller acquires the load information of each TOR from the corresponding relation between the equipment identifier of each TOR and the load information according to the equipment identifier of each TOR.
For any TOR, the load information of the TOR may be the number of logical ports of the TOR. The correspondence between the device identifier of the TOR and the load information may be a correspondence between the device identifier of the TOR and the number of logical ports.
Therefore, in this step, the controller obtains the number of logical ports of each TOR from the correspondence between the device identifier of each TOR and the number of logical ports according to the device identifier of each TOR.
For example, the controller has determined that the TOR corresponding to the tenant network includes TOR1 and TOR2, the controller obtains the number of logical ports included in TOR1 from the correspondence between the device identifier of the TOR and the number of logical ports as shown in table 2 according to the device identifier T1 of TOR1, and obtains the number of logical ports included in TOR2 from the correspondence between the device identifier of the TOR and the number of logical ports as shown in table 2 according to the device identifier T2 of TOR 2.
Step 203: the controller selects the TOR with the load information meeting the first condition from each TOR corresponding to the tenant network.
Optionally, the load information of each TOR is the number of logical ports included in each TOR, and in this step, the controller may select one TOR with the smallest number of logical ports from each TOR corresponding to the tenant network, or select one TOR with the number of logical ports smaller than the first threshold.
For example, in step 203, the controller acquires that the number of logical ports included in the TOR1 corresponding to the tenant network is 50, and the number of logical ports included in the TOR2 corresponding to the tenant network is 80. In this step, the controller may select the TOR1 with the smallest number of logical ports from the TORs 1 and 2 corresponding to the tenant network.
Step 204: the controller selects one host from at least one host connected to the selected TOR.
A network topology map of the entire network may be maintained in the controller. For example, for the network architecture shown in fig. 1, the controller may maintain a network topology diagram of the network architecture shown in fig. 1.
Therefore, in this step, the controller may obtain, from the network topology map, the device identifier of each host connected to the selected TOR, and obtain, according to the device identifier of each host, the number of virtual machines included in each host from the correspondence between the device identifier of the host and the number of virtual machines; and selecting the hosts of which the number of virtual machines meets a second condition from each host.
Optionally, in this step, the controller may select, from each host, hosts whose number of virtual machines meets the second condition in the following two ways:
first, the controller selects the host with the smallest number of virtual machines, or selects the host with the number of virtual machines smaller than a second threshold.
In the first way, usually each host in the vCenter includes the same or a smaller amount of computing resources, and the controller selects the host with the smallest number of virtual machines, or selects the host with the number of virtual machines smaller than the second threshold value, and creates the virtual machines on the selected host, so as to achieve load balancing among each host.
For example, the TOR selected by the controller is TOR1, referring to fig. 1, the controller acquires from the network topology that the hosts connected to TOR1 include host 1, host 2, and host 3, the device identifier of host 1 is H1, the device identifier of host 2 is H2, and the device identifier of host 3 is H3. Thus, the controller obtains the number of virtual machines included in the host 1 as 20, the number of virtual machines included in the host 2 as 25, and the number of virtual machines included in the host 3 as 5 from the correspondence between the device identifier of the host and the number of virtual machines shown in table 3, respectively, based on the device identifier H1 of the host 1, the device identifier H2 of the host 2, and the device identifier H3 of the host 3. The controller then selects host 3, which includes the smallest number of virtual machines, from among host 1, host 2, and host 3.
Secondly, the controller calculates the ratio between the total amount of computing resources included in each host and the number of virtual machines; the host with the largest ratio or the host with the ratio larger than the third threshold value is selected.
Optionally, the controller may store a correspondence between the device identifier of the host and the total amount of computing resources. When the host is deployed in the vCenter, the controller may obtain the device identifier and the total amount of computing resources of the host, and store the device identifier and the total amount of computing resources of the host in a corresponding relationship between the device identifier and the total amount of computing resources of the host.
Optionally, after a host is deployed, an address of the controller may be configured in the host, so that the host may actively report the device identifier and the total amount of computing resources included in the device identifier to the controller according to the address of the controller. The controller receives a device identification of the host and a total amount of computing resources included by the host. Alternatively, the first and second electrodes may be,
after a host is deployed, a technician may input a device identifier of the host to a controller, and the controller sends a query request to the host according to the device identifier of the host. The host receives the query request and sends its device identification and the total amount of computing resources it includes to the controller. The controller receives a device identification of the host and a total amount of computing resources included by the host.
Optionally, the total amount of computing resources of the host may include the number of CPUs of the host and/or the size of the memory space of the host.
In the second mode, the controller obtains the total amount of computing resources included in each host from the corresponding relationship between the device identifier of the host and the total amount of computing resources according to the device identifier of each host. Calculating the ratio of the total amount of computing resources included in each host to the number of virtual machines; the host with the largest ratio or the host with the ratio larger than the third threshold value is selected.
In a second approach, the total amount of computing resources included in each host in the vCenter may be different. And the larger the host ratio, the more free resources on the host that are available to create the virtual machine. Selecting the host with the largest ratio or selecting the host with the ratio larger than the third threshold value can realize the load balance among each host.
Step 205: and the controller creates a virtual machine to be created on the selected host according to the network information of the tenant network.
Optionally, the controller sends a creation request to the selected host, the creation request including network information of the tenant network. And the selected host receives the creation request and creates the virtual machine belonging to the tenant network according to the network information of the tenant network.
Optionally, after the selected host creates the virtual machine, a creation success message may also be sent to the controller, and after receiving the creation success message, the controller sends the creation success message to the device corresponding to the user, and obtains, according to the device identifier of the selected host, the number of virtual machines included in the selected host in the correspondence between the device identifier of the host and the number of virtual machines, and increases the number of virtual machines included in the selected host in the correspondence between the device identifier of the host and the number of virtual machines.
For example, the host selected by the controller is host 3, and a creation request including network information of the tenant network is sent to host 3 according to the device identification H3 of host 3. The host 3 receives the creation request, creates a virtual machine belonging to the tenant network according to the network information of the tenant network, and sends a creation success message to the controller. After receiving the creation success message, the controller sends the creation success message to the device corresponding to the user, and according to the device identifier H3 of the host 3, obtains the number of virtual machines 5 included in the host 3 in the corresponding relationship between the device identifier of the host and the number of virtual machines shown in table 3, adds the number of virtual machines included in the selected host 3 in the corresponding relationship between the device identifier of the host and the number of virtual machines, where the added number of virtual machines is 6, and the obtained result is shown in table 4 below.
TABLE 4
Device identification of host Number of virtual machines
H1 20
H2 25
H3 6
H4 30
H5 50
…… ……
After creating a virtual machine on a selected host, a user may deploy a service on the created virtual machine that establishes a network connection with the selected TOR. And when the logical port corresponding to the service exists on the TOR, the TOR establishes network connection with the virtual machine through the logical port corresponding to the service, and the network connection connects the virtual machine and the logical port on the TOR. Under the condition that the logical port corresponding to the service does not exist on the TOR, the TOR firstly creates the logical port corresponding to the service, and then establishes network connection with the virtual machine through the logical port corresponding to the service, wherein the network connection connects the virtual machine and the logical port on the TOR.
After the network connection is established, the virtual machine may send the service packet of the service to the TOR through the network connection, and the TOR sends the service packet to the wide area network through the Spine and the GW. Or, the TOR receives a service packet of the service from a wide area network, and sends the service packet of the service to the virtual machine through the network connection.
Optionally, after the TOR creates a logical port, the TOR may send an update request to a controller, where the update request includes a device identifier of the TOR and a number of logical ports included in the TOR. The controller receives the update request, reads the device identifier of the TOR and the number of logical ports included in the TOR from the update request, obtains the number of logical ports included in the TOR from the corresponding relationship between the device identifier of the TOR and the number of logical ports according to the device identifier of the TOR, and updates the number of logical ports included in the TOR to the read number of logical ports in the corresponding relationship between the device identifier of the TOR and the number of logical ports.
For example, for the selected TOR1, it is assumed that during the process of the TOR1 establishing a network connection with a virtual machine on the host 3, the TOR1 creates logical ports, and at this time, the TOR1 includes 51 logical ports. The TOR1 may send an update request to the controller, the update request including the device identification H1 of the TOR1 and the number 51 of logical ports included by the TOR 1. The controller receives the update request, and reads the device identifier H1 of the TOR1 and the number 51 of logical ports included in the TOR1 from the update request. The controller obtains the logical port number 50 included in the TOR1 from the corresponding relationship between the device identifier and the logical port number of the TOR shown in table 2 according to the device identifier H1 of the TOR1, and updates the logical port number 50 included in the TOR1 to the read logical port number 51 to obtain the corresponding relationship between the device identifier and the logical port number of the TOR shown in table 5.
TABLE 5
Device identification of TOR Number of logical ports
T1 51
T2 80
…… ……
In the embodiment of the application, when a creation request for creating a virtual machine is received, a controller obtains load information of each TOR corresponding to a tenant network according to network information of the tenant network to which the virtual machine to be created belongs, the network information including the network information of the tenant network, so that the TOR with the load information meeting a first condition can be selected from each TOR, and the virtual machine is created on a host connected with the TOR, thereby realizing load balancing among TORs corresponding to the tenant network, avoiding the problem that a TOR is frequently selected, which causes a large amount of services transmitted on the TOR, and avoiding the problem that the TOR corresponding to the tenant network is easy to generate network congestion and the like. In addition, for each host connected with the selected TOR, the number of virtual machines in each host is also obtained, the hosts of which the number meets the second condition are selected from each host, and the virtual machines are established on the selected hosts, so that load balancing can be realized among the hosts, and the phenomenon that the service operation is influenced due to the overlarge load of one host is avoided.
Referring to fig. 4, an apparatus 300 for creating a virtual machine is provided in an embodiment of the present application, where the apparatus 300 may be deployed on a controller in the above embodiment shown in fig. 1 or fig. 2, and includes:
a receiving unit 301, configured to receive a creation request, where the creation request includes network information of a tenant network to which a virtual machine to be created belongs;
a processing unit 302, configured to determine, according to the network information, a data center switch TOR corresponding to the tenant network, where load information meets a first condition;
the processing unit 302 is further configured to create a virtual machine to be created on a host connected to the TOR according to the network information.
Optionally, the processing unit 302 determines a detailed implementation procedure of the TOR corresponding to the tenant network and meeting the first condition, which may refer to relevant contents in steps 202 and 203 in the embodiment shown in fig. 2. And, the processing unit 302 creates a detailed implementation procedure of the virtual machine to be created on the host connected to the TOR, which can refer to the related contents in step 204 and step 205 in the embodiment shown in fig. 2.
Optionally, the load information of the TOR includes a number of logical ports in the TOR, where the number of logical ports is used to reflect a number of services transmitted on the TOR;
a processing unit 302 for:
acquiring the number of logic ports in each TOR corresponding to the tenant network according to the network information;
and selecting one TOR with the smallest number of logical ports from each TOR, or selecting one TOR with the number of logical ports smaller than a first threshold value.
Optionally, the detailed implementation process of the processing unit 302 for obtaining the number of the logical ports can refer to the relevant contents in steps 2021 and 2022 in the embodiment shown in fig. 2.
Optionally, the processing unit 302 is configured to:
determining each TOR corresponding to the tenant network according to the corresponding relationship between the network information of the tenant network and the device identifier of the TOR and the network information;
and acquiring the number of the logical ports in each TOR from the corresponding relation between the device identifier of each TOR and the number of the logical ports according to the device identifier of each TOR.
Optionally, the processing unit 302 is configured to:
acquiring the number of virtual machines included in each host connected with the TOR, and selecting the host of which the number meets a second condition;
and creating a virtual machine to be created on the selected host according to the network information.
Optionally, the processing unit 302 selects a detailed implementation process of the host, which can be referred to as related content in step 204 in the embodiment shown in fig. 2.
Optionally, the processing unit 302 is configured to:
acquiring a device identifier of each host connected to the TOR from a network topology map of a network managed by the apparatus 300, where the network includes the TOR and each host;
and acquiring the number of the virtual machines in each host from the corresponding relation between the equipment identifier of the host and the number of the virtual machines according to the equipment identifier of each host.
Optionally, the processing unit 302 is configured to:
and selecting the host with the minimum number of virtual machines, or selecting the host with the number of virtual machines smaller than a second threshold value.
Optionally, the processing unit 302 is configured to:
calculating the ratio of the total amount of computing resources included in each host to the number of virtual machines;
the host with the largest ratio or the host with the ratio larger than the third threshold value is selected.
Optionally, the detailed implementation process of the processing unit 302 calculating the ratio of each host can be seen in the related content in step 204 in the embodiment shown in fig. 2.
In an embodiment of the present application, a receiving unit receives a creation request, where the creation request includes network information of a tenant network to which a virtual machine to be created belongs. And the processing unit determines that the load information meets a first condition and the TOR corresponds to the tenant network according to the network information, and creates a virtual machine to be created on a host connected with the TOR according to the network information. Because the processing unit selects the TOR of which the load information meets the first condition from the TORs corresponding to the tenant network, and then creates the virtual machine on the host connected with the TOR, load balancing between the TORs corresponding to the tenant network can be realized, and the problem that the number of services transmitted on the TOR is large due to frequent selection of a certain TOR is avoided, so that the load of the TOR is reduced, and the problems that the network congestion is generated by the TOR corresponding to the tenant network and the like are avoided.
Referring to fig. 5, fig. 5 is a schematic diagram illustrating an apparatus 400 for creating a virtual machine according to an embodiment of the present application. The device may be the controller or a part of the controller in the embodiment shown in fig. 1 or fig. 2. The apparatus 400 comprises at least one processor 401, a bus system 402, a memory 403 and at least one transceiver 404.
The apparatus 400 is a hardware structure apparatus, and can be used to implement the functional modules in the apparatus 300 described in fig. 4. For example, one skilled in the art may appreciate that the processing unit 302 in the apparatus 300 shown in fig. 4 may be implemented by the at least one processor 401 calling code in the memory 403, and the receiving unit 301 in the apparatus 300 shown in fig. 4 may be implemented by the transceiver 404.
Optionally, the apparatus 400 can also be used to implement the functions of the controller in any of the above embodiments.
Alternatively, the processor 401 may be a general processing unit (CPU), a microprocessor, an application-specific integrated circuit (ASIC), or one or more ics for controlling the execution of programs according to the present disclosure.
The bus system 402 may include a path that transfers information between the components.
The transceiver 404 is used for communication with other devices or communication networks.
The memory 403 may be a read-only memory (ROM) or other types of static storage devices that can store static information and instructions, a Random Access Memory (RAM) or other types of dynamic storage devices that can store information and instructions, an electrically erasable programmable read-only memory (EEPROM), a compact disc read-only memory (CD-ROM) or other optical disk storage, optical disk storage (including compact disc, laser disc, optical disc, digital versatile disc, blu-ray disc, etc.), magnetic disk storage media or other magnetic storage devices, or any other medium that can be used to carry or store desired program code in the form of instructions or data structures and that can be accessed by a computer, but is not limited to these. The memory may be self-contained and coupled to the processor via a bus. The memory may also be integral to the processor.
The memory 403 is used for storing application program codes for executing the scheme of the application, and the processor 401 controls the execution. The processor 401 is configured to execute application program code stored in the memory 403 to cause the migration apparatus 400 to implement the functions of the method of the present patent.
In particular implementations, processor 401 may include one or more CPUs such as CPU0 and CPU1 in fig. 5 as an example.
In particular implementations, the apparatus 400 may include multiple processors, such as the processor 401 and the processor 407 in fig. 5, for example, as an embodiment. Each of these processors may be a single-core (single-CPU) processor or a multi-core (multi-CPU) processor. A processor herein may refer to one or more devices, circuits, and/or processing cores for processing data (e.g., computer program instructions).
It will be understood by those skilled in the art that all or part of the steps for implementing the above embodiments may be implemented by hardware, or may be implemented by a program instructing relevant hardware, where the program may be stored in a computer-readable storage medium, and the above-mentioned storage medium may be a read-only memory, a magnetic disk or an optical disk, etc.
The above description is only an example of the present application and should not be taken as limiting the present application, and any modifications, equivalents, improvements and the like that are made within the principles of the present application should be included in the scope of the present application.

Claims (14)

1. A method of creating a virtual machine, the method comprising:
the method comprises the steps that a controller receives a creation request, wherein the creation request comprises network information of a tenant network to which a virtual machine to be created belongs;
the controller determines a TOR of a data center switch, which meets a first condition and corresponds to the tenant network, of load information according to the network information;
and the controller creates the virtual machine to be created on the host connected with the TOR according to the network information.
2. The method of claim 1, wherein the load information of the TOR includes a number of logical ports in the TOR, the number of logical ports being used to reflect a number of traffics transmitted on the TOR;
the controller determines, according to the network information, a data center switch TOR corresponding to the tenant network and having load information satisfying a first condition, including:
the controller acquires the number of logic ports in each TOR corresponding to the tenant network according to the network information;
the controller selects one TOR with the smallest number of logical ports from each TOR, or selects one TOR with the number of logical ports smaller than a first threshold value.
3. The method of claim 2, wherein the controller obtains, according to the network information, the number of logical ports in each TOR corresponding to the tenant network, and includes:
the controller determines each TOR corresponding to the tenant network according to the corresponding relationship between the network information of the tenant network and the device identifier of the TOR and the network information;
and the controller acquires the number of the logical ports in each TOR from the corresponding relation between the device identifier of each TOR and the number of the logical ports according to the device identifier of each TOR.
4. The method according to any one of claims 1 to 3, wherein the controller, before creating the virtual machine to be created on the host connected to the TOR according to the network information, further comprises:
the controller acquires the number of virtual machines included in each host connected with the TOR, and selects the host with the number of virtual machines meeting a second condition;
the creating the virtual machine to be created on the host connected to the TOR according to the network information includes:
and the controller creates the virtual machine to be created on the selected host according to the network information.
5. The method of claim 4, wherein the controller obtaining the number of virtual machines included in each host connected to the TOR comprises:
the controller acquires the device identifier of each host connected with the TOR from a network topology map of a network managed by the controller, wherein the network comprises the TOR and each host;
and the controller acquires the number of the virtual machines in each host from the corresponding relation between the equipment identification of the host and the number of the virtual machines according to the equipment identification of each host.
6. The method of claim 4 or 5, wherein the selecting the number of hosts for which the virtual machines satisfy the second condition comprises:
the controller selects the host with the minimum number of virtual machines, or selects the host with the number of virtual machines smaller than a second threshold value.
7. The method of claim 4 or 5, wherein the selecting the number of hosts for which the virtual machines satisfy the second condition comprises:
the controller calculates the ratio between the total amount of computing resources included in each host and the number of virtual machines;
the controller selects the host with the largest ratio or the host with the ratio larger than a third threshold value.
8. An apparatus for creating a virtual machine, the apparatus comprising:
the virtual machine creating method comprises a receiving unit, a creating unit and a processing unit, wherein the receiving unit is used for receiving a creating request which comprises network information of a tenant network to which a virtual machine to be created belongs;
the processing unit is used for determining a data center switch TOR, corresponding to the tenant network, of which the load information meets a first condition according to the network information;
and the processing unit is further configured to create the virtual machine to be created on the host connected to the TOR according to the network information.
9. The apparatus of claim 8, wherein the load information of the TOR comprises a number of logical ports in the TOR, the number of logical ports being used to reflect a number of traffics transmitted on the TOR;
the processing unit is configured to:
acquiring the number of logic ports in each TOR corresponding to the tenant network according to the network information;
and selecting one TOR with the smallest number of logical ports from each TOR, or selecting one TOR with the number of logical ports smaller than a first threshold value.
10. The apparatus as recited in claim 9, said processing unit to:
determining each TOR corresponding to the tenant network according to the corresponding relation between the network information of the tenant network and the equipment identifier of the TOR and the network information;
and acquiring the number of the logical ports in each TOR from the corresponding relation between the device identifier of each TOR and the number of the logical ports according to the device identifier of each TOR.
11. The apparatus according to any of claims 8 to 10, wherein the processing unit is configured to:
acquiring the number of virtual machines included in each host connected with the TOR, and selecting the host of which the number meets a second condition;
and creating the virtual machine to be created on the selected host according to the network information.
12. The apparatus as recited in claim 11, said processing unit to:
acquiring a device identifier of each host connected to the TOR from a network topology map of a network managed by the device, wherein the network comprises the TOR and each host;
and acquiring the number of the virtual machines in each host from the corresponding relation between the equipment identifier of the host and the number of the virtual machines according to the equipment identifier of each host.
13. The apparatus as claimed in claim 11 or 12, wherein said processing unit is configured to:
and selecting the host with the minimum number of virtual machines, or selecting the host with the number of virtual machines smaller than a second threshold value.
14. The apparatus as claimed in claim 11 or 12, wherein said processing unit is configured to:
calculating the ratio between the total amount of computing resources included in each host and the number of virtual machines;
the host with the largest ratio or the host with the ratio larger than the third threshold value is selected.
CN201911276872.XA 2019-12-12 2019-12-12 Method and device for creating virtual machine Pending CN112988320A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201911276872.XA CN112988320A (en) 2019-12-12 2019-12-12 Method and device for creating virtual machine

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201911276872.XA CN112988320A (en) 2019-12-12 2019-12-12 Method and device for creating virtual machine

Publications (1)

Publication Number Publication Date
CN112988320A true CN112988320A (en) 2021-06-18

Family

ID=76332561

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201911276872.XA Pending CN112988320A (en) 2019-12-12 2019-12-12 Method and device for creating virtual machine

Country Status (1)

Country Link
CN (1) CN112988320A (en)

Similar Documents

Publication Publication Date Title
US11381507B2 (en) Virtual network device and related method
US10375015B2 (en) Methods and system for allocating an IP address for an instance in a network function virtualization (NFV) system
US11539626B2 (en) Method, apparatus, and system for load balancing of service chain
CN110113441B (en) Computer equipment, system and method for realizing load balance
WO2017045471A1 (en) Method and apparatus for acquiring service chain information in cloud computing system
CN108924268B (en) Container cloud service system and pod creation method and device
CN111865621B (en) Method and device for accessing gateway
US7359387B2 (en) Systems and methods for implementing virtual router
CN108933829A (en) A kind of load-balancing method and device
CN111371694B (en) Shunting method, device and system, processing equipment and storage medium
CN110012118B (en) Method and controller for providing Network Address Translation (NAT) service
WO2024093064A1 (en) Identifier management and forwarding optimization method and apparatus in large-scale multi-modal network
CN107809495B (en) Address management method and device
US20240048477A1 (en) Packet forwarding method, apparatus, and system, and computer-readable storage medium
WO2017185992A1 (en) Method and apparatus for transmitting request message
US20170257267A1 (en) Resource management device, resource management system, and computer-readable recording medium
CN107517129B (en) Method and device for configuring uplink interface of equipment based on OpenStack
CN110636149B (en) Remote access method, device, router and storage medium
EP4216510A1 (en) Method for acquiring address, apparatus and system
CN112988320A (en) Method and device for creating virtual machine
CN113904871A (en) Network slice access method, PCF entity, terminal and communication system
CN114531385B (en) Method, device and system for sending message
CN114531320A (en) Communication method, device, equipment, system and computer readable storage medium
WO2022012383A1 (en) Packet transmission method, apparatus, and system, and storage medium
JP2023527929A (en) Virtual network service deployment method and apparatus

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