1. Technical Field
Embodiments of the present disclosure relate to virtualization technology, and more particularly to a server and a method for deploying virtual machines in a network cluster.
2. Description of Related Art
Virtual machines (VM) are software implementations that creates one or more VMs in a server. A guest operating system (OS) is a virtualized environment, multiple guest OS can co-exist and run independently on the same server. A network cluster may include one or more servers with VMs, so that resources (e.g., such as CPU resource, hard disk resource) of the network cluster can serve more users. However, if two many VMs are deployed in the network cluster, the resources provided by the network cluster may be superfluous. On another hand, if a small number of VMs are deployed in the network cluster, the resources provided by the network cluster may be insufficient. Therefore, there is a room for improvement in the art.
The present disclosure, including the accompanying drawings, is illustrated by way of examples and not by way of limitation. It should be noted that references to “an” or “one” embodiment in this disclosure are not necessarily to the same embodiment, and such references mean “at least one.”
In general, the word “module”, as used herein, refers to logic embodied in hardware or firmware, or to a collection of software instructions, written in a programming language. One or more software instructions in the modules may be embedded in firmware, such as in an erasable programmable read only memory (EPROM). The modules described herein may be implemented as either software and/or hardware modules and may be stored in any type of non-transitory computer-readable medium or other storage device. Some non-limiting examples of non-transitory computer-readable media include CDs, DVDs, BLU-RAY, flash memory, and hard disk drives.
In one embodiment, the network cluster 2 includes one or more servers 100, and one or more VMs 10. The one or more VMs 10 may be created by the same server 100 or by different servers 100. For example, in
The DHCP server 1 is installed with a DHCP service. The DHCP server 1 assigns Internet protocol (IP) addresses to the servers 100 and the VMs 10. A hypervisor 11 of a server 100 monitors a resource utilization ratio of each VM 10. In one embodiment, the resource utilization ratio of the VM 10 includes a utilization ratio of the CPU resource allocated to the VM 10 (hereinafter “a CPU utilization ratio”), a utilization ratio of hard disk resource allocated to the VM 10 (hereinafter “a hard disk utilization ratio”), a utilization ratio of memory resource allocated to the VM 10 (hereinafter “a memory utilization ratio”), and a utilization ratio of network resource allocated to the VM 10 (hereinafter “a network utilization ratio”).
The hypervisor 11 determines a summation resource utilization ratio of the network cluster 2 based on the resource utilization ratios of all the VMs 10 within the network cluster 2. In one embodiment, the summation resource utilization ratio of the network cluster includes a summation of all the CPU utilization ratios (hereinafter, “a summation CPU utilization ratio”), a summation of hard disk utilization ratios (hereinafter, “a summation hard disk utilization ratio”), a summation of memory utilization ratios (hereinafter, “a summation memory utilization ratio”), and a summation of network utilization ratios (hereinafter, “a summation network utilization ratio”) of the network cluster 2. For example, the hypervisor 11 determines the summation CPU utilization ratio relating to the network cluster 2 by totaling the CPU utilization ratio of each VM 10, determines the summation hard disk utilization ratio of the network cluster 2 by totaling the hard disk utilization ratio of each VM 10, determines the summation memory utilization ratio of the network cluster 2 by totaling the memory utilization ratio of each VM 10, and determines the summation network utilization ratio of the network cluster 2 by totaling the network utilization ratio of each VM 10. For example, when there are three VMs 10 in the network cluster 2, if a first VM 10 has a CPU utilization ratio of 50%, a second VM 10 has a CPU utilization ratio of 45%, and a third VM 10 has a CPU utilization ratio of 55%, then a summation CPU utilization ratio of the network cluster 2 is totalized as (50+45+55)/(100+100+100)=50%.
When the hypervisor 11 determines that the summation resource utilization ratio of the network cluster 2 is more than a first preset ratio (such as 85%), the hypervisor 11 increases available resources of the network cluster 2 by creating a new VM 10. Otherwise, if the hypervisor 11 determines that the summation resource utilization ratio of the network cluster 2 is less than a second preset ratio (such as 30%), the hypervisor 11 decreases available resources of the network cluster 2 by deleting or suspending a VM 10 in the network cluster 2. In one embodiment, the hypervisor 11 will create a new VM 10 on condition that any one of the summation CPU utilization ratio, the summation hard disk utilization ratio, the summation memory utilization ratio, and the summation network utilization ratio of the network cluster 2 is more than the first preset ratio, such as the summation CPU utilization ratio of the network cluster is more than 85%. In another embodiment, the hypervisor 11 will create a new VM 10 on condition that each of the aforementioned four ratios is more than the first preset ratio, such as the summation CPU utilization ratio of the network cluster is more than 85%, the summation hard disk utilization ratio of the network cluster is more than 85%, the summation memory utilization ratio of the network cluster is more than 85%, and the summation network utilization ratio of the network cluster is more than 85%.
Similarly, in one embodiment, the hypervisor 11 will delete or suspend a previously-created VM 10 on condition that any one of the summation CPU utilization ratio, the summation hard disk utilization ratio, the summation memory utilization ratio, and the summation network utilization ratio of the network cluster 2 is less than the second preset ratio, such as the summation CPU utilization ratio of the network cluster is less than 30%. In another embodiment, the hypervisor 11 will delete or suspend a created VM 10 on condition that each of the aforementioned four ratios is less than the first preset ratio, such as the summation CPU utilization ratio of the network cluster is less than 30%, the summation hard disk utilization ratio of the network cluster is less than 30%, the summation memory utilization ratio of the network cluster is less than 30%, and the summation network utilization ratio of the network cluster is less than 30%.
In step S31, the hypervisor 11 in the server 100 sets template information for creating VMs 10, such as assigning memory resource, network resource, CPU resource, and network resource needed for creating the VMs 10. For example, creating a VM 10 with a first type may require one CPU, 2G of memory, and 100G of hard disk space, and creating a VM 10 with a second type may require two CPUs, 4G of memory, and 150G of hard disk space.
In step S32, the hypervisor 11 creates a VM 10 based on the template information, receives an IP address assigned to the VM 10 by the DHCP server 1, and deploys the VM 10 into the network cluster 2. For example, a VM 10 of the first type or of the second type may be created and deployed into the network cluster 2.
In step S33, the hypervisor 11 monitors a summation resource utilization ratio of the network cluster 2 based on the resource utilization ratios of all the VMs 10 in the network cluster 2. As mentioned above, the summation resource utilization ratio of the network cluster includes a summation CPU utilization ratio, a summation hard disk utilization ratio, a summation memory utilization ratio, and a summation network utilization ratio of the network cluster 2. For example, the summation CPU utilization ratio of the network cluster 2 may be determined by totaling the CPU utilization ratio of each VM 10. The summation hard disk utilization ratio of the network cluster 2 may be determined by totaling the hard disk utilization ratio of each VM 10. The summation memory utilization ratio of the network cluster 2 may be determined by totaling the memory utilization ratio of each VM 10. The summation network utilization ratio of the network cluster 2 may be determined by totaling the network utilization ratio of each VM 10.
In step S34, the hypervisor 11 determines if the summation resource utilization ratio of the network cluster 2 is more than a first preset ratio (such as 85%) or less than a second preset ratio (such as 30%). For example, in one embodiment, the hypervisor 11 determines if the summation CPU utilization ratio of the network cluster is more than 85% or less than 30%. If the summation resource utilization ratio of the network cluster 2 is more than the first preset ratio, the hypervisor 11 determines that resources provided by the network cluster 2 are insufficient, and step S35 is implemented. Otherwise, If the summation resource utilization ratio of the network cluster 2 is less than the second preset ratio, the hypervisor 11 determines that resources provided by the network cluster 2 are superfluous, and step S36 is implemented.
In step S35, the hypervisor 11 creates a new VM 10 based on the template information, and deploys the new created VM 10 into the network cluster 2, to increase available resources of the network cluster 2. Then, step S37 is implemented.
In step S36, the hypervisor 11 suspends or deletes a previously-created VM 10 in the network cluster 2, to decrease available resources of the network cluster 2. Then, step S37 is implemented.
In step S37, the hypervisor 11 determines whether a current summation resource utilization ratio of the network cluster 2 is between the second preset ratio and the first preset ratio, such as between 30% and 85%. If the current summation resource utilization ratio of the network cluster 2 remains more than the first preset ratio or remains less than the second preset ratio, the procedure returns to step S34. If the current summation resource utilization ratio of the network cluster 2 is between the second preset ratio and the first preset ratio, such as between 30% and 85%, the procedure ends.
The above embodiments dynamically increase or decrease available resources provided by the network cluster 2 based on the monitoring of resource utilization ratios of the network cluster 2.
Although certain disclosed embodiments of the present disclosure have been specifically described, the present disclosure is not to be construed as being limited thereto. Various changes or modifications may be made to the present disclosure without departing from the scope and spirit of the present disclosure.
Number | Date | Country | Kind |
---|---|---|---|
101105159 | Feb 2012 | TW | national |