Detailed Description
The application provides a virtual machine creating method and device, and aims to solve the problem that a set type virtual machine cannot occupy specific resources when the virtual machine is created in the prior art. The method and the device are based on the same inventive concept, and because the principles of solving the problems of the method and the device are similar, the implementation of the device and the method can be mutually referred, and repeated parts are not repeated.
Hereinafter, some terms related to the embodiments of the present application are explained to facilitate understanding by those skilled in the art.
(1) The requirement parameter of the virtual machine is used to characterize the conditions required for creating the virtual machine, for example, the requirement parameter of the virtual machine may be resource information required for creating the virtual machine, such as the size of memory required for creating the virtual machine, the number of processor cores occupied for creating the virtual machine, the type of processor creating the virtual machine, and the like. Specifically, the requirement parameters of the virtual machine may be characterized by labels (keywords for identifying different requirement parameters), such as character strings or characters.
The demand parameters of the virtual machine comprise a first type demand parameter and a second type demand parameter. The first-class demand parameters refer to necessary conditions for creating the virtual machine, that is, the first-class demand parameters of the virtual machine satisfy all first-class deployment conditions corresponding to the nodes for creating the virtual machine. For example, if the first type requirement parameter of the virtual machine VM1 is a ', node a possesses the first type deployment condition a', and a 'satisfies a', then node a may be used to create VM1, and if node a also possesses the first type deployment condition B ', or the first type requirement parameter of VM1 also includes B' (and B 'does not satisfy a'), then node a may not be used to create VM 1.
The second type demand parameters refer to sufficient conditions for creating the virtual machine, namely the second type demand parameters of the virtual machine meet part or all of the second type deployment conditions corresponding to the nodes for creating the virtual machine. For example, if the second type requirement parameter of the virtual machine VM1 is a, the node 0 has the second type deployment condition a, and a satisfies a, then the node 0 may be used to create the VM1, and if the node 0 also has the second type deployment condition B, then the node 0 may also be used to create the VM 1.
(2) The deployment condition of the node is used to characterize the condition that the node can provide in the process of creating the virtual machine, for example, the deployment condition of the node may be resource information of the node, such as the available memory size of the node, the number of available cores in the processor of the node, and the like.
The deployment conditions of the nodes comprise a first type of deployment condition and a second type of deployment condition. The first type deployment condition is used for being matched with the first type demand parameters to meet the first type demand parameters, and the second type deployment condition is used for being matched with the second type demand parameters to meet the second type demand parameters. Specifically, when the demand parameters of the virtual machine are represented by tags, the deployment conditions of the nodes are also represented by the tags.
For example, the deployment condition corresponding to the node 1 is a second type deployment condition represented by a label a, the deployment condition corresponding to the node 2 is a first type deployment condition represented by a label B ', the deployment condition corresponding to the node 3 includes a first type deployment condition and a second type deployment condition represented by a label B' and a label a, respectively (a & B '), the requirement parameter of the virtual machine 1 is a second type requirement parameter represented by a label a, the requirement parameter of the virtual machine 2 is a first type requirement parameter represented by a label B', the requirement parameter of the virtual machine 3 includes a first type requirement parameter and a second type requirement parameter represented by labels B 'and a, respectively (a & B'), as shown in fig. 2, the node 1 can only be used for creating the virtual machine 1, the node 2 can only be used for creating the virtual machine 2, the node 3 can be used for creating the virtual machine 2 and the virtual machine 3, cannot be used to create virtual machine 1.
For another example, the deployment condition corresponding to the node 1 is a first-class deployment condition and is represented by a label a ', the deployment condition corresponding to the node 2 is a first-class deployment condition and is represented by a label B', the deployment condition corresponding to the node 3 is two first-class deployment conditions and is represented by labels a 'and B', respectively, (a '& B'), the requirement parameter of the virtual machine 1 is a first-class requirement parameter and is represented by a label a ', the requirement parameter of the virtual machine 2 is a first-class requirement parameter and is represented by a label B', the requirement parameter of the virtual machine 3 includes two first-class requirement parameters and is represented by labels a 'and B', respectively (a '& B'), as shown in fig. 3, the node 1 can only be used for creating the virtual machine 1, the node 2 can only be used for creating the virtual machine 2, and the node 3 can only be used for creating the virtual machine 3.
(3) Plural means two or more.
In addition, it is to be understood that the terms first, second, etc. used in the description of the present application are used for distinguishing between descriptions and not necessarily for describing a sequential or chronological order.
In order to more clearly describe the technical solution of the embodiment of the present application, a method and an apparatus for creating a virtual machine provided in the embodiment of the present application are described in detail below with reference to the accompanying drawings.
The virtual machine creation method provided by the embodiment of the application can be applied to a cluster system formed by a plurality of nodes, such as a cloud computing cluster system. Fig. 4 shows a possible communication system architecture to which the virtual machine creation method provided in the embodiment of the present application is applicable, where the system 400 includes a client 401, a control node 402, and a plurality of nodes 403 managed by the control node 402. The control node 402 and the plurality of nodes 403 may be servers.
The client 401 is configured to send a virtual machine creation request to the control node 402, where the virtual machine creation request includes a first type demand parameter and/or a second type demand parameter of a virtual machine to be created. The client may be a terminal device (such as a personal computer, an industrial personal computer, etc.), a server, or any one of the nodes 403.
The control node 402 can obtain deployment conditions (first type deployment conditions and/or second type deployment conditions) corresponding to a plurality of nodes 403 managed by the control node 402, and when a virtual machine creation request sent by a client is received, a target node for creating the virtual machine is determined according to requirement parameters (first type requirement parameters and/or second type requirement parameters) of the virtual machine carried in the virtual machine creation request and the deployment conditions corresponding to the plurality of nodes 403, and the received virtual machine creation request is forwarded to the determined target node.
The nodes 403 are configured to provide respective corresponding deployment conditions to the control node 402, and when receiving a virtual machine creation request forwarded by the control node, create a virtual machine according to a requirement parameter of the virtual machine carried in the virtual machine creation request.
Alternatively, the control node 402 and the plurality of nodes 403 managed by the control node 402 may communicate in a wired or wireless manner to provide the control node 402 with the respective deployment conditions and receive the virtual machine creation request forwarded by the control node 402. For example, the control node 402 and the plurality of nodes 403 may be interconnected via a wireless network, such as a wireless-fidelity (Wi-Fi).
Based on the communication system 400, an embodiment of the present application provides a virtual machine creation method, which is shown in fig. 5 and includes the following steps:
s501: the first client sends a first virtual machine creation request to the control node. The first virtual machine creating request comprises first type demand parameters of the first virtual machine.
Correspondingly, the control node receives a first virtual machine creation request sent by a first client. The first type requirement parameter of the first virtual machine can be one or more. For example, the first type demand parameter of the first virtual machine is a ', or the first type demand parameter of the first virtual machine is a', b ', and c'.
Specifically, the first client is a device capable of communicating with the control node, and may be one of nodes managed by the control node, a server, or a terminal device, such as a personal computer, an industrial personal computer, or the like.
S502: and the control node determines a first target node for creating the first virtual machine in the managed nodes according to the first type demand parameters of the first virtual machine.
And the first type demand parameters of the first virtual machine meet all first type deployment conditions corresponding to the first target node. That is to say, the first type deployment conditions corresponding to the first target node only include the first type deployment conditions matched with the first type requirement parameters of the first virtual machine. When the first type demand parameters of the first virtual machine are N, the number of all the first type deployment conditions corresponding to the first target node is at most N, and the first type deployment conditions corresponding to the first target node only include the first type deployment conditions matched with the first type demand parameters of the first virtual machine, where N is a positive integer. If a first type deployment condition corresponding to the first target node can be matched with N first type demand parameters of the first virtual machine at the same time and can only be matched with the N first type demand parameters, the number of all the first type deployment conditions corresponding to the first target node can be less than N, N is more than 1 and less than or equal to N, and N is a positive integer; if one first-class deployment condition corresponding to the first target node can only match one first-class requirement parameter, all the first-class deployment conditions corresponding to the first target node are N.
In a specific implementation, when the first type demand parameters of the first virtual machine and the first type deployment conditions corresponding to the nodes managed by the control node are both represented by tags, since it is determined whether the first type demand parameters of the first virtual machine satisfy the first type deployment conditions of the nodes managed by the control node by determining whether the tags corresponding to the first type demand parameters of the first virtual machine are consistent with the tags corresponding to the first type deployment conditions of the nodes managed by the control node, if the first type demand parameters of the first virtual machine are N, then all the first type deployment conditions corresponding to the first target node are N.
For example, if the first type demand parameter of the first virtual machine is a ', then the first target node can only have the first type deployment condition a' matching a ', and cannot have other first type deployment conditions except the first type deployment condition a', and if the first type demand parameter of the first virtual machine is a 'and B', then the first target node can only have the first type deployment condition a 'matching a' and the first type deployment condition B 'matching B', and cannot have other first type deployment conditions except the first type deployment conditions a 'and B'.
In an implementation, the control node may determine, among the managed plurality of nodes, a first target node that creates the first virtual machine by: determining a plurality of candidate nodes in a plurality of managed nodes, wherein the first-class demand parameters of the first virtual machine meet all first-class deployment conditions corresponding to the candidate nodes; and selecting one of the candidate nodes as the first target node according to a preset rule. Wherein the preset rules include, but are not limited to, any one or more of the following: the available memory of the candidate node is maximum, the processor occupancy rate of the candidate node is minimum, the number of virtual machines which are created on the candidate node is minimum, the load number of the candidate node is minimum, and the like.
Optionally, the first virtual machine creation request further includes a second type demand parameter of the first virtual machine, and the second type demand parameter of the first virtual machine satisfies a part of or all of the second type deployment conditions corresponding to the first target node. That is to say, when the first virtual machine request includes both the first type demand parameters of the first virtual machine and the second type demand parameters of the first virtual machine, the first type deployment conditions corresponding to the first target node may only include the first type deployment conditions matched with the first type demand parameters of the first virtual machine, and the second type deployment conditions corresponding to the first target node at least include the second type deployment conditions matched with the second type demand parameters of the first virtual machine (the first target node may also have the second type deployment conditions other than the second type deployment conditions matched with the second type demand parameters of the first virtual machine). The second type demand parameter of the first virtual machine may be one or more.
Specifically, when a first virtual machine creation request includes N first-class requirement parameters and M second-class requirement parameters of a first virtual machine, all first-class deployment conditions corresponding to the first target node are at most N, and only first-class deployment conditions matched with the first-class requirement parameters of the first virtual machine are included in the first-class deployment conditions corresponding to the first target node, and only second-class deployment conditions matched with the M second-class requirement parameters of the first virtual machine are included in second-class deployment conditions corresponding to the first target node, that is, the first target node may include second-class deployment conditions other than the second-class deployment conditions matched with the M second-class requirement parameters of the first virtual machine, where M, N is a positive integer.
For example, when the first type demand parameter of the first virtual machine included in the first virtual machine creation request is a ', and the second type demand parameter of the first virtual machine is a, the first type deployment condition corresponding to the first target node can only be a first type deployment condition a ' matched with a ', and the second type deployment condition corresponding to the first target node at least includes a second type deployment condition a matched with a; when the first type demand parameter of the first virtual machine included in the first virtual machine creation request is a ', the second type demand parameter of the first virtual machine is a and B, the first type deployment condition corresponding to the first target node can only be the first type deployment condition a ' matched with a ', and the second type deployment condition corresponding to the first target node at least comprises the second type deployment condition a matched with a and the second type deployment condition B matched with B; when the first type demand parameters of the first virtual machine included in the first virtual machine creation request are a 'and B', and the second type demand parameters of the first virtual machine are a, B and C, the first type deployment condition corresponding to the first target node can only be a first type deployment condition a 'matched with a' and a first type deployment condition B 'matched with B', and the second type deployment condition corresponding to the first target node at least includes a second type deployment condition a matched with a, a second type deployment condition B matched with B, and a second type deployment condition C matched with C.
In an implementation, when the first virtual machine creation request further includes the second type requirement parameter of the first virtual machine, the control node may determine, in the managed plurality of nodes, a first target node for creating the first virtual machine by: (1) determining a plurality of candidate nodes in a plurality of managed nodes, wherein the first type demand parameters of the first virtual machine meet all first type deployment conditions corresponding to the candidate nodes, and the second type demand parameters of the first virtual machine meet part or all second type deployment conditions corresponding to the candidate nodes; (2) and selecting one of the candidate nodes as the first target node according to a preset rule.
In summary, the first virtual machine requirement parameter carried in the first virtual machine creation request sent by the client includes the following two cases: (1) the first virtual machine creation request only carries first type demand parameters of the first virtual machine; (2) and the first type demand parameters and the second type demand parameters of the first virtual machine are carried in the first virtual machine creation request. Since the nodes capable of creating the first virtual machine must have the first type deployment condition matching the first type requirement parameter of the first virtual machine, and cannot have other first type deployment conditions except the first type deployment condition matching the first type requirement parameter of the first virtual machine, when the control node determines to create the first target node of the first virtual machine among the managed nodes, the control node can preferentially determine the first target node from the nodes having the first type deployment condition, so that the first target node can be determined quickly, the creation efficiency of the first virtual machine can be improved, and the workload of the control node for determining the first target node can be reduced.
In one embodiment, the control node may determine a plurality of candidate nodes among the managed nodes by: (1) acquiring deployment conditions corresponding to a plurality of nodes managed by the control node; (2) removing nodes which do not have the first type of deployment condition from the plurality of nodes; (3) and respectively matching the first type demand parameters of the first virtual machine with the deployment conditions of the nodes with the first type deployment conditions to determine a plurality of candidate nodes.
In implementation, the control node may obtain the deployment condition corresponding to each of the plurality of nodes managed by the control node by, but not limited to, any one of the following manners: in a first mode, a plurality of nodes managed by the control node periodically report the deployment conditions corresponding to the nodes to the control node; in a second mode, the control node sends requests for acquiring node deployment conditions to the managed nodes respectively, so that the nodes send the deployment conditions corresponding to the nodes to the control node after receiving the requests.
Specifically, when one deployment condition corresponding to a node managed by a control node can only match one requirement parameter of a virtual machine, for example, when both the requirement parameter of the virtual machine and the deployment condition corresponding to the node managed by the control node are represented by tags, as shown in fig. 6, for any one node in the nodes managed by the control node, the control node may determine whether the any one node is a candidate node capable of creating the first virtual machine by:
s601: and acquiring a demand parameter of the first virtual machine.
In implementation, the control node acquires different demand parameters from one demand parameter of the first virtual machine at a time to traverse all the demand parameters of the first virtual machine. When the first virtual machine has a plurality of demand parameters, the plurality of demand parameters of the first virtual machine may be stored in the control node in a list form, so that the control node obtains each demand parameter in turn from the list of the sexual demand parameters of the first virtual machine when determining a candidate node from the managed plurality of nodes.
S602: and judging whether the demand parameters of the first virtual machine are acquired, if so, executing the step S603, otherwise, executing the step S607.
Specifically, if the demand parameter acquired by the control node is empty, it is determined that the demand parameter is not acquired, that is, the demand parameter acquired last time is the last demand parameter of the first virtual machine.
S603: and acquiring a deployment condition corresponding to the any node.
In implementation, the control node acquires different deployment conditions from the deployment conditions of any one node each time to traverse all the deployment conditions of any one node. When there are multiple deployment conditions in any one of the nodes, the multiple deployment conditions of any one of the nodes may be stored in the control node in a list form, so that the control node sequentially obtains each deployment condition from the deployment condition list of any one of the nodes when determining a candidate node from the managed multiple nodes.
S604: and judging whether the deployment condition of any one node is acquired, if so, executing step S605, otherwise, executing step S608.
Specifically, if the deployment condition obtained by the control node is empty, it is determined that there is no obtained deployment condition, that is, the last deployment condition obtained last time is the last deployment condition of any node.
S605: and matching the acquired demand parameters with the acquired deployment conditions, and judging whether the acquired demand parameters meet the acquired deployment conditions, if so, executing step S601, otherwise, executing step 606.
S606: judging whether the acquired deployment condition is a first type deployment condition, if so, executing a step S608, otherwise, executing a step S603;
s607: and judging whether a first type of deployment condition exists in deployment conditions which are not matched with the requirement parameters of the virtual machine in the deployment conditions corresponding to any node, if so, executing step S608, and otherwise, executing step S609.
S608: and determining that the any node is not a candidate node, and ending the process.
S609: determining that the arbitrary one node is a candidate node.
S503: the control node forwards the first virtual machine creation request to the first target node.
Correspondingly, the first target node receives the first virtual machine creation request, and creates the first virtual machine according to the first type demand parameters of the first virtual machine contained in the first virtual machine creation request.
In a possible embodiment, the control node may further receive a second virtual machine creation request sent by a second client, where the second virtual machine creation request only includes a second type requirement parameter of a second virtual machine; the control node determines to create a second target node of the second virtual machine in the managed nodes according to a second type demand parameter of the second virtual machine, wherein the second type demand parameter of the second virtual machine meets part or all of second type deployment conditions corresponding to the second target node, and the second target node does not have the first type deployment conditions; the control node forwards the second virtual machine creation request to the second target node, so that the second target node creates the second virtual machine according to the second virtual machine creation request. Therefore, in the embodiment of the application, a node having a first type of deployment condition in a plurality of nodes managed by the control node can only be used to create a virtual machine having a first type of demand parameter, and all the first type of demand parameters of the virtual machine to be created satisfy the first type of deployment condition corresponding to the node, so that a specific resource (a resource represented by the first type of deployment condition) on the node can be monopolized by a set type of virtual machine.
Because the nodes capable of creating the second virtual machine cannot have the first type of deployment condition, when the control node determines the second target node for creating the second virtual machine from the plurality of managed nodes, the control node can preferentially determine the second target node from the nodes not having the first type of deployment condition, so that the second target node can be determined quickly, the creation efficiency of the second virtual machine is improved, and the workload of the control node for determining the second target node can be reduced.
In a specific implementation, the control node may determine the second target node among the managed plurality of nodes by: (1) acquiring deployment conditions corresponding to a plurality of nodes managed by the control node; (2) removing nodes with the first type of deployment condition from the plurality of nodes; (3) respectively matching the second type demand parameters of the second virtual machine with the deployment conditions of the nodes without the first type deployment conditions to determine a plurality of candidate nodes; (4) and selecting one of the candidate nodes as the second target node according to a preset rule.
In an implementation, for any one of the nodes managed by the control node, a method for the control node to determine whether the any one node is a candidate node capable of creating the second virtual machine is the same as a method for the control node to determine whether the any one node is a candidate node capable of creating the first virtual machine, which is described in steps S601 to S609 and is not described herein again.
In another possible implementation, if the control node receives a third virtual machine creation request sent by a third client, and the third virtual machine creation request does not have a requirement parameter of a third virtual machine, that is, the third virtual machine does not have a requirement parameter, the control node determines a third target node that creates the third virtual machine among the managed nodes, and forwards the third virtual machine creation request to the third target node, so that the third target node creates the second virtual machine according to the second virtual machine creation request, where the third target node only has a second type of deployment condition.
In the virtual machine creation method provided by the application, a control node receives a first virtual machine creation request sent by a first client, determines a first target node for creating a first virtual machine in a plurality of nodes managed by the control node according to first type demand parameters of the first virtual machine carried in the first virtual machine creation request, and forwards the first virtual machine creation request to the first target node, so that the first target node can create the first virtual machine according to the demand parameters of the first virtual machine, wherein the first type demand parameters of the first virtual machine meet all first type deployment conditions corresponding to the target node. The first type demand parameters of the first virtual machine meet all first type deployment conditions corresponding to the first target node, that is, only nodes having the first type deployment conditions capable of being matched with the first type demand parameters of the first virtual machine among the plurality of nodes managed by the control node can create the first virtual machine, so that the first virtual machine can monopolize the first type deployment conditions matched with the first type demand parameters of the first virtual machine.
The following describes the virtual machine creation method provided by the present application in detail through two specific embodiments. The requirement parameters of the virtual machine to be created and the deployment conditions of the nodes are represented by labels, and the control Node-0 manages 5 nodes, namely Node-1, Node-2, Node-3, Node-4 and Node-5. Node-1 corresponds to a first type deployment condition, represented by label a ', Node-2 corresponds to a first type deployment condition and a second type deployment condition, represented by labels a ' and B, respectively, Node-3 also corresponds to a first type deployment condition and a second type deployment condition, represented by labels a ' and B, Node-4 corresponds to a second type deployment condition, represented by label B, Node-5 also corresponds to a second type deployment condition, represented by label B.
In the first embodiment, Node-1 has created virtual machines VM1 and VM2, VM1 and VM2 have been created as a first type demand parameter, which is denoted by label a ', Node-2 has created virtual machine VM4, VM4 has been created as a first type demand parameter and a second type demand parameter, which are denoted by label a' and label B, Node-3 has created virtual machines VM5 and VM6, VM6 has been created as a first type demand parameter and a second type demand parameter, which are denoted by label a 'and label B, VM6 has been a first type demand parameter, which is denoted by label a', Node-4 has created virtual machine VM7, VM7 has been a second type demand parameter, which is denoted by label B, VM-5 has created virtual machine VM8, and VM8 has been a second type demand parameter, denoted by label B.
The process of the client creating the virtual machine VM3 through the Node managed by the control Node-0, as shown in fig. 7, mainly includes the following steps:
(1) the client sends a virtual machine creation request to the control Node-0. The virtual machine creation request carries a label A 'of the virtual machine VM3, and the label A' represents a first type demand parameter of the VM 3.
(2) After receiving the virtual machine creation request, the control Node-0 sequentially matches the label A' of the VM3 with the labels of the nodes managed by the Node-0 respectively to determine candidate nodes capable of creating the VM 3.
In implementation, when the control Node-0 matches the tag a 'of the VM3 with the tags of the nodes managed by Node-0, if the tag of one Node managed by Node-0 and the tag a' of the VM3 do not exist in the Node, the matching is successful, the Node is determined to be a candidate Node capable of creating the VM3, otherwise, the matching is failed, and the Node is determined not to be capable of creating the VM 3. Since there is a tag a ' matching the tag a ' of VM3 among the tags of Node-1, Node-2, and Node-3, and there is no other tag for characterizing the first type of deployment condition, the tags of Node-4 and Node-5 do not match the tag a ' of VM3, Node-1, Node-2, and Node-3 among the nodes managed by Node-0 are candidate nodes capable of creating VM3, and Node-4 and Node-5 cannot create VM 3.
In a specific embodiment, the control Node-0 matches the label a' of the VM3 with the labels of the nodes managed by Node-0, respectively, through its own label filter.
(3) The control Node-0 selects Node-2 as the target Node for creating the VM3 from Node-1, Node-2 and Node-3 according to the preset rules.
(4) The control Node-0 forwards the virtual machine creation request to Node-2.
Correspondingly, Node-2 receives the virtual machine creation request, and creates VM3 according to the virtual machine creation request.
In the second embodiment, a virtual machine VM1 and a virtual machine VM2 have been created on Node-1, a requirement parameter of VM1 and a virtual machine VM2 is a first-class requirement parameter and is represented by a label a ', a virtual machine VM3 and a virtual machine VM4 have been created on Node-2, a requirement parameter of VM3 is a first-class requirement parameter and is represented by a label a ', a requirement parameter of VM4 is a first-class requirement parameter and a second-class requirement parameter and is represented by a label a ' and a label B, respectively, a virtual machine VM5 and a virtual machine VM6 have been created on Node-3, a requirement parameter of VM6 is a first-class requirement parameter and a second-class requirement parameter and is represented by a label a ' and a label B, a requirement parameter of VM6 is a first-class requirement parameter and is represented by a label a ', a virtual machine VM7 has been created on Node-4, a requirement parameter of VM7 is a second-class requirement parameter and is represented by a label B, and a virtual machine VM is not created on Node-5.
The process of the client creating the virtual machine VM8 through the Node managed by the control Node-0, as shown in fig. 8, mainly includes the following steps:
(1) the client sends a virtual machine creation request to the control Node-0. The virtual machine creation request carries a label B 'of the virtual machine VM8, and the label B' represents a second type demand parameter of the VM 3.
(2) After receiving the virtual machine creation request, the control Node-0 sequentially matches the label B of the VM8 with the labels of the nodes managed by the Node-0 respectively to determine candidate nodes capable of creating the VM 8.
In implementation, when the control Node-0 matches the tag B of the VM8 with the tags of the nodes managed by Node-0, if the tag of one Node managed by Node-0 is matched with the tag B of the VM8 and the Node does not have a tag for representing the first type of deployment condition, the matching is successful, the Node is determined to be a candidate Node capable of creating the VM8, otherwise, the matching is failed, and the Node is determined not to be capable of creating the VM 8. Since the label of Node-1 does not match label B of VM8, and label A 'of Node-1 characterizes the first type of deployment condition, Node-1 cannot create VM8, although label B matching label B of VM8 exists in the labels of Node-2 and Node-3, label A' for characterizing the first type of deployment condition also exists in the labels of Node-2 and Node-3, therefore Node-2 and Node-3 cannot create VM8, the labels of Node-4 and Node-5 match label B of VM8, and the labels of Node-4 and Node-5 do not exist, so Node-4 and Node-5 are candidate nodes capable of creating VM 3.
(3) The control Node-0 selects Node-5 from Node-4 and Node-5 as the target Node for creating the VM3 according to the preset rule.
(4) The control Node-0 forwards the virtual machine creation request to Node-5.
Correspondingly, Node-5 receives the virtual machine creation request, and creates VM8 according to the virtual machine creation request.
Based on the above embodiments, an embodiment of the present application provides a control node, where the control node is configured to implement the virtual machine creation method shown in fig. 5, referring to fig. 9, where the control node 900 includes: a receiving unit 901, a processing unit 902 and a transmitting unit 903.
The receiving unit 901 is configured to receive a first virtual machine creation request sent by a first client; the first virtual machine creating request comprises first type demand parameters of the first virtual machine.
The processing unit 902 is configured to determine, according to a first class requirement parameter of the first virtual machine, a first target node for creating the first virtual machine among the managed nodes; and the first type demand parameters of the first virtual machine meet all first type deployment conditions corresponding to the first target node.
The sending unit 903 is configured to forward the first virtual machine creation request to the first target node.
In a possible implementation manner, when determining, according to the first class requirement parameter of the first virtual machine, to create a first target node of the first virtual machine in the managed multiple nodes, the processing unit 902 is specifically configured to: determining a plurality of candidate nodes in a plurality of managed nodes, wherein the first-class demand parameters of the first virtual machine meet all first-class deployment conditions corresponding to the candidate nodes; and selecting one of the candidate nodes as the first target node according to a preset rule.
In a possible implementation manner, the first virtual machine creation request further includes a second type demand parameter of the first virtual machine, and the second type demand parameter of the first virtual machine satisfies a part of or all of the second type deployment conditions corresponding to the first target node.
In a possible implementation manner, when the first virtual machine creation request includes the second type requirement parameter of the first virtual machine and the second type requirement parameter of the first virtual machine, the processing unit 902 is specifically configured to, when determining, according to the first type requirement parameter of the first virtual machine, to create the first target node of the first virtual machine in the managed multiple nodes: determining a plurality of candidate nodes among the managed plurality of nodes; the first type demand parameters of the first virtual machine meet all first type deployment conditions corresponding to the candidate nodes, and the second type demand parameters of the first virtual machine meet part or all second type deployment conditions corresponding to the candidate nodes; and selecting one of the candidate nodes as the first target node according to a preset rule.
In a possible implementation, the receiving unit 901 is further configured to: receiving a second virtual machine creation request sent by a second client; the second virtual machine creating request only comprises second type demand parameters of the second virtual machine;
the processing unit 902 is further configured to: determining a second target node for creating the second virtual machine in the managed nodes according to the second type demand parameters of the second virtual machine; the second type demand parameters of the second virtual machine meet part or all of second type deployment conditions corresponding to the second target node, and the second target node does not have the first type deployment conditions;
the sending unit 903 is further configured to: forwarding the second virtual machine creation request to the second target node.
It should be noted that the division of the unit in the embodiment of the present application is schematic, and is only a logic function division, and there may be another division manner in actual implementation. The functional modules in the embodiments of the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, and can also be realized in a form of a software functional unit.
The integrated unit, if implemented in the form of a software functional unit and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present application may be substantially implemented or contributed to by the prior art, or all or part of the technical solution may be embodied in a software product, which is stored in a storage medium and includes instructions for causing a computer device (which may be a personal computer, a server, a network device, or the like) or a processor (processor) to execute all or part of the steps of the method according to the embodiments of the present application. And the aforementioned storage medium includes: various media capable of storing program codes, such as a usb disk, a removable hard disk, a read-only memory (ROM), a Random Access Memory (RAM), a magnetic disk, or an optical disk.
Based on the above embodiments, the embodiments of the present application further provide a control node, where the control node is used to implement the virtual machine creation method shown in fig. 5, and has the function of the control node 900 shown in fig. 9. Referring to fig. 10, the control node 1000 includes: a communication interface 1001, a memory 1002 and a processor 1003, wherein the processor 1003 is connected with the communication interface 1001 and the memory 1002.
The communication interface 1001 is configured to receive, under the control of the processor 1003, a first virtual machine creation request sent by a first client; the first virtual machine creating request comprises first type demand parameters of the first virtual machine.
The memory 1002 is used for storing program instructions.
The processor 1003 is configured to call the program instructions stored in the memory 1002, and perform: program instructions stored in the memory 1002 are called to perform: determining a first target node for creating the first virtual machine in a plurality of managed nodes according to the first type demand parameters of the first virtual machine; and controlling the communication interface 1001 to forward the first virtual machine creation request to the first target node; and the first type demand parameters of the first virtual machine meet all first type deployment conditions corresponding to the first target node.
The communication interface 1001 is further configured to: forwarding the first virtual machine creation request to the first target node under the control of the processor 1003.
The memory 1002 may include a volatile memory (volatile memory), such as a random-access memory (RAM); the memory 1002 may also include a non-volatile memory (non-volatile memory), such as a flash memory (flash memory), a Hard Disk Drive (HDD) or a solid-state drive (SSD); the memory 1002 may also comprise a combination of memories of the kind described above.
The processor 1003 may be a Central Processing Unit (CPU), a Network Processor (NP), or a combination of CPU and NP. The processor 1003 may further include a hardware chip. The hardware chip may be an application-specific integrated circuit (ASIC), a Programmable Logic Device (PLD), or a combination thereof. The PLD may be a Complex Programmable Logic Device (CPLD), a field-programmable gate array (FPGA), a General Array Logic (GAL), or any combination thereof.
In one possible implementation, the processor 1003, the communication interface 1001 and the memory 1002 may be connected to each other through a bus 1004. The bus 1004 may be a Peripheral Component Interconnect (PCI) bus, an Extended Industry Standard Architecture (EISA) bus, or the like. The bus 1004 may be divided into an address bus, a data bus, a control bus, and the like. For ease of illustration, only one thick line is shown in FIG. 10, but this is not intended to represent only one bus or type of bus.
In a possible implementation manner, the first virtual machine creation request further includes a second type demand parameter of the first virtual machine, and the second type demand parameter of the first virtual machine satisfies a part of or all of the second type deployment conditions corresponding to the first target node.
In a possible implementation manner, when determining, according to the first class requirement parameter of the first virtual machine, a first target node for creating the first virtual machine among the managed multiple nodes, the processor 1003 is specifically configured to: determining a plurality of candidate nodes in a plurality of managed nodes, wherein the first-class demand parameters of the first virtual machine meet all first-class deployment conditions corresponding to the candidate nodes; and selecting one of the candidate nodes as the first target node according to a preset rule.
In a possible implementation manner, when the first virtual machine creation request includes the second type requirement parameter of the first virtual machine and the second type requirement parameter of the first virtual machine, the processor 1003 is specifically configured to, when determining, according to the first type requirement parameter of the first virtual machine, to create the first target node of the first virtual machine in the managed multiple nodes: determining a plurality of candidate nodes among the managed plurality of nodes; the first type demand parameters of the first virtual machine meet all first type deployment conditions corresponding to the candidate nodes, and the second type demand parameters of the first virtual machine meet part or all second type deployment conditions corresponding to the candidate nodes; and selecting one of the candidate nodes as the first target node according to a preset rule.
In a possible implementation, the communication interface 1001 is further configured to: receiving a second virtual machine creation request sent by a second client under the control of the processor 1003; the second virtual machine creating request only comprises second type demand parameters of the second virtual machine;
the processor 1003 is further configured to: determining a second target node for creating the second virtual machine in the managed nodes according to the second type demand parameters of the second virtual machine; and control the communications interface 1001 to forward the second virtual machine creation request to the second target node; the second type demand parameters of the second virtual machine meet part or all of second type deployment conditions corresponding to the second target node, and the second target node does not have the first type deployment conditions;
the communication interface 1001 is further configured to: forwarding the second virtual machine creation request to the second target node under the control of the processor 1003.
The embodiment of the application provides a control node, wherein the control node determines a first target node for creating a first virtual machine in a plurality of nodes managed by the control node according to a first type demand parameter of the first virtual machine in a received first virtual machine creation request, and forwards the first virtual machine creation request to the first target node, so that the first target node can create the first virtual machine according to the demand parameter of the first virtual machine. The first type demand parameters of the first virtual machine satisfy all first type deployment conditions corresponding to the target node, that is, only nodes having first type deployment conditions that can be matched with the first type demand parameters of the first virtual machine among the plurality of nodes managed by the control node can create the first virtual machine, so that the first virtual machine can monopolize the first type deployment conditions matched with the first type demand parameters of the first virtual machine.
The application provides a virtual machine creating method and a virtual machine creating device, wherein the method comprises the following steps: the method comprises the steps that a control node receives a first virtual machine creation request sent by a first client, determines a first target node for creating a first virtual machine in a plurality of nodes managed by the control node according to first type demand parameters of the first virtual machine carried in the first virtual machine creation request, and forwards the first virtual machine creation request to the first target node, so that the first target node can create the first virtual machine according to the demand parameters of the first virtual machine, wherein the first type demand parameters of the first virtual machine meet all first type deployment conditions corresponding to the target node. The first type demand parameters of the first virtual machine meet all first type deployment conditions corresponding to the first target node, that is, only nodes having the first type deployment conditions capable of being matched with the first type demand parameters of the first virtual machine among the plurality of nodes managed by the control node can create the first virtual machine, so that the first virtual machine can monopolize the first type deployment conditions matched with the first type demand parameters of the first virtual machine.
The present application is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the application. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
It will be apparent to those skilled in the art that various changes and modifications may be made in the embodiments of the present application without departing from the scope of the embodiments of the present application. Thus, if such modifications and variations of the embodiments of the present application fall within the scope of the claims of the present application and their equivalents, the present application is also intended to encompass such modifications and variations.