Method and device for creating a virtual machine
By selecting the appropriate network switch (TOR) based on the network information of the tenant network in the virtualization management platform of the cloud computing data center to create a virtual machine, the excessive load and network congestion caused by random selection of hosts is solved, and load balancing between TORs and normal operation of services is achieved.
Patent Information
- Application Number
- CN201911276872.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2019-12-12
- Publication Date
- 2025-04-11
- Estimated Expiration
- 2039-12-12
AI Technical Summary
In the virtualization management platform of cloud computing data centers, random selection of hosts to create virtual machines causes excessive load on some network switches, which may cause problems such as network congestion.
The controller receives a request to create a virtual machine, determines a network switch (TOR) whose load information meets specific conditions based on the network information of the tenant network, and creates a virtual machine on the host connected to the TOR, thereby achieving load balancing between the TORs.
Through load balancing, a certain TOR is avoided from being frequently selected, the load of the TOR is reduced, the risk of network congestion is reduced, and the normal operation of the business is ensured.
Smart Images

Figure CN112988320B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of communications, and in particular to a method and device for creating a virtual machine. Background Art
[0002] The virtualization management software (vm ware virtual centerserver, vCenter) of cloud computing data center virtualization software company is a virtualization management platform that can include multiple hosts, each of which is connected to a data center switch (top of rank, TOR) in the network. Users can create virtual machines on the hosts included in vCenter, and the virtual machines on the hosts can transmit services on the network through the TOR connected to the hosts.
[0003] At present, when a user needs to create a virtual machine, he usually randomly selects a host from the multiple hosts included in vCenter, and then creates the virtual machine on the host. Since the host is randomly selected, for some TORs in the network, the host connected to the TOR may be frequently selected, resulting in a large number of virtual machines being established on the host. In this way, the large number of virtual machines transmit services through the TOR, resulting in a large number of services being transmitted on the TOR, resulting in a large load on the TOR, and easily causing network congestion on the TOR and other problems. Summary of the invention
[0004] The present application provides a method and device for creating a virtual machine to reduce the load of TOR and avoid network congestion on TOR. The technical solution is as follows:
[0005] In a first aspect, the present application provides a method for creating a virtual machine, in which a controller receives a creation request, the creation request including network information of a tenant network to which the virtual machine to be created belongs. Based on the network information, the controller determines a TOR corresponding to the tenant network whose load information satisfies a first condition. Based on the network information, the controller creates the virtual machine to be created on a host connected to the TOR. Since a TOR whose load information satisfies the first condition is selected from the TOR corresponding to the tenant network, and then a virtual machine is created on the host connected to the TOR, load balancing can be achieved between the TORs corresponding to the tenant networks, avoiding a certain TOR being frequently selected, resulting in a large number of services transmitted on the TOR, thereby reducing the load on the TOR and avoiding problems such as network congestion at the TOR corresponding to the tenant network.
[0006] In one possible implementation, the load information of the TOR includes the number of logical ports in the TOR, and the number of logical ports is used to reflect the number of services transmitted on the TOR. The controller obtains the number of logical ports in each TOR corresponding to the tenant network based on the network information. The controller selects a TOR with the smallest number of logical ports from each TOR, or selects a TOR with a number of logical ports less than a first threshold. Since the TOR with the smallest number of logical ports or the TOR with a number of logical ports less than the first threshold is selected, and the number of logical ports is used to reflect the number of services transmitted on the TOR, it is ensured that the number of services transmitted on the selected TOR is 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 services, network congestion and other problems will not occur.
[0007] In another possible implementation, the controller determines each TOR corresponding to the tenant network based on the correspondence between the network information of the tenant network and the device identifier of the TOR and the network information. The controller obtains the number of logical ports in each TOR from the correspondence between the device identifier of the TOR and the number of logical ports based on the device identifier of each TOR. Since the controller stores the correspondence between the network information of the tenant network and the device identifier of the TOR, as well as the correspondence between the device identifier of the TOR and the number of logical ports, the controller can obtain the number of logical ports of each TOR corresponding to the tenant network through the two correspondences, so that load balancing can be performed on each TOR based on the number of logical ports of each TOR.
[0008] In another possible implementation, 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 meets the second condition. The controller creates the virtual machine to be created on the selected host based on the network information. For each host connected to the selected TOR, the number of virtual machines in each host is also obtained, and a host whose number of virtual machines meets the second condition is selected from each host, and a virtual machine is created on the selected host, so that load balancing can be achieved between each host, avoiding excessive load on a host and affecting business operations.
[0009] In another possible implementation, the controller obtains the device identification of each host connected to the selected TOR from a network topology map of a network managed by the controller, and the network includes the selected TOR and each host. The controller obtains the number of virtual machines in each host from the correspondence between the device identification of the host and the number of virtual machines based on the device identification of each host. Since the controller includes a network topology map, the device identification 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 correspondence based on the device identification of each host, so that load balancing can be achieved between each host based on the number of virtual machines in each host.
[0010] In another possible implementation, the controller selects a host with the smallest number of virtual machines, or selects a host with a number of virtual machines less than the second threshold. Since the host with the smallest number of virtual machines or the host with a number of virtual machines less than the second threshold is selected, it is ensured that the load on the selected host is relatively small, and creating a virtual machine on the selected host will not cause an excessive load on the selected host, thereby affecting business operations.
[0011] In another possible implementation, 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 selects the host with a ratio greater than a third threshold. The larger the ratio of the host, the more idle resources on the host that can be used to create virtual machines. Therefore, the controller selects the host with the largest ratio or selects the host with a ratio greater than the third threshold. When creating virtual machines on the selected hosts, some hosts will not have a large load and some hosts will not have a small load, thereby avoiding the occurrence of load imbalance.
[0012] In a second aspect, the present application provides a device for creating a virtual machine, which is used to execute the method in the first aspect or any possible implementation of the first aspect. Specifically, the device includes a unit for executing the method in the first aspect or any possible implementation of the first aspect.
[0013] In a third aspect, the present application provides a device for creating a virtual machine, the device comprising: a processor, a memory, and a transceiver. The processor, the memory, and the transceiver may be connected via a bus system. The memory is used to store one or more programs, and the processor is used to execute one or more programs in the memory, so that the migration device completes the method in the first aspect or any possible implementation of the first aspect.
[0014] In a fourth aspect, the present application provides a computer-readable storage medium, in which program code is stored. When the computer-readable storage medium is run on a computer, the computer executes the method in the above-mentioned first aspect or any possible implementation of the first aspect.
[0015] In a fifth aspect, the present application provides a computer program product comprising program codes, which, when executed on a computer, enables the computer to execute the method in the above-mentioned first aspect or any possible implementation manner of the first aspect. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] Figure 1 This is a schematic diagram of a network architecture provided by an embodiment of the present application;
[0017] Figure 2 This is a flow chart of a method for creating a virtual machine provided in an embodiment of the present application;
[0018] Figure 3 It is a flowchart of determining each TOR corresponding to a tenant network and the load information of each TOR provided by an embodiment of the present application;
[0019] Figure 4 It is a schematic diagram of the structure of a device for creating a virtual machine provided in an embodiment of the present application;
[0020] Figure 5 It is a schematic diagram of the structure of another device for creating a virtual machine provided in an embodiment of the present application. DETAILED DESCRIPTION
[0021] The implementation methods of the present application will be further described in detail below with reference to the accompanying drawings.
[0022] See also Figure 1 The embodiment of the present application provides a network architecture, which includes a controller, a vCenter, and a data center network. The controller can manage the vCenter and the data center network.
[0023] vCenter includes multiple hosts, and the data center network includes at least one gateway (GW), at least one backbone switch (Spine), at least one TOR and other network devices.
[0024] For any TOR in the data center network, the TOR is connected to at least one host in the vCenter, and the TOR is also connected to one or more spines. For any spine, the spine is also connected to one or more GWs, and each GW can also be connected to a wide area network. For example, a GW can be connected to an edge router (PE) of a wide area network.
[0025] A network connection may be established between the controller and a network device in the data center network, and the controller may manage the network device in the data center network through the network connection to achieve management of the data center network. Also, a network connection may be established between the controller and a host in the vCenter, and the controller may manage the host in the vCenter through the network connection to achieve management of the vCenter.
[0026] In this network architecture, users can deploy services in the host of vCenter. The user can be an enterprise, organization or individual. When a user needs to deploy a service, the user can send a service application request to the controller through its corresponding device. The controller allocates a network identifier of a tenant network, applies for the network segment information and VLAN network identifier corresponding to the tenant network, and allocates at least one TOR for the tenant network. In this way, the user can create at least one virtual machine on the 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.
[0027] One TOR can be assigned to multiple different tenant networks, and virtual machines belonging to different tenant networks can be created on the host connected to the TOR.
[0028] Optionally, the controller stores the correspondence between the network information of the tenant network and the device identification of the TOR. After the controller allocates at least one TOR to a tenant network, the controller can store the network information of the tenant network and the device identification of each allocated TOR in the correspondence between the network information of the tenant network and the device identification of the TOR.
[0029] The network information of the tenant network may include the network identifier of the tenant network, the network segment information corresponding to the tenant network, and the network identifier of the 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 IP address segment as an example, the network segment information assigned by the controller to 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 for 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.
[0030] Assume again that the controller allocates TOR1 and TOR2 to the tenant network, so that the controller can save the network information of the tenant network, the allocated device identifier T1 of TOR1 and the device identifier T2 of TOR2 in the following representation 1:
[0031] Table 1
[0032]
[0033] For any host in vCenter, the host includes computing resources required for running virtual machines, and the computing resources may be a central processing unit (CPU) or memory, etc.
[0034] After applying for a tenant network, the user can request the controller to create a virtual machine. At the user's request, the controller can create a virtual machine on the host in vCenter, and the virtual machine can be used to run the service corresponding to the tenant network. The virtual machine can be connected to the data center network through the TOR connected to the host, and can transmit service messages belonging to the service on the data center network. The detailed process of the controller creating a virtual machine on the host will be described later. Figure 2 The invention is described in the embodiment shown in the figure and will not be described in detail here.
[0035] For the 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 the virtual machine running on the host, and for the service running on the virtual machine, the virtual machine can establish a network connection with the TOR, and the network connection is used to connect the virtual machine and the logical port corresponding to the service on the TOR. In this way, the virtual machine can send the service message of the service to the TOR through the network connection, and the TOR receives the service message of the service through the logical port, and sends the service message of the service to the wide area network through the Spine and GW connected to the TOR. Alternatively, the TOR can receive the service message of the service from the wide area network, and send the service message of the service to the virtual machine through the logical port corresponding to the service.
[0036] Since TOR establishes a network connection with a virtual machine through a logical port, and the TOR transmits the business of the virtual machine through the logical port, the more logical ports in the TOR, the more virtual machines that establish a network connection with the TOR, and the more business transmitted in the TOR.
[0037] Optionally, the controller also stores the correspondence between the device identification and load information of the TOR. The correspondence stores the device identification of each TOR in the data center network and the load information of each TOR. The load information of the TOR may be the number of logical ports in the TOR, etc.
[0038] Optionally, for any TOR in the data center network, the controller obtains the load information of the TOR, and stores the device identification of the TOR and the load information of the TOR in correspondence between the device identification of the TOR and the load information. When the load information in the TOR changes, the controller also obtains the load information of the TOR after the change, and updates the load information of the TOR to the load information after the change in the correspondence between the device identification of the TOR and the load information.
[0039] For example, taking the load information as the number of logical ports, Figure 1 The data center network shown includes TOR1 and TOR2. The controller can obtain the number of logical ports included in TOR1, assuming that the number of logical ports included in TOR1 is 50, and obtain the number of logical ports included in TOR2, assuming that the number of logical ports included in TOR2 is 80. The device identifier T1 of TOR1 and the number of logical ports 50 included in TOR1 are correspondingly saved in the corresponding relationship between the device identifier and the number of logical ports of TOR as shown in Table 2 below. And, the device identifier T2 of TOR2 and the number of logical ports 80 included in TOR2 are correspondingly saved in the corresponding relationship between the device identifier and the number of logical ports of TOR as shown in Table 2 below.
[0040] Table 2
[0041] TOR device identification Number of logical ports T1 50 T2 80 …… ……
[0042] Optionally, the controller also stores a correspondence between the device identification of the host and the number of virtual machines. The correspondence stores the device identification of each host in the vCenter and the number of virtual machines in each host. For any host in the vCenter, the controller obtains the number of virtual machines included in the host, and stores the device identification of the host and the number of virtual machines included in the host in a correspondence between the device identification of the host and the number of virtual machines. When the number of virtual machines included in the host changes, the controller also obtains the number of virtual machines after the change, and updates the number of virtual machines included in the host to the number of virtual machines after the change in the correspondence between the device identification of the host and the number of virtual machines.
[0043] For example, for Figure 1The vCenter shown includes host 1, and the controller can obtain the number of virtual machines included in host 1. Assuming that the number of logical ports included in host 1 is 20, the device identifier H1 of host 1 and the number of virtual machines 20 included in host 1 are correspondingly saved in the corresponding relationship between the device identifier of the host and the number of virtual machines shown in Table 3 below. Figure 1 The vCenter shown includes hosts such as host 2, host 3, host 4 and host 5. The controller also saves the device identification H2 of host 2 and the number of virtual machines 25, the device identification H3 of host 3 and the number of virtual machines 5, the device identification H4 of host 4 and the number of virtual machines 30, and the device identification H5 of host 5 and the number of virtual machines 50 in the correspondence between the device identification of the host and the number of virtual machines as shown in Table 3 below.
[0044] Table 3
[0045] The device ID of the host Number of virtual machines H1 20 H2 25 H3 5 H4 30 H5 50 …… ……
[0046] For any host in vCenter, the virtual machine running on the host can be created by the user requesting the controller to create the virtual machine. When the user needs to create a virtual machine, the device corresponding to the user can send a creation request to the controller to request the creation of the virtual machine. The controller receives the creation request and can Figure 2 The embodiment shown provides a method for creating a virtual machine to create the virtual machine on a host of vCenter. Next, the implementation process of the method for creating a virtual machine will be described in detail.
[0047] See also Figure 2 The present invention provides a method for creating a virtual machine. Figure 1 The network architecture shown includes:
[0048] Step 201: The controller receives a creation request, which includes network information of a tenant network to which the virtual machine to be created belongs.
[0049] The network information of the tenant network may include the network identifier of the tenant network, the network segment information corresponding to the tenant network, and the network identifier of the VLAN corresponding to the tenant network.
[0050] The tenant network corresponds to a service, and for a service message belonging to the service, the message header of the service message may include network information of the tenant network. When a network device in the data center network receives a service message belonging to the service, it may transmit the service message based on the network information of the tenant network included in the service message.
[0051] In this step, when a user needs to create a virtual machine for running a certain service, the user can enter the network information of the tenant network corresponding to the service on the corresponding device. The device obtains the 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.
[0052] For example, in Figure 1 In the network architecture shown, it is assumed that the device corresponding to the user sends a creation request to the controller, and the creation request includes the network information of the tenant network, and the network information includes the network identifier N1 of the tenant network, the network 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.
[0053] Step 202: The controller determines each TOR corresponding to the tenant network and the load information of each TOR according to the network information of the tenant network.
[0054] In this step, see Figure 3 , the controller can be implemented by the following steps 2021 to 2022. The steps 2021 to 2022 are respectively:
[0055] 2021: The controller determines each TOR corresponding to the tenant network based on the correspondence between the network information of the tenant network and the device identifier of the TOR, as well as the network information of the tenant network.
[0056] In this step, the controller obtains the corresponding device identifier of each TOR based on the network information of the tenant network and the correspondence between the network information of the tenant network and the device identifier of the TOR, and determines the TOR corresponding to the device identifier of each TOR as the TOR corresponding to the tenant network.
[0057] For example, the controller obtains the device identifiers of the TOR corresponding to the tenant network, including T1 and T2, from the correspondence between the network information of the tenant network and the device identifiers of the TOR as shown in Table 1, based on the network identifier N1 of the tenant network included in the network information, the network 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. It is determined that the TOR corresponding to the tenant network includes TOR1 corresponding to the device identifier T1 and TOR2 corresponding to the device identifier T2.
[0058] 2022: The controller obtains the load information of each TOR from the correspondence between the device identifier of each TOR and the load information.
[0059] For any TOR, the load information of the TOR may be the number of logical ports of the TOR. Therefore, the correspondence between the device identification of the TOR and the load information may be the correspondence between the device identification of the TOR and the number of logical ports.
[0060] Therefore, in this step, the controller obtains the number of logical ports of each TOR from the corresponding relationship between the device identifier of the TOR and the number of logical ports according to the device identifier of each TOR.
[0061] 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 as 50 from the correspondence between the device identifier of TOR and the number of logical ports shown in Table 2 based on the device identifier T1 of TOR1, and obtains the number of logical ports included in TOR2 as 80 from the correspondence between the device identifier of TOR and the number of logical ports shown in Table 2 based on the device identifier T2 of TOR2.
[0062] Step 203: The controller selects a TOR whose load information satisfies a first condition from each TOR corresponding to the tenant network.
[0063] Optionally, the load information of each TOR is the number of logical ports included in each TOR. In this step, the controller can select a TOR with the smallest number of logical ports from each TOR corresponding to the tenant network, or select a TOR with a logical port number less than the first threshold.
[0064] For example, in step 203, the controller obtains that the number of logical ports included in TOR1 corresponding to the tenant network is 50, and the number of logical ports included in TOR2 corresponding to the tenant network is 80. In this step, the controller can select TOR1 with the smallest number of logical ports from TOR1 and TOR2 corresponding to the tenant network.
[0065] Step 204: The controller selects a host from at least one host connected to the selected TOR.
[0066] The controller can save the network topology of the entire network. Figure 1 The network architecture shown in the figure can be saved by the controller Figure 1 Network topology diagram of the network architecture shown.
[0067] Therefore, in this step, the controller can obtain the device identification of each host connected to the selected TOR from the network topology map, and according to the device identification of each host, obtain the number of virtual machines included in each host from the correspondence between the device identification of the host and the number of virtual machines; and select a host from each host whose number of virtual machines meets the second condition.
[0068] Optionally, in this step, the controller may select a host whose number of virtual machines meets the second condition from each host in the following two ways:
[0069] First, the controller selects a host with a minimum number of virtual machines, or selects a host with a number of virtual machines less than a second threshold.
[0070] In the first method, usually the total amount of computing resources included in each host in vCenter is the same or has a small difference. The controller selects the host with the smallest number of virtual machines, or selects the host with the number of virtual machines less than the second threshold, and creates virtual machines on the selected host, so that load balancing can be achieved between each host.
[0071] For example, the controller selects TOR1, see Figure 1 , the controller obtains from the network topology diagram 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. In this way, the controller obtains the number of virtual machines included in host 1 as 20, the number of virtual machines included in host 2 as 25, and the number of virtual machines included in host 3 as 5 from the corresponding relationship between the device identifier of the host and the number of virtual machines shown in Table 3, based on the device identifier H1 of host 1, the device identifier H2 of host 2, and the device identifier H3 of host 3. Then the controller selects host 3 with the smallest number of virtual machines from host 1, host 2, and host 3.
[0072] Second, the controller calculates the ratio between the total amount of computing resources included in each host and the number of virtual machines; selects the host with the largest ratio or selects the host with a ratio greater than a third threshold.
[0073] Optionally, the controller may save the correspondence between the device identification of the host and the total amount of computing resources. When deploying a host in vCenter, the controller may obtain the device identification and the total amount of computing resources of the host, and save the device identification and the total amount of computing resources of the host in the correspondence between the device identification and the total amount of computing resources of the host.
[0074] Optionally, after deploying a host, the address of the controller can be configured in the host, so that the host can actively report its device identification and the total amount of computing resources it includes to the controller based on the address of the controller. The controller receives the device identification of the host and the total amount of computing resources included in the host. Or,
[0075] After deploying a host, the technician can input the device ID of the host into the controller, and the controller sends a query request to the host based on the device ID of the host. The host receives the query request and sends its device ID and the total amount of computing resources it includes to the controller. The controller receives the device ID of the host and the total amount of computing resources included in the host.
[0076] 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, etc.
[0077] In the second mode, the controller obtains the total amount of computing resources included in each host from the corresponding relationship between the device identification of each host and the total amount of computing resources, calculates the ratio between the total amount of computing resources included in each host and the number of virtual machines, and selects the host with the largest ratio or the host with a ratio greater than a third threshold.
[0078] In the second mode, the total amount of computing resources included in each host in vCenter may be different. The larger the ratio of the host, the more idle resources on the host that can be used to create virtual machines. The host with the largest ratio or the host with a ratio greater than the third threshold is selected, which can achieve load balancing between each host.
[0079] Step 205: The controller creates a virtual machine to be created on a selected host according to the network information of the tenant network.
[0080] Optionally, the controller sends a creation request to the selected host, the creation request including the network information of the tenant network. The selected host receives the creation request and creates a virtual machine belonging to the tenant network according to the network information of the tenant network.
[0081] Optionally, after the selected host creates the virtual machine, it can also send 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, based on the device identification of the selected host, obtains the number of virtual machines included in the selected host in the corresponding relationship between the device identification of the host and the number of virtual machines, and increases the number of virtual machines included in the selected host in the corresponding relationship between the device identification of the host and the number of virtual machines.
[0082] For example, the host selected by the controller is host 3. According to the device identifier H3 of host 3, a creation request is sent to host 3, and the creation request includes the network information of the tenant network. 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 host 3, obtains the number of virtual machines 5 included in host 3 in the correspondence between the device identifier of the host and the number of virtual machines shown in Table 3, and increases the number of virtual machines included in the selected host 3 in the correspondence between the device identifier of the host and the number of virtual machines. The increased number of virtual machines is 6, and the result is shown in Table 4 below.
[0083] Table 4
[0084] The device ID of the host Number of virtual machines H1 20 H2 25 H3 6 H4 30 H5 50 …… ……
[0085] After creating a virtual machine on the selected host, the user can deploy a service on the created virtual machine, and the virtual machine establishes a network connection with the selected TOR. Wherein, if there is a logical port corresponding to the service on the TOR, the TOR establishes a network connection with the virtual machine through the logical port corresponding to the service, and the network connection connects the virtual machine with the logical port on the TOR. If there is no logical port corresponding to the service on the TOR, the TOR first creates a logical port corresponding to the service, and then establishes a network connection with the virtual machine through the logical port corresponding to the service, and the network connection connects the virtual machine with the logical port on the TOR.
[0086] After the network connection is established, the virtual machine can send the service message of the service to the TOR through the network connection, and the TOR sends the service message to the wide area network through the spine and GW. Alternatively, the TOR receives the service message of the service from the wide area network and sends the service message of the service to the virtual machine through the network connection.
[0087] Optionally, after the TOR creates the logical port, the TOR may send an update request to the controller, the update request including the device identification of the TOR and the number of logical ports included in the TOR. The controller receives the update request, reads the device identification 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 correspondence between the device identification of the TOR and the number of logical ports according to the device identification of the TOR, and updates the number of logical ports included in the TOR to the read number of logical ports in the correspondence between the device identification of the TOR and the number of logical ports.
[0088] For example, for the selected TOR1, suppose that in the process of TOR1 establishing a network connection with the virtual machine on the host 3, TOR1 creates a logical port, and the number of logical ports included in TOR1 is 51 at this time. TOR1 can send an update request to the controller, and the update request includes the device identification H1 of TOR1 and the number of logical ports 51 included in TOR1. The controller receives the update request, and reads the device identification H1 of TOR1 and the number of logical ports 51 included in TOR1 from the update request. The controller obtains the number of logical ports 50 included in TOR1 from the correspondence between the device identification and the number of logical ports of TOR shown in Table 2 based on the device identification H1 of TOR1, and updates the number of logical ports 50 included in TOR1 to the read number of logical ports 51, and obtains the correspondence between the device identification and the number of logical ports of TOR as shown in Table 5.
[0089] Table 5
[0090] TOR device identification Number of logical ports T1 51 T2 80 …… ……
[0091] In an embodiment of the present application, when the controller receives a creation request for creating a virtual machine, the controller obtains the load information of each TOR corresponding to the tenant network according to the network information of the tenant network to which the virtual machine to be created belongs included in the creation request, so that a TOR whose load information meets the first condition can be selected from each TOR, and a virtual machine is created on the host connected to the TOR, so that load balancing can be achieved between the TORs corresponding to the tenant networks, avoiding a certain TOR being frequently selected, resulting in a large number of services transmitted on the TOR, and avoiding the TOR corresponding to the tenant network from being prone to network congestion and other problems. In addition, for each host connected to the selected TOR, the number of virtual machines in each host is also obtained, and a host whose number of virtual machines meets the second condition is selected from each host, and a virtual machine is created on the selected host, so that load balancing can be achieved between each host, avoiding a certain host being overloaded and affecting business operations.
[0092] See also Figure 4 The embodiment of the present application provides a device 300 for creating a virtual machine, and the device 300 can be deployed in the above Figure 1 or Figure 2 The controller in the embodiment shown includes:
[0093] A receiving unit 301 is configured to receive a creation request, wherein the creation request includes network information of a tenant network to which the virtual machine to be created belongs;
[0094] A processing unit 302 is configured to determine, based on the network information, a data center switch TOR whose load information satisfies a first condition and corresponds to the tenant network;
[0095] 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.
[0096] Optionally, the detailed implementation process of the processing unit 302 determining the TOR that meets the first condition and corresponds to the tenant network can be found in Figure 2 The relevant contents of steps 202-203 in the embodiment shown. And the detailed implementation process of the processing unit 302 creating a virtual machine to be created on the host connected to the TOR can be found in Figure 2 The relevant contents in steps 204-205 in the illustrated embodiment.
[0097] Optionally, the load information of the TOR includes the number of logical ports in the TOR, where the number of logical ports is used to reflect the number of services transmitted on the TOR;
[0098] The processing unit 302 is configured to:
[0099] According to the network information, the number of logical ports in each TOR corresponding to the tenant network is obtained;
[0100] A TOR with the smallest number of logical ports is selected from each TOR, or a TOR with a number of logical ports less than a first threshold is selected.
[0101] Optionally, the detailed implementation process of the processing unit 302 obtaining the number of logical ports can be found in Figure 2 Relevant content in steps 2021-2022 in the illustrated embodiment.
[0102] Optionally, the processing unit 302 is configured to:
[0103] Determine 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;
[0104] According to the device identifier of each TOR, the number of logical ports in each TOR is obtained from the corresponding relationship between the device identifier of the TOR and the number of logical ports.
[0105] Optionally, the processing unit 302 is configured to:
[0106] Obtain the number of virtual machines included in each host connected to the TOR, and select a host whose number of virtual machines meets the second condition;
[0107] According to the network information, a virtual machine to be created is created on the selected host.
[0108] Optionally, the detailed implementation process of the processing unit 302 selecting the host can be found in Figure 2The relevant contents in step 204 in the illustrated embodiment.
[0109] Optionally, the processing unit 302 is configured to:
[0110] Obtaining a device identification of each host connected to the TOR from a network topology diagram of a network managed by the apparatus 300, the network including the TOR and each host;
[0111] According to the device identification of each host, the number of virtual machines in each host is obtained from the corresponding relationship between the device identification of the host and the number of virtual machines.
[0112] Optionally, the processing unit 302 is configured to:
[0113] A host with the smallest number of virtual machines is selected, or a host with the number of virtual machines smaller than a second threshold is selected.
[0114] Optionally, the processing unit 302 is configured to:
[0115] Calculate the ratio between the total amount of computing resources included in each host and the number of virtual machines;
[0116] The host with the largest ratio is selected or the host with a ratio greater than a third threshold is selected.
[0117] Optionally, the detailed implementation process of the processing unit 302 calculating the ratio of each host can be found in Figure 2 The relevant contents in step 204 in the illustrated embodiment.
[0118] In an embodiment of the present application, a receiving unit receives a creation request, which includes network information of a tenant network to which the virtual machine to be created belongs. Based on the network information, the processing unit determines a TOR corresponding to the tenant network whose load information satisfies the first condition, and creates the virtual machine to be created on a host connected to the TOR based on the network information. Since the processing unit selects a TOR whose load information satisfies the first condition from the TOR corresponding to the tenant network, and then creates a virtual machine on the host connected to the TOR, load balancing can be achieved between the TORs corresponding to the tenant networks, avoiding a certain TOR being frequently selected, resulting in a large number of services transmitted on the TOR, thereby reducing the load on the TOR and avoiding problems such as network congestion on the TOR corresponding to the tenant network.
[0119] See also Figure 5 , Figure 5 The schematic diagram of a device 400 for creating a virtual machine provided in an embodiment of the present application is shown. Figure 1 or Figure 2The controller or part of the controller in the embodiment shown in the figure. The device 400 includes at least one processor 401 , a bus system 402 , a memory 403 and at least one transceiver 404 .
[0120] The device 400 is a hardware structure device that can be used to implement Figure 4 The functional modules in the device 300 are as follows. For example, those skilled in the art may think of Figure 4 The processing unit 302 in the device 300 shown can be implemented by the at least one processor 401 calling the code in the memory 403. Figure 4 The receiving unit 301 in the device 300 shown may be implemented by the transceiver 404 .
[0121] Optionally, the device 400 may also be used to implement the function of the controller in any of the above embodiments.
[0122] Optionally, the processor 401 may be a general-purpose central processing unit (CPU), a microprocessor, an application-specific integrated circuit (ASIC), or one or more integrated circuits for controlling the execution of the program of the present application.
[0123] The bus system 402 may include a path to transmit information between the components.
[0124] The transceiver 404 is used to communicate with other devices or communication networks.
[0125] 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, or an electrically erasable programmable read-only memory (EEPROM), a compact disc read-only memory (CD-ROM) or other optical disc storage, optical disc storage (including compressed optical disc, laser disc, optical disc, digital versatile disc, Blu-ray disc, etc.), a magnetic disk storage medium or other magnetic storage device, or any other medium that can be used to carry or store the desired program code in the form of instructions or data structures and can be accessed by a computer, but is not limited thereto. The memory may exist independently and be connected to the processor via a bus. The memory may also be integrated with the processor.
[0126] The memory 403 is used to store the application code for executing the solution of the present application, and the execution is controlled by the processor 401. The processor 401 is used to execute the application code stored in the memory 403, so that the migration device 400 realizes the functions of the method of the present patent.
[0127] In a specific implementation, as an embodiment, the processor 401 may include one or more CPUs, such as Figure 5 CPU0 and CPU1 in.
[0128] In a specific implementation, as an embodiment, the device 400 may include multiple processors, such as Figure 5 401 and processor 407 in the embodiment of the present invention. Each of these processors may be a single-CPU processor or a multi-CPU processor. The processor herein may refer to one or more devices, circuits, and / or processing cores for processing data (e.g., computer program instructions).
[0129] A person skilled in the art will understand that all or part of the steps to implement the above embodiments may be accomplished by hardware or by instructing related hardware through a program, and the program may be stored in a computer-readable storage medium, and the above-mentioned storage medium may be a read-only memory, a disk or an optical disk, etc.
[0130] The above description is only an optional embodiment of the present application and is not intended to limit the present application. Any modifications, equivalent substitutions, improvements, etc. made within the principles of the present application shall be included in the protection scope of the present application.
Claims
1. A method for creating a virtual machine, characterized in that: The method comprises: The controller receives a creation request, wherein the creation request includes network information of a tenant network to which the virtual machine to be created belongs; The controller determines, based on the network information, that the load information satisfies a first condition and that the data center switch TOR corresponds to the tenant network; The controller creates the virtual machine to be created on a host connected to the TOR according to the network information; The load information of the TOR includes the number of logical ports in the TOR, the TOR includes at least one logical port, and for each logical port, the logical port corresponds to a service. The host connected to the TOR includes a virtual machine for running the service, and the virtual machine is connected to the logical port using a network connection. The network connection is used to transmit service messages of the service, and the number of logical ports is used to reflect the number of services transmitted on the TOR; The controller determines, according to the network information, a data center switch TOR whose load information satisfies a first condition and corresponds to the tenant network, including: The controller obtains the number of logical ports in each TOR corresponding to the tenant network according to the network information; The controller selects a TOR with the smallest number of logical ports from each TOR, or selects a TOR with a number of logical ports less than a first threshold.
2. The method according to claim 1, characterized in that The controller obtains, according to the network information, the number of logical ports in each TOR corresponding to the tenant network, including: 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; The controller obtains the number of logical ports in each TOR according to the device identifier of each TOR and from the corresponding relationship between the device identifier of the TOR and the number of logical ports.
3. The method according to claim 1 or 2, characterized in that The controller, before creating the virtual machine to be created on the host connected to the TOR according to the network information, further includes: The controller obtains the number of virtual machines included in each host connected to the TOR, and selects a host whose number of virtual machines meets the second condition; The step of creating the virtual machine to be created on a host connected to the TOR according to the network information includes: The controller creates the virtual machine to be created on the selected host according to the network information.
4. The method according to claim 3, characterized in that The controller obtains the number of virtual machines included in each host connected to the TOR, including: The controller obtains a device identification of each host connected to the TOR from a network topology diagram of a network managed by the controller, the network including the TOR and each host; The controller obtains the number of virtual machines in each host from the corresponding relationship between the device identification of the host and the number of virtual machines according to the device identification of each host.
5. The method according to claim 3, characterized in that The selecting a host whose number of virtual machines meets the second condition includes: The controller selects a host with a minimum number of virtual machines, or selects a host with a number of virtual machines less than a second threshold.
6. The method according to claim 3, characterized in that The selecting a host whose number of virtual machines meets the second condition includes: 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 host with the largest ratio or selects the host with a ratio greater than a third threshold.
7. A device for creating a virtual machine, characterized in that: The device comprises: A receiving unit, configured to receive a creation request, wherein the creation request includes network information of a tenant network to which the virtual machine to be created belongs; A processing unit, configured to determine, based on the network information, a data center switch TOR whose load information satisfies a first condition and corresponds to the tenant network; The processing unit is further configured to create the virtual machine to be created on a host connected to the TOR according to the network information; The load information of the TOR includes the number of logical ports in the TOR, the TOR includes at least one logical port, and for each logical port, the logical port corresponds to a service. The host connected to the TOR includes a virtual machine for running the service, and the virtual machine is connected to the logical port using a network connection. The network connection is used to transmit service messages of the service, and the number of logical ports is used to reflect the number of services transmitted on the TOR; The processing unit determines, according to the network information, a data center switch TOR whose load information satisfies a first condition and corresponds to the tenant network, including: According to the network information, obtain the number of logical ports in each TOR corresponding to the tenant network; A TOR with the smallest number of logical ports is selected from each of the TORs, or a TOR with a number of logical ports less than a first threshold is selected.
8. The device according to claim 7, characterized in that The processing unit is used for: Determine 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; According to the device identifier of each TOR, the number of logical ports in each TOR is obtained from the corresponding relationship between the device identifier of the TOR and the number of logical ports.
9. The device according to claim 7 or 8, characterized in that The processing unit is used for: Obtain the number of virtual machines included in each host connected to the TOR, and select a host whose number of virtual machines meets the second condition; The virtual machine to be created is created on the selected host according to the network information.
10. The device according to claim 9, characterized in that The processing unit is used for: Acquire a device identification of each host connected to the TOR from a network topology diagram of a network managed by the device, the network including the TOR and each host; According to the device identification of each host, the number of virtual machines in each host is obtained from the corresponding relationship between the device identification of the host and the number of virtual machines.
11. The device according to claim 9, characterized in that The processing unit is used for: A host with the smallest number of virtual machines is selected, or a host with the number of virtual machines smaller than a second threshold is selected.
12. The device according to claim 9, characterized in that The processing unit is used for: 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 is selected or the host with a ratio greater than a third threshold is selected.
Citation Information
Patent Citations
Virtual machine creation method and system, and host computer
WO2018036103A1