Virtual machine upgrading method and device, terminal equipment and storage medium
By deploying the upgraded component program in the independent disk of the template virtual machine and performing snapshot operations, the resource consumption and low efficiency problems during the upgrade of the virtual machine component program are solved, and efficient and safe virtual machine upgrades are achieved.
Patent Information
- Application Number
- CN202410307399.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-03-18
- Publication Date
- 2025-09-19
AI Technical Summary
Existing virtual machine component program upgrade solutions consume a lot of resources and are inefficient when upgrading large-scale virtual machines. In addition, when the upgrade fails, the task needs to be reissued, resulting in a long time and heavy maintenance workload.
By obtaining the upgrade component program image package, the component program of the template virtual machine is upgraded, and the upgraded component program is deployed in the independent disk mounted on the template virtual machine. The virtual machine to be upgraded is obtained and a snapshot operation is performed to achieve one-click batch upgrade.
This reduces resource consumption during virtual machine upgrades, improves upgrade efficiency, ensures data security and integrity of the virtual machines to be upgraded, and simplifies the upgrade process.
Smart Images

Figure CN120669997A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of software upgrade technology, and in particular to a virtual machine upgrade method, apparatus, terminal device, and storage medium. Background Art
[0002] The existing virtual machine component program upgrade solution involves uploading the virtual machine component upgrade program to the virtual machine management center. The virtualization management platform then deploys the upgrade to all virtual machines that require the upgrade, mounting the optical drive containing the virtual machine component upgrade program on each virtual machine that needs to be upgraded. For large-scale virtual machine upgrades, this results in significant resource consumption and performance bottlenecks. Furthermore, if an upgrade fails during the process, the management platform must re-issue the component program upgrade task, resulting in lengthy upgrade times and a heavy maintenance workload.
[0003] Therefore, it is necessary to propose a solution to reduce resource consumption during virtual machine upgrades and improve virtual machine upgrade efficiency. Summary of the Invention
[0004] The main purpose of this application is to provide a virtual machine upgrade method, apparatus, terminal device and storage medium, aiming to reduce resource consumption during virtual machine upgrades and improve the efficiency of virtual machine upgrades.
[0005] To achieve the above objectives, the present application provides a virtual machine upgrade method, which includes:
[0006] Obtain the upgrade component program image package;
[0007] Upgrading the component program of the template virtual machine before the upgrade by using the upgraded component program image package, and deploying the upgraded component program in the independent disk mounted on the template virtual machine before the upgrade to obtain the upgraded template virtual machine;
[0008] Acquire a virtual machine to be upgraded that is associated with the template virtual machine before the upgrade, where the virtual machine to be upgraded is obtained by copying the template virtual machine before the upgrade;
[0009] According to the independent disk mounted on the upgraded template virtual machine, a snapshot operation is performed on the independent disk mounted on the virtual machine to be upgraded to obtain the upgraded virtual machine.
[0010] Optionally, the step of upgrading the component program of the template virtual machine before the upgrade by using the upgraded component program image package, and deploying the upgraded component program in an independent disk mounted on the template virtual machine before the upgrade to obtain the upgraded template virtual machine includes:
[0011] Converting the pre-upgrade template virtual machine into a target virtual machine;
[0012] Upgrading the component program of the template virtual machine before the upgrade by using the upgrade component program image package, and deploying the upgraded component program in the independent disk mounted on the target virtual machine to obtain the target upgraded virtual machine;
[0013] The target upgraded virtual machine is converted into the upgraded template virtual machine.
[0014] Optionally, the step of upgrading the component program of the template virtual machine before the upgrade by using the upgraded component program image package, and deploying the upgraded component program in an independent disk mounted on the target virtual machine to obtain the target upgraded virtual machine includes:
[0015] Creating a leaf node in the independent disk mounted to the target virtual machine;
[0016] The component program of the template virtual machine before the upgrade is upgraded through the upgraded component program image package, and the upgraded component program is deployed on the leaf node to obtain the target upgraded virtual machine.
[0017] Optionally, before the step of obtaining the upgrade component program image package, the following steps are included:
[0018] Creating the template virtual machine before the upgrade, and mounting an independent disk on the template virtual machine before the upgrade;
[0019] A copy operation is performed on the template virtual machine before the upgrade to obtain the virtual machine to be upgraded.
[0020] Optionally, before the step of performing a snapshot operation on the independent disk mounted on the virtual machine to be upgraded based on the independent disk mounted on the upgraded template virtual machine to obtain the upgraded virtual machine, the step includes:
[0021] Setting an upgrade flag for the virtual machine to be upgraded through a virtualization management center, and detecting a working status of the virtual machine to be upgraded;
[0022] When it is detected that the working state of the virtual machine to be upgraded is to execute a restart operation, an upgrade message of the virtual machine to be upgraded is sent to a host agent module.
[0023] Optionally, the step of performing a snapshot operation on the independent disk mounted on the virtual machine to be upgraded based on the independent disk mounted on the upgraded template virtual machine to obtain the upgraded virtual machine includes:
[0024] Receiving the upgrade message through the host agent module;
[0025] According to the upgrade message and the independent disk mounted on the upgraded template virtual machine, a snapshot operation is performed on the independent disk mounted on the virtual machine to be upgraded to obtain the upgraded virtual machine.
[0026] Optionally, the step of performing a snapshot operation on the independent disk mounted on the virtual machine to be upgraded based on the upgrade message and the independent disk mounted on the upgraded template virtual machine to obtain the upgraded virtual machine includes:
[0027] According to the upgrade message, the independent disk file mounted on the to-be-upgraded virtual machine is pointed to the independent disk file mounted on the upgraded template virtual machine to update the independent disk file chain path mounted on the to-be-upgraded virtual machine to obtain the upgraded virtual machine.
[0028] The embodiment of the present application further provides a virtual machine upgrade device, the virtual machine upgrade device comprising:
[0029] Acquisition module, used to obtain the upgrade component program image package;
[0030] The template virtual machine upgrade module is used to upgrade the component program of the template virtual machine before the upgrade through the upgrade component program image package, and deploy the upgraded component program in the independent disk mounted on the template virtual machine before the upgrade to obtain the upgraded template virtual machine;
[0031] A virtual machine acquisition module, configured to acquire a virtual machine to be upgraded that is associated with the template virtual machine before the upgrade, wherein the virtual machine to be upgraded is obtained by copying the template virtual machine before the upgrade;
[0032] The virtual machine upgrade module is used to perform a snapshot operation on the independent disk mounted on the virtual machine to be upgraded according to the independent disk mounted on the upgraded template virtual machine, so as to obtain the upgraded virtual machine.
[0033] An embodiment of the present application also proposes a terminal device, which includes a memory, a processor, and a virtual machine upgrade program stored in the memory and runnable on the processor. When the virtual machine upgrade program is executed by the processor, the steps of the virtual machine upgrade method described above are implemented.
[0034] An embodiment of the present application further provides a computer-readable storage medium, on which a virtual machine upgrade program is stored. When the virtual machine upgrade program is executed by a processor, the steps of the virtual machine upgrade method described above are implemented.
[0035] The virtual machine upgrade method, apparatus, terminal device, and storage medium proposed in the embodiments of the present application are as follows: obtaining an upgrade component program image package; upgrading the component program of the template virtual machine before the upgrade through the upgrade component program image package, and deploying the upgraded component program in an independent disk mounted on the template virtual machine before the upgrade to obtain the upgraded template virtual machine; obtaining a virtual machine to be upgraded associated with the template virtual machine before the upgrade, the virtual machine to be upgraded being obtained by copying the template virtual machine before the upgrade; and taking a snapshot of the independent disk mounted on the virtual machine to be upgraded based on the independent disk mounted on the upgraded template virtual machine to obtain the upgraded virtual machine. By upgrading the component program image package, the component program of the template virtual machine can be quickly upgraded, and the upgraded component program can be deployed in an independent disk mounted on the template virtual machine, thereby quickly obtaining the upgraded template virtual machine. By obtaining the virtual machine to be upgraded obtained by copying the template virtual machine before the upgrade, and then taking a snapshot of the virtual machine to be upgraded based on the upgraded template virtual machine, a one-click batch upgrade of the virtual machines to be upgraded can be achieved, and the security and integrity of the original data of the virtual machines to be upgraded during the upgrade process can be ensured, thereby simplifying the virtual machine upgrade process, reducing resource consumption during virtual machine upgrades, and improving virtual machine upgrade efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0036] Figure 1 This is a schematic diagram of the functional modules of the terminal device to which the virtual machine upgrade device of this application belongs;
[0037] Figure 2 A flowchart of an exemplary embodiment of a method for upgrading a virtual machine according to the present application;
[0038] Figure 3 This is a flowchart of an exemplary embodiment of a virtual machine upgrade method to be upgraded in this application;
[0039] Figure 4 This is a flowchart of an exemplary embodiment of a virtual machine upgrade method to be upgraded in this application;
[0040] Figure 5 This is a flowchart of a fourth exemplary embodiment of the virtual machine upgrade method of the present application;
[0041] Figure 6 This is a flowchart of a fifth exemplary embodiment of the virtual machine upgrade method of the present application;
[0042] Figure 7 This is a flowchart of a sixth exemplary embodiment of the virtual machine upgrade method of the present application;
[0043] Figure 8 A flowchart of a virtual machine component program upgrade for the virtual machine upgrade method of this application;
[0044] Figure 9 A schematic diagram of a program for deploying upgraded components on an independent disk mounted on a target virtual machine of the virtual machine upgrade method of this application;
[0045] Figure 10 This is a flowchart of the first deployment component program of the virtual machine management system of the virtual machine upgrade method of this application;
[0046] Figure 11 Schematic diagram of a virtual machine management system for the virtual machine upgrade method of this application;
[0047] Figure 12 This is a schematic diagram of the process of deploying upgraded components on the independent disk mounted on the upgraded virtual machine according to the virtual machine upgrade method of this application.
[0048] The realization of the objectives, functional features and advantages of this application will be further explained in conjunction with embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION
[0049] It should be understood that the specific embodiments described herein are only used to explain the present application and are not intended to limit the present application.
[0050] The main solution of the embodiment of the present application is: obtaining an upgrade component program image package; upgrading the component program of the template virtual machine before the upgrade through the upgrade component program image package, and deploying the upgraded component program in the independent disk mounted on the template virtual machine before the upgrade to obtain the upgraded template virtual machine; obtaining the virtual machine to be upgraded associated with the template virtual machine before the upgrade, and the virtual machine to be upgraded is obtained by copying the template virtual machine before the upgrade; based on the independent disk mounted on the upgraded template virtual machine, taking a snapshot of the independent disk mounted on the virtual machine to be upgraded to obtain the upgraded virtual machine.
[0051] The embodiments of the present application take into account that the existing virtual machine component program upgrade technology packages the virtual machine component upgrade package into an image file and uploads it to the virtual machine management center. The virtualization management platform mounts the image file of the upgrade component package in the form of an optical drive for the virtual machine that needs to upgrade the virtualization component program. Finally, the virtual machine component upgrade program completes the upgrade of the virtual machine component program based on the mounted upgrade package image drive. Therefore, the existing virtual machine upgrade method needs to separately mount the upgrade package image file for all virtual machines that need to upgrade the component program, and perform the upgrade deployment one by one. In addition, the image file packaged by the virtual machine component upgrade package is stored in the network storage. For large-scale virtual machine scenarios, the upgrade of large quantities of virtual machines will generate a large amount of resource consumption and performance bottlenecks. In addition, when a failure occurs during the upgrade process, the component program upgrade task needs to be re-issued on the management platform, which takes a long time to upgrade and requires a large amount of maintenance work.
[0052] Therefore, the embodiment of the present application can quickly upgrade the component programs of the template virtual machine by upgrading the component program image package, and deploy the upgraded component program on an independent disk mounted on the template virtual machine, thereby quickly obtaining the upgraded template virtual machine. By obtaining the virtual machine to be upgraded by copying the pre-upgrade template virtual machine, and then taking a snapshot of the virtual machine to be upgraded based on the upgraded template virtual machine, a one-click batch upgrade of the virtual machines to be upgraded can be achieved, while ensuring the security and integrity of the original data of the virtual machines to be upgraded during the upgrade process. This simplifies the virtual machine upgrade process, reduces resource consumption during the virtual machine upgrade, and improves the efficiency of the virtual machine upgrade.
[0053] Specifically, refer to Figure 1 , Figure 1 This is a functional module diagram of the terminal device to which the virtual machine upgrade device of this application belongs. The virtual machine upgrade device can be a device independent of the terminal device, capable of performing template virtual machine upgrades and virtual machine upgrades, and can be hosted on the terminal device in the form of hardware or software. The terminal device can be a smart mobile terminal with data processing capabilities, such as a mobile phone or tablet computer, or a fixed terminal device or server with data processing capabilities.
[0054] In this embodiment, the terminal device to which the virtual machine upgrade apparatus belongs includes at least an output module 110 , a processor 120 , a memory 130 and a communication module 140 .
[0055] The memory 130 stores an operating system and a virtual machine upgrade program. The virtual machine upgrade device can store information such as the upgrade component program image package and the component programs of the template virtual machine before the upgrade in the memory 130. The output module 110 can be a display screen, etc. The communication module 140 can include a Wi-Fi module, a mobile communication module, and a Bluetooth module, etc., and communicates with external devices or servers through the communication module 140.
[0056] When the virtual machine upgrade program in the memory 130 is executed by the processor, the following steps are implemented:
[0057] Obtain the upgrade component program image package;
[0058] Upgrading the component program of the template virtual machine before the upgrade by using the upgraded component program image package, and deploying the upgraded component program in the independent disk mounted on the template virtual machine before the upgrade to obtain the upgraded template virtual machine;
[0059] Acquire a virtual machine to be upgraded that is associated with the template virtual machine before the upgrade, where the virtual machine to be upgraded is obtained by copying the template virtual machine before the upgrade;
[0060] According to the independent disk mounted on the upgraded template virtual machine, a snapshot operation is performed on the independent disk mounted on the virtual machine to be upgraded to obtain the upgraded virtual machine.
[0061] Furthermore, when the virtual machine upgrade program in the memory 130 is executed by the processor, the following steps are implemented:
[0062] Converting the pre-upgrade template virtual machine into a target virtual machine;
[0063] Upgrading the component program of the template virtual machine before the upgrade by using the upgrade component program image package, and deploying the upgraded component program in the independent disk mounted on the target virtual machine to obtain the target upgraded virtual machine;
[0064] The target upgraded virtual machine is converted into the upgraded template virtual machine.
[0065] Furthermore, when the virtual machine upgrade program in the memory 130 is executed by the processor, the following steps are implemented:
[0066] Creating a leaf node in the independent disk mounted to the target virtual machine;
[0067] The component program of the template virtual machine before the upgrade is upgraded through the upgraded component program image package, and the upgraded component program is deployed on the leaf node to obtain the target upgraded virtual machine.
[0068] Furthermore, when the virtual machine upgrade program in the memory 130 is executed by the processor, the following steps are implemented:
[0069] Creating the template virtual machine before the upgrade, and mounting an independent disk on the template virtual machine before the upgrade;
[0070] A copy operation is performed on the template virtual machine before the upgrade to obtain the virtual machine to be upgraded.
[0071] Furthermore, when the virtual machine upgrade program in the memory 130 is executed by the processor, the following steps are implemented:
[0072] Setting an upgrade flag for the virtual machine to be upgraded through a virtualization management center, and detecting a working status of the virtual machine to be upgraded;
[0073] When it is detected that the working state of the virtual machine to be upgraded is to execute a restart operation, an upgrade message of the virtual machine to be upgraded is sent to a host agent module.
[0074] Furthermore, when the virtual machine upgrade program in the memory 130 is executed by the processor, the following steps are implemented:
[0075] Receiving the upgrade message through the host agent module;
[0076] According to the upgrade message and the independent disk mounted on the upgraded template virtual machine, a snapshot operation is performed on the independent disk mounted on the virtual machine to be upgraded to obtain the upgraded virtual machine.
[0077] Furthermore, when the virtual machine upgrade program in the memory 130 is executed by the processor, the following steps are implemented:
[0078] According to the upgrade message, the independent disk file mounted on the to-be-upgraded virtual machine is pointed to the independent disk file mounted on the upgraded template virtual machine to update the independent disk file chain path mounted on the to-be-upgraded virtual machine to obtain the upgraded virtual machine.
[0079] Based on the above terminal device architecture but not limited to the above architecture, an embodiment of the method of the present application is proposed.
[0080] Reference Figure 2 , Figure 2 This is a flow chart of an exemplary embodiment of the virtual machine upgrade method of this application. The virtual machine upgrade method includes the following steps:
[0081] Step S100, obtaining the upgrade component program image package;
[0082] The execution subject of the method of this embodiment can be a virtual machine upgrade device, or a virtual machine upgrade terminal device or server. This embodiment takes a virtual machine upgrade device as an example. The virtual machine upgrade device can be integrated into terminal devices such as smart phones and tablet computers with data processing functions.
[0083] This embodiment mainly provides a virtual machine upgrade algorithm, which aims to reduce resource consumption during virtual machine upgrade and improve the efficiency of virtual machine upgrade.
[0084] Specifically, a component program image package for upgrading is obtained and uploaded to a virtual machine management platform or a target server. The image package includes a new version of the component program that needs to be updated.
[0085] Step S200: Upgrading the component program of the template virtual machine before the upgrade using the upgraded component program image package, and deploying the upgraded component program in the independent disk mounted on the template virtual machine before the upgrade, thereby obtaining the upgraded template virtual machine;
[0086] Specifically, the template virtual machine is a pre-installed and configured basic virtual machine. The template virtual machine also has an independent disk mounted thereto. The independent disk is a storage device independent of the virtual machine and is used to store data and applications of the template virtual machine.
[0087] Apply the component program in the upgraded component program image package to the pre-upgrade template VM to upgrade the component program. Deploy the upgraded component program to the independent disk mounted on the pre-upgrade template VM to ensure the new version of the component program can run properly, thus obtaining the upgraded template VM. After the component program upgrade is complete, the upgraded template VM can be used for future VM instance upgrades.
[0088] Step S300: obtaining a virtual machine to be upgraded that is associated with the template virtual machine before the upgrade, wherein the virtual machine to be upgraded is obtained by copying the template virtual machine before the upgrade;
[0089] Specifically, before a virtual machine upgrade, a pre-upgrade template virtual machine is copied to create one or more virtual machines to be upgraded that are associated with the pre-upgrade template virtual machine. The virtual machines to be upgraded share the same basic environment and configuration as the pre-upgrade template virtual machine and are capable of independent operation. During a virtual machine upgrade, the virtual machines to be upgraded that are associated with the pre-upgrade template virtual machine are obtained so that the virtual machines to be upgraded can be upgraded based on the upgraded template virtual machine.
[0090] Step S400 , based on the independent disk mounted on the upgraded template virtual machine, a snapshot operation is performed on the independent disk mounted on the virtual machine to be upgraded, to obtain the upgraded virtual machine.
[0091] Specifically, the independent disk mounted on the virtual machine to be upgraded contains the same operating system, application, and other data as the template virtual machine before the upgrade. Based on the state of the independent disk mounted on the upgraded template virtual machine, a snapshot is taken of the independent disk mounted on the virtual machine to be upgraded, resulting in a new disk snapshot, namely the independent disk mounted on the upgraded virtual machine. This ensures that the independent disk on the upgraded virtual machine contains the same operating system, application, and other data as the upgraded template virtual machine, indicating that the virtual machine has applied the same new version of the component program as the upgraded template virtual machine.
[0092] Snapshots also preserve the pre-upgrade state of the VM during the upgrade process, making it easy to roll back the running version of the VM or compare changes before and after the upgrade. If any problems or errors occur during the upgrade, you can roll back to the pre-upgrade state by restoring the disk snapshot, ensuring the security and integrity of the VM's original data during the upgrade.
[0093] refer to Figure 8, the process of upgrading the component program of a virtual machine can convert the template virtual machine into a virtual machine, and mount the component program upgrade package to the virtual machine in the form of a CD-ROM drive. Upgrade the component program of the virtual machine, and deploy the upgraded component program on an independent disk. Then convert the virtual machine back into a template to obtain the upgraded template virtual machine; find all the virtual machines under the template virtual machine before the upgrade, and set the upgrade flag for all the virtual machines under the template virtual machine before the upgrade; when the virtual machine with the upgrade flag set is restarted next time, the virtualization management platform takes a snapshot of the independent disk where its component program is located and the independent disk of the upgraded template virtual machine, and uses the differential mirror function principle to achieve the synchronous upgrade of all virtual machine component programs under the template virtual machine. The main advantages of this solution are: the existing technology needs to upgrade one by one when the virtual machine is turned on, and the virtual machine needs to be restarted after the upgrade, while the present invention only needs to upgrade and deploy the virtual machine component program once for the template virtual machine, and all virtual machines under the template only need to be restarted to synchronize the upgraded component program deployed in the template independent disk during the restart. The upgrade process is simple and efficient. The differential mirror function of the disk file is used to synchronously update the upgraded component program, which has low system resource usage. The differential mirroring function of independent disk files during restart is used to achieve synchronous update of component programs. Even if a failure occurs, the system disk will not be damaged. The virtual machine can be restarted again to complete the synchronous update of component programs, and upgrades can be made repeatedly.
[0094] This embodiment uses the above-mentioned scheme to obtain an upgrade component program image package; using the upgrade component program image package, upgrade the component program of the pre-upgrade template virtual machine and deploy the upgraded component program on an independent disk mounted on the pre-upgrade template virtual machine to obtain an upgraded template virtual machine; obtain a virtual machine to be upgraded associated with the pre-upgrade template virtual machine, the virtual machine to be upgraded being obtained by copying the pre-upgrade template virtual machine; and based on the independent disk mounted on the upgraded template virtual machine, take a snapshot of the independent disk mounted on the virtual machine to be upgraded to obtain the upgraded virtual machine. Using the upgrade component program image package, the component program of the template virtual machine can be quickly upgraded and the upgraded component program can be deployed on an independent disk mounted on the template virtual machine, thereby quickly obtaining the upgraded template virtual machine. Obtaining the virtual machine to be upgraded obtained by copying the pre-upgrade template virtual machine and then taking a snapshot of the virtual machine to be upgraded based on the upgraded template virtual machine can achieve one-click batch upgrade of the virtual machines to be upgraded, ensuring the security and integrity of the original data of the virtual machines to be upgraded during the upgrade process, simplifying the virtual machine upgrade process, reducing resource consumption during the virtual machine upgrade, and improving virtual machine upgrade efficiency.
[0095] Reference Figure 3 , Figure 3This is a flow chart of an exemplary embodiment of the virtual machine upgrade method to be upgraded in this application. Figure 2 In the embodiment shown, in this embodiment, the steps of upgrading the component program of the template virtual machine before the upgrade by using the upgrade component program image package and deploying the upgraded component program in the independent disk mounted on the template virtual machine before the upgrade to obtain the upgraded template virtual machine include:
[0096] Step S201, converting the template virtual machine before the upgrade into a target virtual machine;
[0097] Step S202, upgrading the component program of the template virtual machine before the upgrade using the upgraded component program image package, and deploying the upgraded component program in the independent disk mounted on the target virtual machine to obtain the target upgraded virtual machine;
[0098] Step S203: converting the target upgrade virtual machine into the upgraded template virtual machine.
[0099] Specifically, the template virtual machine is a universal base image. After being converted into a target virtual machine, personalized configurations such as adjusting resource allocation, installing specific software, and configuring network settings can be performed according to specific needs. In this embodiment, after the template virtual machine is converted into a target virtual machine, the independent disk mounted on the target virtual machine contains the component programs of the template virtual machine before the upgrade. The obtained upgraded component program image package is applied to the target virtual machine to perform the component program upgrade operation. The upgraded component program will be deployed in the independent disk mounted on the target virtual machine to obtain the target upgraded virtual machine. The target upgraded virtual machine is converted back to the state of the template virtual machine, that is, the upgraded template virtual machine is obtained, which contains the latest version of the component program, and can be used as the base image when upgrading the virtual machine to be upgraded that is associated with the template virtual machine before the upgrade.
[0100] This embodiment uses the above-mentioned solution to convert the template virtual machine before the upgrade into the target virtual machine, which can be used for upgrade deployment operations and ensure that the original template virtual machine will not be affected during the upgrade process. When the upgrade fails or a problem occurs, it can be quickly rolled back to the original template virtual machine state to avoid unnecessary impact on the production environment. By upgrading the component program image package of the template virtual machine and deploying the upgraded component program in an independent disk mounted on the target virtual machine, problems that may arise during the upgrade process can be isolated, ensuring the reliability and security of the upgrade. Converting the target upgraded virtual machine into an upgraded template virtual machine allows the upgraded template virtual machine to continue to be used as the standard configuration of the basic environment. Ensure that subsequent upgrades of the virtual machines to be upgraded are based on the upgraded template virtual machine, have the latest component programs and functions, and improve the stability and performance of virtual machine upgrades.
[0101] Reference Figure 4 , Figure 4 This is a flow chart of an exemplary embodiment of the virtual machine upgrade method to be upgraded in this application. Figure 2 In the embodiment shown, in this embodiment, the component program of the template virtual machine before the upgrade is upgraded by using the upgrade component program image package, and the upgraded component program is deployed in the independent disk mounted on the target virtual machine to obtain the target upgraded virtual machine, including the following steps:
[0102] Step S2021: creating a leaf node in the independent disk mounted on the target virtual machine;
[0103] Step S2022: upgrading the component program of the template virtual machine before the upgrade through the upgraded component program image package, and deploying the upgraded component program on the leaf node to obtain the target upgraded virtual machine.
[0104] Specifically, refer to Figure 9 VM1 through VMn represent the labels of the original independent disk files, Temp1 represents the label of the upgraded virtual machine template disk file, and Temp1_old represents the label of the virtual machine template disk before the upgrade. Extract an empty leaf node from the template's independent disk file. Run the upgrade program in the target virtual machine based on the upgraded component program image package to upgrade the component programs of the template virtual machine. During the upgrade process, deploy the upgraded component program to the previously created leaf node.
[0105] This embodiment, through the above solution, creates a new leaf node on the independent disk mounted on the target virtual machine, providing a clean environment for subsequent component program upgrades. The leaf node is an independent space used to store the new version of the component program and related files, ensuring that the upgrade operation does not affect the existing system environment and data. The resulting target upgrade virtual machine will contain the latest version of the component program, minimizing the impact of the upgrade process on the system and improving system stability.
[0106] Further, refer to Figure 5 , Figure 5 This is a flow chart of the fourth exemplary embodiment of the virtual machine upgrade method of this application. Figure 2 In the embodiment shown, in this embodiment, before the step of obtaining the upgrade component program image package, the following steps are included:
[0107] Step S101, creating the template virtual machine before the upgrade, and mounting an independent disk on the template virtual machine before the upgrade;
[0108] Step S102: Copy the template virtual machine before the upgrade to obtain the virtual machine to be upgraded.
[0109] Specifically, refer to Figure 10 When the virtual machine management system deploys virtual machine components for the first time, a template virtual machine before the upgrade is created and the corresponding operating system is set. An independent disk dedicated to deploying virtual machine component programs is mounted on the template virtual machine before the upgrade, and the template virtual machine before the upgrade installs and deploys the virtual machine component programs on the independent disk. The template virtual machine before the upgrade is copied, that is, virtual machines are created based on batch cloning of the template virtual machine to obtain the virtual machine to be upgraded. The operation of cloning the virtual machine includes cloning the independent disk of the template virtual machine to be upgraded, so that the same virtual machine component programs are also deployed in the independent disk mounted on the obtained virtual machine to be upgraded, and the settings are the same as those of the template virtual machine before the upgrade, including the operating system, software components, network configuration and other settings.
[0110] This embodiment uses the above solution to rapidly create multiple virtual machines to be upgraded, each with the same configuration as the pre-upgraded template virtual machine, by batch-copying the pre-upgraded template virtual machine. This ensures consistency between the pre-upgraded template virtual machine and the pre-upgraded template virtual machine. Furthermore, the relationship between the pre-upgraded template virtual machine and the pre-upgraded virtual machine can be determined, allowing the pre-upgraded virtual machines to be upgraded based on the upgraded template virtual machine during the virtual machine upgrade.
[0111] Further, refer to Figure 6 , Figure 6 This is a flowchart of the fifth exemplary embodiment of the virtual machine upgrade method of this application. Figure 2 In the embodiment shown, in this embodiment, before the step of performing a snapshot operation on the independent disk mounted on the to-be-upgraded virtual machine based on the independent disk mounted on the upgraded template virtual machine to obtain the upgraded virtual machine, the following steps are included:
[0112] Step S401: Setting an upgrade flag for the virtual machine to be upgraded through a virtualization management center, and detecting a working status of the virtual machine to be upgraded;
[0113] Step S402: When it is detected that the working state of the virtual machine to be upgraded is to execute a restart operation, an upgrade message of the virtual machine to be upgraded is sent to a host agent module.
[0114] Specifically, refer to Figure 11The diagram of the virtual machine management system includes a virtualization management center, a host agent, and a virtual machine. The independent disk mounted on the virtual machine includes component programs. Through the virtualization management center, based on the relationship between the template virtual machine before the upgrade and the virtual machine to be upgraded, after obtaining the upgraded template virtual machine, a specific upgrade identification bit or upgrade tag is set for the corresponding virtual machine to be upgraded to determine that the virtual machine needs to be upgraded. After setting the upgrade identification bit, ensure that the virtualization management center will continue to detect changes in the working status of the virtual machine to be upgraded. When it is detected that the working status of the virtual machine to be upgraded is to perform a restart operation, a corresponding upgrade message is generated. The upgrade message can be sent to the host agent module through the message queue so that the host agent module can control the virtual machine to be upgraded to upgrade.
[0115] This embodiment, through the above-described solution, automatically performs the upgrade process for the virtual machine to be upgraded by setting an upgrade flag and detecting the operating status of the virtual machine to be upgraded. This allows for better planning and utilization of system resources, reduces the impact of the upgrade process on the performance of other virtual machines, and improves system resource utilization efficiency. By performing upgrades based on upgrade messages, real-time response and processing of upgrade requests is achieved, shortening the response time of upgrade operations.
[0116] Further, refer to Figure 7 , Figure 7 This is a flow chart of the sixth exemplary embodiment of the virtual machine upgrade method of this application. Figure 2 In the embodiment shown, in this embodiment, the steps of performing a snapshot operation on the independent disk mounted on the to-be-upgraded virtual machine based on the independent disk mounted on the upgraded template virtual machine to obtain the upgraded virtual machine include:
[0117] Step S403: receiving the upgrade message through the host agent module;
[0118] Step S404 : performing a snapshot operation on the independent disk mounted on the virtual machine to be upgraded according to the upgrade message and the independent disk mounted on the upgraded template virtual machine to obtain the upgraded virtual machine.
[0119] Specifically, refer to Figure 11, using a host agent module to receive upgrade messages. The host agent module is a component or service responsible for communicating with the virtualization management center. It can listen to messages from the virtualization management center or other management nodes and pass them to the virtual machine to be upgraded. The upgrade message may contain the virtual machine identifier, the image or configuration information required for the upgrade, etc. Based on the received upgrade message and the independent disk file mounted on the upgraded template virtual machine, a snapshot operation is performed on the independent disk mounted on the virtual machine to be upgraded. This snapshot operation implements the upgrade of the virtual machine disk to be upgraded and ensures that the integrity of the original data is not affected during the upgrade process.
[0120] Through the above scheme, this embodiment receives upgrade messages through the host agent module, can automatically perform real-time upgrade operations, and take snapshots of the independent disks mounted on the virtual machine to be upgraded. It can save the current state of the system during the upgrade process, ensuring that it can be quickly rolled back to the previous state when the upgrade fails, preventing data loss or system damage, enhancing the security of the system, and improving the reliability and stability of the system.
[0121] Furthermore, in this embodiment, the step of performing a snapshot operation on the independent disk mounted on the virtual machine to be upgraded based on the upgrade message and the independent disk mounted on the upgraded template virtual machine to obtain the upgraded virtual machine includes:
[0122] Step S4041, according to the upgrade message, points the independent disk file mounted on the virtual machine to be upgraded to the independent disk file mounted on the upgraded template virtual machine to update the independent disk file chain path mounted on the virtual machine to be upgraded to obtain the upgraded virtual machine.
[0123] Specifically, refer to Figure 12 VM1 to VMn represent the labels of the original independent disk files, Temp1 represents the label of the upgraded virtual machine template disk file, and Temp1_o ld represents the label of the virtual machine template disk before the upgrade. A snapshot operation is performed on the independent disk file dedicated to deploying component programs on the upgraded virtual machine and the new independent disk file for deploying the upgraded component programs on the upgraded template virtual machine. That is, the independent disk file dedicated to deploying component programs on the upgraded virtual machine points to the new independent disk file for deploying the upgraded component programs on the template virtual machine. Based on the labels VM1 to VMn representing the original independent disk files, the label Temp1 representing the upgraded virtual machine template disk file, and the label Temp1_o ld representing the upgraded virtual machine template disk, the updated independent disk file chain for the upgraded virtual machine can be represented as VM1 to VMn->Temp1->Temp1_o ld. The upgraded component programs in the template independent disk file are synchronously updated in the independent disk file mounted on the upgraded virtual machine.
[0124] Through the above-mentioned scheme, this embodiment can quickly update the independent disk file chain path mounted on the virtual machine to be upgraded by pointing the independent disk file mounted on the upgraded template virtual machine, thereby avoiding errors and risks that may be caused by operations such as data copying, simplifying the upgrade process, reducing potential problems during the system upgrade process, and improving the efficiency of virtual machine upgrades.
[0125] In addition, an embodiment of the present application further provides a virtual machine upgrade device, the virtual machine upgrade device comprising:
[0126] Acquisition module, used to obtain the upgrade component program image package;
[0127] The template virtual machine upgrade module is used to upgrade the component program of the template virtual machine before the upgrade through the upgrade component program image package, and deploy the upgraded component program in the independent disk mounted on the template virtual machine before the upgrade to obtain the upgraded template virtual machine;
[0128] A virtual machine acquisition module, configured to acquire a virtual machine to be upgraded that is associated with the template virtual machine before the upgrade, wherein the virtual machine to be upgraded is obtained by copying the template virtual machine before the upgrade;
[0129] The virtual machine upgrade module is used to perform a snapshot operation on the independent disk mounted on the virtual machine to be upgraded according to the independent disk mounted on the upgraded template virtual machine, so as to obtain the upgraded virtual machine.
[0130] For the principle and implementation process of implementing the virtual machine upgrade in this embodiment, please refer to the above embodiments and will not be repeated here.
[0131] In addition, an embodiment of the present application also proposes a terminal device, which includes a memory, a processor, and a virtual machine upgrade program stored in the memory and runnable on the processor. When the virtual machine upgrade program is executed by the processor, the steps of the virtual machine upgrade method described above are implemented.
[0132] Since this virtual machine upgrade program adopts all the technical solutions of all the aforementioned embodiments when executed by the processor, it has at least all the beneficial effects brought by all the technical solutions of all the aforementioned embodiments, which will not be described one by one here.
[0133] In addition, an embodiment of the present application further provides a computer-readable storage medium, on which a virtual machine upgrade program is stored. When the virtual machine upgrade program is executed by a processor, the steps of the virtual machine upgrade method described above are implemented.
[0134] Since this virtual machine upgrade program adopts all the technical solutions of all the aforementioned embodiments when executed by the processor, it has at least all the beneficial effects brought by all the technical solutions of all the aforementioned embodiments, which will not be described one by one here.
[0135] Compared to the prior art, the virtual machine upgrade method, apparatus, terminal device, and storage medium proposed in the embodiments of the present application obtain an upgrade component program image package; upgrade the component program of the template virtual machine before the upgrade using the upgrade component program image package, and deploy the upgraded component program on an independent disk mounted on the template virtual machine before the upgrade to obtain the upgraded template virtual machine; obtain a virtual machine to be upgraded associated with the template virtual machine before the upgrade, the virtual machine to be upgraded being obtained by copying the template virtual machine before the upgrade; and take a snapshot of the independent disk mounted on the virtual machine to be upgraded based on the independent disk mounted on the upgraded template virtual machine to obtain the upgraded virtual machine. By upgrading the component program image package, the component program of the template virtual machine can be quickly upgraded, and the upgraded component program can be deployed on an independent disk mounted on the template virtual machine, thereby quickly obtaining the upgraded template virtual machine. By obtaining the virtual machine to be upgraded obtained by copying the template virtual machine before the upgrade, and then taking a snapshot of the virtual machine to be upgraded based on the upgraded template virtual machine, a one-click batch upgrade of the virtual machines to be upgraded can be achieved, and the security and integrity of the original data of the virtual machines to be upgraded during the upgrade process can be ensured, thereby simplifying the virtual machine upgrade process, reducing resource consumption during virtual machine upgrades, and improving virtual machine upgrade efficiency.
[0136] It should be noted that, in this document, the terms "comprises," "includes," or any other variations thereof are intended to encompass non-exclusive inclusion, such that a process, method, article, or system comprising a series of elements includes not only those elements but also other elements not explicitly listed, or elements inherent to such process, method, article, or system. In the absence of further limitations, an element defined by the phrase "comprising a ..." does not exclude the presence of other identical elements in the process, method, article, or system comprising the element.
[0137] The serial numbers of the above embodiments of the present application are for description only and do not represent the advantages or disadvantages of the embodiments.
[0138] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus the necessary general hardware platform, and of course can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) as above, and includes a number of instructions for enabling a terminal device (which can be a mobile phone, computer, server, controlled terminal, or network device, etc.) to execute the method of each embodiment of the present application.
[0139] The above are only preferred embodiments of the present application and do not limit the patent scope of the present application. Any equivalent structure or equivalent process transformation made using the contents of the present application specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present application.
Claims
1. A virtual machine upgrade method, characterized in that: The virtual machine upgrade method includes the following steps: Obtain the upgrade component program image package; Upgrading the component program of the template virtual machine before the upgrade by using the upgraded component program image package, and deploying the upgraded component program in the independent disk mounted on the template virtual machine before the upgrade to obtain the upgraded template virtual machine; Acquire a virtual machine to be upgraded that is associated with the template virtual machine before the upgrade, where the virtual machine to be upgraded is obtained by copying the template virtual machine before the upgrade; According to the independent disk mounted on the upgraded template virtual machine, a snapshot operation is performed on the independent disk mounted on the virtual machine to be upgraded to obtain the upgraded virtual machine.
2. The virtual machine upgrade method according to claim 1, wherein: The step of upgrading the component program of the template virtual machine before the upgrade by using the upgraded component program image package, and deploying the upgraded component program in the independent disk mounted on the template virtual machine before the upgrade to obtain the upgraded template virtual machine includes: Converting the pre-upgrade template virtual machine into a target virtual machine; Upgrading the component program of the template virtual machine before the upgrade by using the upgrade component program image package, and deploying the upgraded component program in the independent disk mounted on the target virtual machine to obtain the target upgraded virtual machine; The target upgraded virtual machine is converted into the upgraded template virtual machine.
3. The virtual machine upgrade method according to claim 2, wherein: The step of upgrading the component program of the template virtual machine before the upgrade by using the upgraded component program image package, and deploying the upgraded component program in the independent disk mounted on the target virtual machine to obtain the target upgraded virtual machine includes: Creating a leaf node in the independent disk mounted to the target virtual machine; The component program of the template virtual machine before the upgrade is upgraded through the upgraded component program image package, and the upgraded component program is deployed on the leaf node to obtain the target upgraded virtual machine.
4. The virtual machine upgrade method according to claim 3, characterized in that: Before the step of obtaining the upgrade component program image package, the following steps are included: Creating the template virtual machine before the upgrade, and mounting an independent disk on the template virtual machine before the upgrade; A copy operation is performed on the template virtual machine before the upgrade to obtain the virtual machine to be upgraded.
5. The virtual machine upgrade method according to claim 1, wherein: Before the step of performing a snapshot operation on the independent disk mounted on the to-be-upgraded virtual machine based on the independent disk mounted on the upgraded template virtual machine to obtain the upgraded virtual machine, the method includes: Setting an upgrade flag for the virtual machine to be upgraded through a virtualization management center, and detecting a working status of the virtual machine to be upgraded; When it is detected that the working state of the virtual machine to be upgraded is to execute a restart operation, an upgrade message of the virtual machine to be upgraded is sent to a host agent module.
6. The virtual machine upgrade method according to claim 5, characterized in that: The step of performing a snapshot operation on the independent disk mounted on the to-be-upgraded virtual machine based on the independent disk mounted on the upgraded template virtual machine to obtain the upgraded virtual machine includes: Receiving the upgrade message through the host agent module; According to the upgrade message and the independent disk mounted on the upgraded template virtual machine, a snapshot operation is performed on the independent disk mounted on the virtual machine to be upgraded to obtain the upgraded virtual machine.
7. The virtual machine upgrade method according to claim 6, characterized in that: The step of performing a snapshot operation on the independent disk mounted on the virtual machine to be upgraded according to the upgrade message and the independent disk mounted on the upgraded template virtual machine to obtain the upgraded virtual machine includes: According to the upgrade message, the independent disk file mounted on the to-be-upgraded virtual machine is pointed to the independent disk file mounted on the upgraded template virtual machine to update the independent disk file chain path mounted on the to-be-upgraded virtual machine to obtain the upgraded virtual machine.
8. A virtual machine upgrade device, characterized in that: The virtual machine upgrading device comprises: Acquisition module, used to obtain the upgrade component program image package; The template virtual machine upgrade module is used to upgrade the component program of the template virtual machine before the upgrade through the upgrade component program image package, and deploy the upgraded component program in the independent disk mounted on the template virtual machine before the upgrade to obtain the upgraded template virtual machine; A virtual machine acquisition module, configured to acquire a virtual machine to be upgraded that is associated with the template virtual machine before the upgrade, wherein the virtual machine to be upgraded is obtained by copying the template virtual machine before the upgrade; The virtual machine upgrade module is used to perform a snapshot operation on the independent disk mounted on the virtual machine to be upgraded according to the independent disk mounted on the upgraded template virtual machine, so as to obtain the upgraded virtual machine.
9. A terminal device, characterized in that: The terminal device includes a memory, a processor, and a virtual machine upgrade program stored in the memory and executable on the processor. When the virtual machine upgrade program is executed by the processor, the steps of the virtual machine upgrade method according to any one of claims 1 to 7 are implemented.
10. A computer-readable storage medium, characterized in that The computer-readable storage medium stores a virtual machine upgrade program, and when the virtual machine upgrade program is executed by the processor, the steps of the virtual machine upgrade method according to any one of claims 1 to 7 are implemented.