Virtual machine configuration processing method, apparatus, device, and storage medium
By receiving configuration change commands in OpenStack, finding the target virtual machine attributes, and calculating the configuration changes, the problem of new virtual machine creation failures was solved, enabling efficient virtual machine resource adjustment on the same node and improving node utilization.
Patent Information
- Application Number
- CN202310744508.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-06-21
- Publication Date
- 2025-12-26
- Estimated Expiration
- 2043-06-21
AI Technical Summary
In existing technologies, when expanding or releasing virtual machine resources in OpenStack, the creation of new virtual machines may fail, and node utilization is low.
By receiving configuration change commands from user terminals, the system finds the attribute information of the target virtual machine, compares the node configuration with the target configuration, calculates the configuration change, and creates a new virtual machine on the same node, avoiding failures when directly creating a new virtual machine and making full use of existing node resources.
This avoids the problem of new virtual machine creation failure and improves the resource utilization of nodes.
Smart Images

Figure CN119182663B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of servers or data processing, and in particular to a virtual machine configuration processing method and device, equipment and a storage medium. BACKGROUND
[0002] Openstack is a commonly used open source cloud service management platform in the current Internet industry. When resource expansion or resource release of a virtual machine is required due to changes in business or an increase in business volume, the number of processing units or the size of the storage space of the virtual machine can be adjusted in Openstack, that is, a change operation, to meet the needs of the service.
[0003] Currently, in the prior art, the process of performing a change operation is usually to create a new virtual machine of the required specification while saving the original virtual machine, and then delete the original virtual machine.
[0004] However, the inventors have found that the current method of creating a new virtual machine may have the problem of creation failure. SUMMARY
[0005] The present application provides a virtual machine configuration processing method, device, equipment and storage medium to solve the problem of creation failure in the current method of creating a new virtual machine.
[0006] In a first aspect, the present application provides a virtual machine configuration processing method, comprising:
[0007] receiving a change operation instruction sent by a user terminal, wherein the change operation instruction comprises a target virtual machine identifier and a target configuration; finding attribute information corresponding to the target virtual machine identifier, wherein the attribute information comprises a node identifier and a current configuration; obtaining a node configuration corresponding to the node identifier; if the node configuration is greater than or equal to the target configuration, determining a configuration change amount according to the target configuration and the current configuration; and creating a new virtual machine according to the configuration change amount and the current configuration.
[0008] In a possible implementation manner, creating a new virtual machine according to the configuration change amount and the current configuration comprises: if the configuration change amount is a negative value, removing an absolute value of the configuration change amount in the current configuration to obtain the new virtual machine; and if the configuration change amount is a positive value, creating a virtual machine intermediate value with a configuration value of the configuration change amount; and increasing the current configuration by the configuration value of the virtual machine intermediate value to obtain the new virtual machine.
[0009] In a possible implementation manner, after creating the virtual machine intermediate value with the configuration value of the configuration change amount, the method further comprises: in response to receiving a recovery instruction sent by the user terminal, deleting the virtual machine intermediate value.
[0010] In a possible implementation, the configuration change amount is determined according to the target configuration and the current configuration, including: subtracting the second parameter value from the first parameter value to obtain a parameter difference, where the first parameter value is a parameter value corresponding to a target class configuration parameter in the target configuration, the second parameter value is a parameter value corresponding to the target class configuration parameter in the current configuration, and the target class configuration parameter is any class configuration parameter; and the parameter difference of each class configuration parameter is collectively determined as the configuration change amount.
[0011] In a possible implementation, the new virtual machine is created according to the configuration change amount and the current configuration, including: if the parameter difference of each class configuration parameter is negative, summing the parameter value in the current configuration and the parameter difference to obtain the new virtual machine; if the parameter difference of any class configuration parameter is positive, creating a virtual machine intermediate amount according to the parameter difference of each class configuration parameter; and creating the new virtual machine according to the current configuration and the virtual machine intermediate amount.
[0012] In a possible implementation, after the configuration change amount is determined according to the target configuration and the current configuration, the method further includes: generating a configuration change confirmation request according to the configuration change amount; sending the configuration change confirmation request to the user terminal; and in response to receiving a confirmation instruction sent by the user terminal according to the change confirmation request, creating the new virtual machine according to the configuration change amount and the current configuration.
[0013] In a possible implementation, after the node configuration corresponding to the node identifier is obtained, the method further includes: if the node configuration is less than the target configuration, sending a node change request to the user terminal; in response to receiving a node change confirmation instruction input by the user on the user terminal, obtaining the node configuration of the remaining nodes; and if the node configuration of the target node is greater than or equal to the target configuration, creating the virtual machine on the target node, where the target node is any node.
[0014] In a second aspect, the present application provides a virtual machine configuration processing apparatus, including:
[0015] An instruction receiving module configured to receive a configuration change instruction sent by a user terminal, where the configuration change instruction includes a target virtual machine identifier and a target configuration; an attribute searching module configured to search for attribute information corresponding to the target virtual machine identifier, where the attribute information includes a node identifier and a current configuration; a configuration obtaining module configured to obtain a node configuration corresponding to the node identifier; a configuration determining module configured to determine a configuration change amount according to the target configuration and the current configuration if the node configuration is greater than or equal to the target configuration; and a virtual machine creating module configured to create a new virtual machine according to the configuration change amount and the current configuration.
[0016] In a third aspect, the present application provides an electronic device, comprising: a processor, and a memory connected with the processor in communication; the memory stores computer-executable instructions; and the processor executes the computer-executable instructions stored in the memory to implement the virtual machine configuration processing method as described in the first aspect.
[0017] In a fourth aspect, the present application provides a computer-readable storage medium, which stores computer-executable instructions, and the computer-executable instructions are executed by a processor to implement the virtual machine configuration processing method as described in the first aspect.
[0018] The virtual machine configuration processing method, device, equipment and storage medium provided by the present application accept the configuration change instruction sent by the user terminal, find the attribute information of the target virtual machine corresponding to the target virtual machine identifier in the configuration change instruction, obtain the configuration of the node from the node identifier in the attribute information, compare the size of the configuration of the node and the target configuration in the configuration change instruction, judge whether the update of the target virtual machine configuration can be completed in the current node, calculate the configuration change amount in the case of being able to update, create a new virtual machine from the configuration change amount and the current configuration of the virtual machine, realize the configuration change of the virtual machine in the same node, avoid the problem that the new virtual machine creation fails in the related art because the sum of the target configuration and the current configuration required by the new virtual machine is greater than the node configuration when the new virtual machine is created, and make full use of the configuration of the current node because the creation of the new virtual machine is completed in the original node. BRIEF DESCRIPTION OF DRAWINGS
[0019] The accompanying drawings, which are incorporated herein and form part of the specification, illustrate embodiments consistent with the present application and, together with the description, further serve to explain the principles of the application.
[0020] Figure 1 The application scenario of the virtual machine configuration processing method provided by the embodiment of the present application is shown in the figure;
[0021] Figure 2 The flowchart of the virtual machine configuration processing method provided by the embodiment of the present application is shown in the figure;
[0022] Figure 3 The overall flowchart of the virtual machine configuration processing method provided by the embodiment of the present application is shown in the figure;
[0023] Figure 4 The structure diagram of the virtual machine configuration processing device provided by the embodiment of the present application is shown in the figure;
[0024] Figure 5 The structure diagram of the electronic device provided by the embodiment of the present application is shown in the figure.
[0025] The specific embodiments of the application have been shown and described in the above drawings and specification, and it is to be understood that the application is not limited to the above-described embodiments. Rather, it is to be understood that the application is capable of numerous arrangements and embodiments, and the above-described embodiments are merely illustrative of the principles of the application. DETAILED DESCRIPTION
[0026] The exemplary embodiments will be described in detail herein below with reference to the drawings. The following description is merely exemplary in nature and is not intended to limit the present application, as described, by any means. Rather, the exemplary embodiments are intended to explain the principles of the present application, as detailed in the appended claims.
[0027] At present, a large number of services are performed on a network, and the services can be executed by virtual machines in a cluster. When the services change, the computing capability and storage capability of the virtual machines need to be changed, which requires re-allocation of the number of computing units and the number of storage units occupied by the virtual machines. OpenStack is an open source cloud service management platform, which can perform the above-mentioned re-allocation of the computing units and the storage units, so as to meet the service requirements.
[0028] When the OpenStack performs the re-allocation at present, a new virtual machine is usually generated according to a target configuration required, and then the original virtual machine is deleted, so as to realize the re-allocation of the virtual machine. However, this re-allocation mode can cause problems such as failure to create a new virtual machine and low node utilization.
[0029] In view of the above technical problems, the inventors propose the following technical concept: generating a configuration change amount according to a target configuration specified by a user and a configuration of a current virtual machine, and merging the configuration change amount with the configuration of the current virtual machine to obtain a new virtual machine.
[0030] Figure 1 An application scenario diagram of a virtual machine configuration processing method provided by an embodiment of the present application is shown in FIG. 1. Figure 1 In the scenario, a user terminal 101 and a server 102 are included.
[0031] It can be understood that the structure shown in the embodiment of the present application does not constitute a specific limitation on the virtual machine configuration processing method. In another possible embodiment of the present application, the above-mentioned architecture can include more or fewer components than shown, or combine certain components, or split certain components, or different component arrangement, and the specific application scenario can be determined, which is not limited herein. Figure 1 The components shown can be implemented in hardware, software, or a combination of software and hardware.
[0032] In the implementation process, the user terminal 101 can include a computer, a server, a tablet, a mobile phone, a personal digital assistant (PDA), a notebook computer, and the like, which can input and send data, and in some possible cases, can also be used to receive data and output data.
[0033] The server 102 can be implemented by using one server or a cluster of multiple servers with stronger processing capability and higher security, and in possible cases, can also be replaced by a computer or a notebook computer with stronger computing capability.
[0034] The user terminal 101 is configured to receive an instruction of a user, and send a corresponding configuration change instruction to the server 102. The server 102 is configured to, after receiving the configuration change instruction, change a configuration of a target virtual machine corresponding to a target virtual machine identifier in the configuration change instruction to a target configuration according to the target virtual machine identifier and the target configuration, to obtain a new virtual machine.
[0035] The technical solutions of the present application and how the technical solutions of the present application solve the above technical problems will be described in detail below with specific embodiments. The following specific embodiments can be combined with each other, and the same or similar concepts or processes can not be described in detail in some embodiments. The embodiments of the present application will be described below with reference to the accompanying drawings.
[0036] Figure 2 A flowchart of a virtual machine configuration processing method provided by an embodiment of the present application is shown in the figure. The execution subject of the embodiment of the present application can be the server 102 in the figure, or a computer and / or a mobile phone, and the embodiment of the present application does not make a special limitation thereon. As shown in the figure, the method includes the following steps. Figure 1 Figure 2 The method includes the following steps.
[0037] S201: receiving a configuration change instruction sent by a user terminal, wherein the configuration change instruction includes a target virtual machine identifier and a target configuration.
[0038] In this step, the configuration change instruction can be sent in the form of a message, a character string, or the like, and can be obtained after the user performs a click operation, a key input operation, or the like on the user terminal. The target virtual machine can be a virtual machine whose configuration needs to be changed, or a virtual machine corresponding to the configuration change instruction. Correspondingly, the target virtual machine identifier can be at least one of a name, an address, a UUID (Universally Unique Identifier), or the like of the target virtual machine. The target configuration can be a number of computing units, a size of occupied memory, a size of occupied cache, or the like.
[0039] For example, the change configuration instruction includes "virtual machine: virtual machine A, target configuration: CPU 4RAM 1024", which indicates that the change configuration instruction is executed on "virtual machine A", and "virtual machine A" needs to occupy 4 CPU (Central Processing Unit) cores and a RAM (Random Access Memory) unit with a capacity of 1024 MB. For another example, the change configuration instruction includes "100.121.111.01, target configuration: CPU 5RAM 512", which indicates that the change configuration instruction is executed on the virtual machine with the address "100.121.111.01", and the virtual machine with the address "100.121.111.01" needs to occupy 5 CPU cores and a RAM unit with a capacity of 512 MB.
[0040] S202: Find the attribute information corresponding to the target virtual machine identifier, wherein the attribute information includes a node identifier and a current configuration.
[0041] In this step, the attribute information corresponding to the target virtual machine identifier can be obtained by searching the preset correspondence between virtual machine identifiers and attributes according to the target virtual machine identifier. The node identifier can be the node where the virtual machine is currently located, and the current configuration can be the number of CPU cores currently used, the amount of RAM occupied, etc.
[0042] The correspondence between the virtual machine identifier and the attribute can be stored in a table, key-value pair, or the like. The correspondence can be established when the virtual machine is created or updated when the virtual machine configuration is modified.
[0043] S203: Obtain the node configuration corresponding to the node identifier.
[0044] In this step, the node configuration of the node corresponding to the target virtual machine identifier can be obtained by searching the preset correspondence between node identifiers and node configurations.
[0045] The correspondence between the node identifier and the node configuration can be calibrated by a worker or automatically generated by a program after reading the node configurations of each node.
[0046] S204: If the node configuration is greater than or equal to the target configuration, determine the configuration change amount according to the target configuration and the current configuration.
[0047] In this step, the node configuration is greater than or equal to the target configuration, which means that each configuration parameter (CPU core number, RAM occupancy, memory size, cache size, etc.) in the node configuration is greater than or equal to the corresponding configuration parameter in the target configuration. The configuration change amount can be determined by subtracting the target configuration from the current configuration.
[0048] For example, if the node configuration is "CPU: 10, RAM: 1024" and the target configuration is "CPU: 4, RAM: 512", the number of CPU cores and the size of RAM of the node configuration are both greater than those of the target configuration. Embodiments of the present application do not specifically limit the size of each parameter in the node configuration and the target configuration.
[0049] S205: Create a new virtual machine according to the configuration change and the current configuration.
[0050] In this step, the virtual machine intermediate quantity can be generated according to whether the configuration change is positive or negative, and the new virtual machine can be obtained by combining the virtual machine intermediate quantity with the current configuration, or the parameter value of the configuration change can be directly removed from the current configuration to obtain the new virtual machine.
[0051] The UUID of the new virtual machine can be the same as the UUID of the original virtual machine. The modification of the current configuration can be performed after sending a prompt to the user terminal and receiving a confirmation instruction input by the user terminal according to the prompt.
[0052] In a possible implementation, this step can be performed by using a component in OpenStack.
[0053] As can be seen from the description of the above embodiments, the embodiments of the present application accept the configuration change instruction sent by the user terminal, find the attribute information of the virtual machine corresponding to the target virtual machine identifier in the configuration change instruction, obtain the configuration of the node from the node identifier in the attribute information, compare the configuration of the node with the target configuration in the configuration change instruction, determine whether the update of the configuration of the target virtual machine can be completed in the current node, calculate the configuration change in the case of being able to update, and create a new virtual machine from the configuration change and the current configuration of the virtual machine, thereby realizing the change of the configuration of the virtual machine in the same node and avoiding the problem that the creation of the new virtual machine fails in the related art because the sum of the target configuration required for creating the new virtual machine and the current configuration is greater than the node configuration. In addition, since the creation of the new virtual machine is completed in the original node, the configuration of the current node can be more fully utilized.
[0054] In a possible implementation, in the step S205, creating a new virtual machine according to the configuration change and the current configuration includes steps S205A1 and S205A2.
[0055] S205A1: If the configuration change is negative, remove the absolute value of the configuration change from the current configuration to obtain the new virtual machine.
[0056] In this step, the new configuration specification can be obtained by subtracting the absolute value of the configuration change from the current configuration, and the new configuration specification is used to replace the configuration specification of the original virtual machine.
[0057] For example, the configuration change is to reduce 2 CPU cores or "CPU: -2", and the number of CPU cores in the current configuration is reduced by 2 to obtain a new virtual machine. For another example, the configuration change is to reduce 1024 MB of RAM usage or "RAM: -1024", and the RAM usage in the current configuration of the virtual machine is reduced by 1024 MB to obtain a new virtual machine. For another example, the configuration change is "CPU: -2, RAM: -512", and the number of CPU cores in the current configuration is reduced by 2 and the RAM usage in the current configuration is reduced by 512 MB to obtain a new virtual machine.
[0058] In a possible implementation, before obtaining the new virtual machine, the user terminal can also be sent prompt information for confirming the changed configuration, and the confirmation information sent by the user terminal is received. After receiving the confirmation information, or after a preset time, it is defaulted that the confirmation information is received, the absolute value of the configuration change is removed from the current configuration to obtain a new virtual machine.
[0059] S205A2: If the configuration change is positive, a virtual machine intermediate quantity with a configuration value of the configuration change is created. The current configuration is increased by the configuration value of the virtual machine intermediate quantity to obtain a new virtual machine.
[0060] In this step, for example, the configuration change is to increase 3 CPU cores or "CPU: 3", a virtual machine intermediate quantity with 3 CPU cores is created, and the virtual machine intermediate quantity is added to the original current configuration to obtain a new virtual machine. For another example, the configuration change is to increase 2048 MB of RAM usage or "RAM: 2048", a virtual machine intermediate quantity with 2048 MB of RAM is created, and the virtual machine intermediate quantity is added to the current configuration to obtain a new virtual machine. For another example, the configuration change is "CPU: 5, RAM: 1024", a virtual machine intermediate quantity with 5 CPU cores and 1024 MB of RAM usage is created, and the virtual machine intermediate quantity is added to the current configuration to obtain a new virtual machine.
[0061] This step can also replace the resources allocated by the original virtual machine with the sum of the current configuration and the virtual machine intermediate quantity. In a possible implementation, similar to the description in step S2051 described above, adding the virtual machine intermediate quantity to the current configuration can also be performed after receiving the confirmation information.
[0062] From the description of the above embodiments, it can be known that, in the case that the configuration change value is a negative value, the absolute value of the configuration change value is directly subtracted from the current configuration to obtain a new virtual machine, and in the case that the configuration change value is a positive value, a virtual machine intermediate value with the configuration value being the configuration change value is added, and the virtual machine intermediate value is combined with the current configuration to obtain a new virtual machine, so that the updating of the virtual machine configuration under the same node is realized, the UUID of the original virtual machine does not need to be changed, and the utilization rate of the node operation capability is increased.
[0063] In a possible implementation, after the virtual machine intermediate value with the configuration value being the configuration change value is created in the step S2052, the method further includes:
[0064] S52A: deleting the virtual machine intermediate value in response to receiving the recovery instruction sent by the user terminal.
[0065] In this step, the recovery instruction can be obtained after the user performs a clicking or inputting operation or the like on the user terminal. The recovery instruction can include the target virtual machine identifier and the recovery instruction.
[0066] For example, the virtual machine intermediate value "CPU: 2, RAM: 1024" has been created, and then the recovery instruction sent by the user terminal is received, the virtual machine intermediate value is deleted, and the UUID of the original virtual machine is used as the UUID for subsequent use.
[0067] If the configuration change value obtained after the step S204 is a negative value, and the recovery instruction of the user is received after the configuration change value is obtained, no processing is performed. The original virtual machine is maintained as the virtual machine for subsequent use.
[0068] From the description of the above embodiments, it can be known that, in the case that the configuration change value is a negative value, the absolute value of the configuration change value is directly subtracted from the current configuration to obtain a new virtual machine, and in the case that the configuration change value is a positive value, a virtual machine intermediate value with the configuration value being the configuration change value is added, and the virtual machine intermediate value is combined with the current configuration to obtain a new virtual machine, so that the updating of the virtual machine configuration under the same node is realized, the UUID of the original virtual machine does not need to be changed, and the utilization rate of the node operation capability is increased.
[0069] In a possible implementation, in the step S204, the configuration change value is determined according to the target configuration and the current configuration, including steps S2041 and S2042.
[0070] S2041: subtracting the second parameter value from the first parameter value to obtain a parameter difference, wherein the first parameter value is a parameter value corresponding to a target class configuration parameter in the target configuration, the second parameter value is a parameter value corresponding to the target class configuration parameter in the current configuration, and the target class configuration parameter is any class configuration parameter.
[0071] In this step, the configuration parameters can be classified into multiple categories, for example, the CPU core number is classified into one category, the RAM occupancy is classified into one category, and there can be other categories, and the embodiments of the present application do not make specific limitations on the categories of the configuration parameters. In this step, the differences of the configuration parameters can be obtained by respectively calculating the differences of the configuration parameters of each category.
[0072] For example, the target configuration is "CPU: 5, RAM: 1024", and the current configuration is "CPU: 4, RAM: 512", then the configuration parameter of the type of CPU core number is subtracted to obtain the parameter difference of the type of CPU core number, which is 1, and the configuration parameter of the type of RAM occupancy is subtracted to obtain the parameter difference of the type of RAM occupancy, which is 512 MB. For another example, the target configuration is "CPU: 7, RAM: 2048", and the current configuration is "CPU: 5, RAM: 1024", then the configuration parameter of the type of CPU core number is subtracted to obtain the parameter difference of the type of CPU core number, which is 2, and the configuration parameter of the type of RAM occupancy is subtracted to obtain the parameter difference of the type of RAM occupancy, which is -1024 MB.
[0073] S2042: The parameter differences of the configuration parameters of each category are collectively determined as the configuration change amount.
[0074] In this step, for example, the parameter difference of the type of CPU core number is -2, and the parameter difference of the type of RAM occupancy is 512 MB, and then the obtained configuration change amount is "CPU: -2, RAM: 512". For another example, the parameter difference of the type of CPU core number is 3, and the parameter difference of the type of RAM occupancy is 0, and then the obtained configuration change amount is "CPU: 3". For another example, the parameter difference of the type of CPU core number is -4, and the parameter difference of the type of RAM occupancy is -1024 MB, and then the obtained configuration change amount is "CPU: -4, RAM: -1024".
[0075] As can be seen from the description of the above embodiments, the embodiments of the present application obtain the parameter differences corresponding to the configuration parameters of each category by respectively calculating the differences of the configuration parameters of each category, and collectively determine the parameter differences of the configuration parameters of each category as the configuration change amount, so as to facilitate subsequent creation of a new virtual machine according to the parameter differences of the configuration parameters of each category and the current configuration.
[0076] In a possible implementation, in the step S205, a new virtual machine is created according to the configuration change amount and the current configuration, including: S205B1, S205B2.
[0077] S205B1: If the parameter differences of the configuration parameters of each category are all negative values, then the parameter values in the current configuration and the parameter differences are summed to obtain the new virtual machine.
[0078] In this step, since the parameter difference of each type of configuration parameter is negative, the parameter value in the current configuration is summed with the parameter difference, which is actually to reduce the parameter value in the current configuration to obtain a new parameter value, and the virtual machine containing the new parameter value is taken as a new virtual machine.
[0079] In the process of summing the parameter value and the parameter difference, each type of configuration parameter can be summed respectively.
[0080] S205B2: If the parameter difference of any type of configuration parameter is positive, a virtual machine intermediate quantity is created according to the parameter difference of each type of configuration parameter. A new virtual machine is created according to the current configuration and the virtual machine intermediate quantity.
[0081] In this step, the process of creating the virtual machine intermediate quantity is similar to the process of step S205A2 described above. For example, the parameter difference of the CPU core number is 2, and the parameter difference of the RAM occupancy is 1024 MB, so the virtual machine intermediate quantity generated is "CPU: 2, RAM: 1024", and the numerical value of the parameter difference of each type of parameter is not limited in the embodiments of the present application. The nova-conductor component in OpenStack is used to create. In this step and the above steps, the process of creating a new virtual machine can be performed by using the nova-compute component of OpenStack.
[0082] As can be seen from the description of the above embodiments, in the case that the parameter difference of each type of configuration parameter is negative, the current configuration is directly reduced by the absolute value of the parameter difference, and in the case that the parameter difference is positive, a virtual machine intermediate quantity is first created and then a new virtual machine is created from the virtual machine intermediate quantity, so that the effects of facilitating subsequent rollback operation and increasing resource utilization of the node are achieved.
[0083] In a possible implementation, in the case that the parameter difference of any type of configuration parameter is positive, the current parameter corresponding to the parameter difference being negative can also be summed with the parameter difference to obtain a virtual machine to be changed, a virtual machine intermediate quantity corresponding to the parameter difference being positive is generated, and a new virtual machine is created according to the configuration parameter of the virtual machine to be changed and the virtual machine intermediate quantity. The way of creating a virtual machine is similar to the above embodiments, which will not be described here.
[0084] In a possible implementation, the process of creating a new virtual machine in the above steps can be modifying the configuration file corresponding to the target virtual machine identifier according to the configuration change amount, increasing or decreasing the configuration data written in the configuration file, or writing or deleting the configuration data in the configuration file. The configuration data can be associated CPU core, memory occupancy partition, etc.
[0085] In a possible implementation, the above-mentioned variable configuration instruction further comprises a user identifier, and the method further comprises: determining a user authority according to the user identifier, and if the user authority does not belong to an administrator authority, the above-mentioned step S202 and subsequent steps are not performed. The step of determining the user authority comprises: searching for a preset administrator identifier list according to the user identifier, if the user identifier belongs to the administrator identifier list, the user authority belongs to the administrator authority, otherwise, the user authority does not belong to the administrator authority.
[0086] In a possible implementation, after the step S204 of determining the configuration change amount according to the target configuration and the current configuration, the method further comprises:
[0087] S210: generating a configuration change confirmation request according to the configuration change amount.
[0088] In this step, the configuration change amount can be input into a preset request template to obtain the change confirmation request. The values in the configuration change amount can also be extracted, and the extracted values can be written into the preset request template to obtain the configuration change confirmation request.
[0089] The request template can be preset by a staff. The obtained configuration change confirmation request is, for example, "the configuration change amount is CPU: 1, RAM: 512, please confirm or execute rollback", "the configuration change amount is CPU core flavin increased by 1, RAM occupancy increased by 512, please confirm or execute rollback", and the like. The content of the configuration change confirmation request is not limited in the embodiments of the present application.
[0090] S211: sending the configuration change confirmation request to a user terminal.
[0091] In this step, the configuration change confirmation request can be sent in the format of a message or a string. The configuration change confirmation request can also be sent in the form of a short message, software information, or a small program.
[0092] S212: in response to receiving a confirmation instruction sent by the user terminal according to the change confirmation request, creating a new virtual machine according to the configuration change amount and the current configuration.
[0093] In this step, the confirmation instruction can be input by a user on the user terminal, or generated by the user terminal in response to the user's touch. The confirmation instruction can be a preset string. The process of creating a virtual machine is similar to that in the above-mentioned embodiments, and will not be described here.
[0094] From the description of the above embodiments, it can be known that, by generating the configuration change confirmation request after generating the configuration change amount, and sending the configuration change confirmation request to the user terminal, the embodiments of the present application realize prompting the user to confirm the configuration change, and after receiving the confirmation instruction of the user terminal, a new virtual machine is created according to the configuration change amount and the current configuration, which realizes providing the optional item of fallback before providing the new virtual machine, and facilitates the user to cancel the process before completely completing the creation of the new virtual machine.
[0095] In a possible implementation, after the node configuration corresponding to the node identifier is acquired in the step S203, the method further includes:
[0096] S220: if the node configuration is less than the target configuration, sending a node change request to the user terminal.
[0097] In this step, any parameter in the node configuration can be less than the configuration parameter corresponding to the target configuration, and the node change request is sent to the user terminal. The node change request can be a preset message or a string.
[0098] For example, the node configuration is "CPU: 5, RAM: 2048", and the target configuration is "CPU: 8, RAM: 1024", the number of CPU cores in the target configuration is greater than the number of CPU cores in the node configuration, and the node configuration is less than the target configuration. For another example, the node configuration is "CPU: 7, RAM: 1024", and the target configuration is "CPU: 6, RAM: 2048", the RAM occupancy in the target configuration is greater than the RAM occupancy in the node configuration, and the node configuration is less than the target configuration. For another example, the node configuration is "CPU: 3, RAM: 1024", and the target configuration is "CPU: 5, RAM: 2048", each configuration parameter in the target configuration is greater than the configuration parameter in the node configuration, and the node configuration is less than the target configuration. The node change request is, for example, "current node configuration is insufficient, please input the node change confirmation instruction to replace the node", and the content of the node change request is not limited in the embodiments of the present application.
[0099] S221: in response to receiving the node change confirmation instruction input by the user on the user terminal, acquiring the node configuration of the remaining node.
[0100] In this step, the node change confirmation instruction can also be received through a wired or wireless network. The node configuration of the remaining node can be obtained by reading the pre-stored node list, reading the node identifier in the node list, and finding the corresponding relationship between the node identifier and the node configuration according to the node identifier to obtain the node configuration of the remaining node. The remaining node can be another node other than the node corresponding to the node identifier, and can also be a node not occupied by the virtual machine.
[0101] If the remaining node is a node not occupied by a virtual machine, the node configuration can be obtained by reading an unoccupied node list of the node not occupied by the virtual machine, reading each node identifier in the unoccupied node list, finding a correspondence between the node identifier and the node configuration, and obtaining the node configuration of the remaining node. The unoccupied node list of the node not occupied by the virtual machine can be pre-written by a staff.
[0102] S222: If the node configuration of the target node is greater than or equal to the target configuration, create a virtual machine in the target node, where the target node is any node.
[0103] In this step, the node configuration of the target node is greater than or equal to the target configuration, which can be the opposite of the case in step S220 described above, and will not be described here. The virtual machine can be created in the target node with the target configuration, and at this time, the virtual machine does not need to be created according to the configuration change and the current configuration.
[0104] After the virtual machine is created in the target node, the virtual machine in the original node (i.e., the node corresponding to the node identifier in step S202) can also be deleted.
[0105] Figure 3 The overall flowchart of the virtual machine configuration processing method provided by the embodiment of the present application is shown in FIG. 1. Figure 3 As shown in FIG. 1, the overall flowchart includes:
[0106] S301: Obtain the current configuration of the original virtual machine.
[0107] In this step, the original virtual machine is the virtual machine corresponding to the target virtual machine identifier.
[0108] S302: Determine the configuration change according to the target configuration and the current configuration.
[0109] S303: If the configuration change is a negative value, send a configuration change confirmation request to the user terminal. If a node change confirmation instruction sent by the user terminal is received, execute step S305, and if a recovery instruction sent by the user terminal is received, do not make any changes.
[0110] S304: If the configuration change is a positive value, create a virtual machine intermediate quantity and send a configuration change confirmation request to the user terminal. If a node change confirmation instruction sent by the user terminal is received, execute step S306, and if a recovery instruction sent by the user terminal is received, execute step S307.
[0111] In steps S303 and S304, a positive value indicates that the overall flowchart is an incremental configuration of the virtual machine, and a negative value indicates that the overall flowchart is a decremental configuration of the virtual machine. The incremental configuration indicates an increase in the configuration of the virtual machine, and the decremental configuration indicates a decrease in the configuration of the virtual machine.
[0112] S305: creating a new virtual machine according to the configuration change amount and the current configuration.
[0113] In this step, the new virtual machine specification can replace the original virtual machine.
[0114] S306: adding the configuration value of the virtual machine intermediate amount to the current configuration to obtain a new virtual machine.
[0115] S307: deleting the virtual machine intermediate amount.
[0116] Figure 4 The structure diagram of the virtual machine configuration processing device provided in the embodiment of the application is shown in FIG. 4. Figure 3 As shown in FIG. 4, the virtual machine configuration processing device 400 includes an instruction receiving module 401, an attribute searching module 402, a configuration obtaining module 403, a configuration determining module 404, and a virtual machine creating module 405.
[0117] The instruction receiving module 401 is configured to receive a configuration changing instruction sent by a user terminal, wherein the configuration changing instruction includes a target virtual machine identifier and a target configuration.
[0118] The attribute searching module 402 is configured to search for attribute information corresponding to the target virtual machine identifier, wherein the attribute information includes a node identifier and a current configuration.
[0119] The configuration obtaining module 403 is configured to obtain a node configuration corresponding to the node identifier.
[0120] The configuration determining module 404 is configured to determine a configuration change amount according to the target configuration and the current configuration if the node configuration is greater than or equal to the target configuration.
[0121] The virtual machine creating module 405 is configured to create a new virtual machine according to the configuration change amount and the current configuration.
[0122] The device provided in the embodiment can be used to execute the technical solutions of the method embodiments, and has similar implementation principles and technical effects, which will not be described here again in the embodiment.
[0123] In a possible implementation, the virtual machine creating module 405 is specifically configured to remove an absolute value of the configuration change amount from the current configuration to obtain a new virtual machine if the configuration change amount is a negative value. If the configuration change amount is a positive value, a virtual machine intermediate amount with a configuration value of the configuration change amount is created. The current configuration is added by the configuration value of the virtual machine intermediate amount to obtain a new virtual machine.
[0124] The device provided in the embodiment can be used to execute the technical solutions of the method embodiments, and has similar implementation principles and technical effects, which will not be described here again in the embodiment.
[0125] In a possible implementation, the virtual machine configuration processing apparatus 400 further includes an intermediate quantity deletion module 406.
[0126] The intermediate quantity deletion module 406 is configured to delete the virtual machine intermediate quantity in response to receiving the recovery instruction sent by the user terminal.
[0127] The apparatus provided in the embodiment can be used to execute the technical solutions of the method embodiments, and has similar implementation principles and technical effects, which will not be repeated here.
[0128] In a possible implementation, the configuration determination module 404 is specifically configured to subtract the second parameter value from the first parameter value to obtain a parameter difference, where the first parameter value is a parameter value corresponding to a target class configuration parameter in the target configuration, the second parameter value is a parameter value corresponding to the target class configuration parameter in the current configuration, and the target class configuration parameter is any class configuration parameter. The parameter differences of the various class configuration parameters are collectively determined as the configuration change.
[0129] The apparatus provided in the embodiment can be used to execute the technical solutions of the method embodiments, and has similar implementation principles and technical effects, which will not be repeated here.
[0130] In a possible implementation, the virtual machine creation module 405 is specifically configured to, if the parameter differences of the various class configuration parameters are all negative values, sum the parameter values in the current configuration and the parameter differences to obtain a new virtual machine. If the parameter difference of any class configuration parameter is a positive value, create a virtual machine intermediate quantity according to the parameter differences of the various class configuration parameters. Create a new virtual machine according to the current configuration and the virtual machine intermediate quantity.
[0131] The apparatus provided in the embodiment can be used to execute the technical solutions of the method embodiments, and has similar implementation principles and technical effects, which will not be repeated here.
[0132] In a possible implementation, the virtual machine configuration processing apparatus 400 further includes a user confirmation module 407.
[0133] The user confirmation module 407 is configured to generate a configuration change confirmation request according to the configuration change. The configuration change confirmation request is sent to the user terminal. In response to receiving a confirmation instruction sent by the user terminal according to the change confirmation request, a new virtual machine is created according to the configuration change and the current configuration. The apparatus provided in the embodiment can be used to execute the technical solutions of the method embodiments, and has similar implementation principles and technical effects, which will not be repeated here.
[0134] The apparatus provided in the embodiment can be used to execute the technical solutions of the method embodiments, and has similar implementation principles and technical effects, which will not be repeated here.
[0135] In a possible implementation, the virtual machine configuration processing apparatus 400 further includes a node changing module 408.
[0136] The node changing module 408 is configured to send a node changing request to the user terminal if the node configuration is less than the target configuration. In response to receiving a node changing confirmation instruction input by the user on the user terminal, the node configuration of the remaining node is acquired. If the node configuration of the target node is greater than or equal to the target configuration, the virtual machine is created on the target node, where the target node is any node.
[0137] The apparatus provided in the embodiment can be used to execute the technical solutions of the method embodiments, and has similar implementation principles and technical effects, which will not be repeated here.
[0138] To implement the above-mentioned embodiments, the electronic device is further provided in the embodiment of the present application.
[0139] Reference Figure 5 , which shows a structural schematic diagram of an electronic device 500 suitable for implementing the embodiments of the present application. The electronic device 500 can be a terminal device or a server. The terminal device can include, but is not limited to, mobile terminals such as mobile phones, notebook computers, digital broadcast receivers, personal digital assistants (PDA), tablet computers (PAD), portable media players (PMP), vehicle-mounted terminals (such as vehicle-mounted navigation terminals), and the like, and fixed terminals such as digital TVs, desktop computers, and the like. Figure 5 The electronic device shown is only an example and should not impose any limitation on the functions and use range of the embodiments of the present application.
[0140] As shown in Figure 5 , the electronic device 500 can include a processor (such as a central processor, a graphics processor, etc.) 501, which can perform various appropriate actions and processes according to programs stored in a memory 502 or loaded into a random access memory (RAM) 503 from a storage device 508. The memory 502 can be a read only memory (ROM) or other memory. In the RAM 503, various programs and data required for the operation of the electronic device 500 are also stored. The processing apparatus 501, the memory 502, and the RAM 503 are connected to each other through a bus 504. An input / output (I / O) interface 505 is also connected to the bus 504.
[0141] In general, the following devices can be connected to the I / O interface 505: input devices 506 including, for example, a touch screen, a touch pad, a keyboard, a mouse, a camera, a microphone, an accelerometer, a gyroscope, and the like; output devices 507 including, for example, a Liquid Crystal Display (LCD), a speaker, a vibrator, and the like; storage devices 508 including, for example, a magnetic tape, a hard disk, and the like; and communication devices 509. The communication devices 509 can allow the electronic device 500 to communicate wirelessly or wired with other devices to exchange data. Although Figure 5 The electronic device 500 is shown with various devices, but it is understood that all of the shown devices are not required to be implemented or present. More or less devices can alternatively be implemented or present.
[0142] In particular, the processes described above with reference to the flowcharts can be implemented as a computer software program according to embodiments of the present application. For example, embodiments of the present application include a computer program product comprising a computer program carried on a computer-readable storage medium, the computer program containing program code for executing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via the communication devices 509, or installed from the storage devices 508, or installed from the memory 502. When the computer program is executed by the processing devices 501, the above-mentioned functions defined in the methods of embodiments of the present application are performed.
[0143] It should be noted that the computer-readable storage medium in the above application can be a computer-readable signal medium or a computer storage medium or any combination of the two. The computer-readable storage medium may, for example, but is not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or component, or any combination of the above. More specific examples of computer-readable storage media can include, but are not limited to, an electrical connection having one or more wires, a portable computer diskette, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In this application, the computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, device or component. In this application, the computer-readable signal medium can include a data signal carried in a baseband or as a part of a carrier wave, which carries computer-readable program code. Such a propagated data signal can take many forms, including but not limited to an electromagnetic signal, an optical signal or any suitable combination of the above. The computer-readable signal medium can also be any computer-readable storage medium other than the computer-readable storage medium, which can send, propagate or transmit a program for use by or in conjunction with an instruction execution system, device or component. The program code contained on the computer-readable storage medium can be transmitted by any suitable medium, including but not limited to a wire, a cable, a RF (radio frequency) or the like, or any suitable combination of the above.
[0144] The computer-readable storage medium described above can be contained in the electronic device described above; or can exist separately and not be assembled into the electronic device.
[0145] The computer-readable storage medium described above carries one or more programs, which, when executed by the electronic device, cause the electronic device to perform the methods shown in the above embodiments.
[0146] Computer program code for carrying out operations of the present application can be written in any combination of one or more programming languages, including an object oriented programming language such as Java, Smalltalk, C++ or the like and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code can execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the latter scenario, the remote computer can be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or the connection can be made to an external computer (for example, through the Internet using an Internet Service Provider).
[0147] The computer program instructions can also be loaded onto a computer or other programmable information processing apparatus to cause a series of operations to be performed on the computer or other programmable information processing apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable information processing apparatus implement the functions / acts specified in the flowchart and / or block diagram block or blocks.
[0148] The modules involved in the embodiments described in the present application can be implemented in software or hardware. Among them, the name of the unit does not constitute a limitation to the module itself in some cases, for example, the configuration determination module can also be described as a "configuration transformation quantity determination module".
[0149] The functions described above in the present document can be performed at least in part by one or more hardware logic components. For example, non-limiting examples of hardware logic components that can be used include Field-programmable Gate Arrays (FPGAs), Application-specific Integrated Circuits (ASICs), Application-specific Standard Products (ASSPs), System-on-a-chip systems (SOCs), Complex Programmable Logic Devices (CPLDs), etc.
[0150] The application further provides a computer readable storage medium, which stores computer execution instructions, and when a processor executes the computer execution instructions, the technical solution of the virtual machine configuration processing method in any of the above embodiments is realized, the implementation principle and beneficial effects of which are similar to those of the virtual machine configuration processing method, and can be referred to the implementation principle and beneficial effects of the virtual machine configuration processing method, which will not be described here in detail.
[0151] In the context of the present application, the machine readable medium can be a tangible medium, which can contain or store a program for use by or in connection with an instruction execution system, apparatus or device. The machine readable medium can be a machine readable signal medium or a machine readable storage medium. The machine readable medium can include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus or device, or any suitable combination of the above. More specific examples of the machine readable storage medium can include one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical storage devices, portable compact disc read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the above.
[0152] The application further provides a computer program product, which includes a computer program, and when the computer program is executed by a processor, the technical solution of the virtual machine configuration processing method in any of the above embodiments is realized, the implementation principle and beneficial effects of which are similar to those of the virtual machine configuration processing method, and can be referred to the implementation principle and beneficial effects of the virtual machine configuration processing method, which will not be described here in detail.
[0153] The above description is merely preferred embodiments of the present application and a description of the principles of the applied technology. It should be understood by those skilled in the art that the disclosed range of the present application is not limited to the technical solutions formed by the specific combinations of the above technical features, and also covers other technical solutions formed by any combinations of the above technical features or equivalent features without departing from the disclosed concept. For example, the above features can be replaced with other technical features disclosed in the present application (but not limited to) having similar functions to form technical solutions.
[0154] Other embodiments of the application will be apparent to those skilled in the art from consideration of the specification and practice of the application disclosed herein. It is intended that the specification and examples be considered as exemplary only, with the true scope and spirit of the application being indicated by the following claims.
[0155] It is to be understood that the application is not limited to the precise construction herein disclosed and shown in the drawings, and that various changes in shape, size and arrangements of parts can be made without departing from the scope of the application. The scope of the application is limited only by the claims that follow.
Claims
1. A virtual machine configuration processing method characterized by comprising: The method comprises the following steps: receiving a configuration change instruction sent by a user terminal, wherein the configuration change instruction comprises a target virtual machine identifier and a target configuration; finding attribute information corresponding to the target virtual machine identifier, wherein the attribute information comprises a node identifier and a current configuration; obtaining a node configuration corresponding to the node identifier; if the node configuration is greater than or equal to the target configuration, determining a configuration change amount according to the target configuration and the current configuration; creating a new virtual machine according to the configuration change amount and the current configuration; the step of determining the configuration change amount according to the target configuration and the current configuration comprises the following steps: subtracting a second parameter value from a first parameter value to obtain a parameter difference, wherein the first parameter value is a parameter value corresponding to a target class configuration parameter in the target configuration, the second parameter value is a parameter value corresponding to the target class configuration parameter in the current configuration, and the target class configuration parameter is any class configuration parameter; collectively determining the parameter differences of all class configuration parameters as the configuration change amount; the step of creating the new virtual machine according to the configuration change amount and the current configuration comprises the following steps: if the parameter differences of all class configuration parameters are negative values, summing the parameter values in the current configuration and the parameter differences to obtain the new virtual machine; if the parameter difference of any class configuration parameter is a positive value, creating a virtual machine intermediate value according to the parameter differences of all class configuration parameters, and creating the new virtual machine according to the current configuration and the virtual machine intermediate value.
2. The method of claim 1, wherein, the step of creating the new virtual machine according to the configuration change amount and the current configuration comprises the following steps: if the configuration change amount is a negative value, removing the absolute value of the configuration change amount in the current configuration to obtain the new virtual machine; if the configuration change amount is a positive value, creating a virtual machine intermediate value with a configuration value being the configuration change amount, and increasing the configuration value of the virtual machine intermediate value in the current configuration to obtain the new virtual machine.
3. The method of claim 2, wherein, after the step of creating the virtual machine intermediate value with the configuration value being the configuration change amount, the method further comprises the following step: in response to receiving a recovery instruction sent by the user terminal, deleting the virtual machine intermediate value.
4. The method according to any one of claims 1 to 3, characterized in that, after the step of determining the configuration change amount according to the target configuration and the current configuration, the method further comprises the following steps: generating a configuration change confirmation request according to the configuration change amount; sending the configuration change confirmation request to the user terminal; in response to receiving a confirmation instruction sent by the user terminal according to the change confirmation request, creating the new virtual machine according to the configuration change amount and the current configuration.
5. The method according to any one of claims 1 to 3, characterized in that, after the step of obtaining the node configuration corresponding to the node identifier, the method further comprises the following steps: if the node configuration is less than the target configuration, sending a node change request to the user terminal; in response to receiving a node change confirmation instruction input by the user on the user terminal, obtaining node configurations of remaining nodes; if the node configuration of a target node is greater than or equal to the target configuration, creating a virtual machine on the target node, wherein the target node is any node.
6. A virtual machine configuration processing apparatus characterized by comprising: The method comprises the following steps: an instruction receiving module is configured to receive a configuration change instruction sent by a user terminal, wherein the configuration change instruction comprises a target virtual machine identifier and a target configuration; An attribute searching module is configured to search attribute information corresponding to the target virtual machine identifier, wherein the attribute information comprises a node identifier and a current configuration; A configuration obtaining module is configured to obtain a node configuration corresponding to the node identifier; A configuration determining module is configured to determine a configuration change amount according to the target configuration and the current configuration if the node configuration is greater than or equal to the target configuration; A virtual machine creating module is configured to create a new virtual machine according to the configuration change amount and the current configuration; The configuration determining module is specifically configured to subtract a second parameter value from a first parameter value to obtain a parameter difference, wherein the first parameter value is a parameter value corresponding to a target class configuration parameter in the target configuration, the second parameter value is a parameter value corresponding to the target class configuration parameter in the current configuration, and the target class configuration parameter is any class configuration parameter; The parameter difference of each class configuration parameter is collectively determined as the configuration change amount; The virtual machine creating module is specifically configured to sum the parameter value in the current configuration and the parameter difference to obtain the new virtual machine if the parameter difference of each class configuration parameter is a negative value; If the parameter difference of any class configuration parameter is a positive value, a virtual machine intermediate amount is created according to the parameter difference of each class configuration parameter, and a new virtual machine is created according to the current configuration and the virtual machine intermediate amount.
7. An electronic device, comprising: Comprise: A processor and a memory connected with the processor in communication; The memory stores computer execution instructions; The processor executes the computer execution instructions stored in the memory to implement the virtual machine configuration processing method in any one of claims 1 to 5.
8. A computer-readable storage medium, characterized in that, The computer readable storage medium stores computer execution instructions, and the computer execution instructions are executed by the processor to implement the virtual machine configuration processing method in any one of claims 1 to 5.
Citation Information
Patent Citations
Method and apparatus for managing virtual machine image files
CN109471701A
Computing cluster updating system, method and device
CN110874256A