Virtual machine upgrading method and apparatus, terminal device, 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
- PCT/CN2025/080546
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2024-03-18
- Filing Date
- 2025-03-04
- Publication Date
- 2025-09-25
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 large maintenance workload.
By obtaining the upgrade component program image package, upgrading the template virtual machine and deploying it on its independent disk, obtaining the virtual machine to be upgraded and taking a snapshot, one-click batch upgrade is achieved.
It reduces resource consumption during virtual machine upgrades, improves upgrade efficiency, ensures data security and integrity, and simplifies the upgrade process.
Smart Images

Figure CN2025080546_25092025_PF_FP_ABST
Abstract
Description
Virtual machine upgrade method, device, terminal device and storage medium
[0001] CROSS-REFERENCE TO RELATED APPLICATIONS
[0002] This disclosure is based on Chinese patent application CN202410307399.1, filed on March 18, 2024, entitled “Virtual Machine Upgrade Method, Apparatus, Terminal Device, and Storage Medium,” and claims the priority of the patent application, all of the contents disclosed therein are incorporated into this disclosure by reference. Technical Field
[0003] The present disclosure relates to the technical field of software upgrade, and in particular to a virtual machine upgrade method, apparatus, terminal device, and storage medium. Background Art
[0004] 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.
[0005] 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
[0006] The main purpose of the present disclosure is to provide a virtual machine upgrade method, apparatus, terminal device and storage medium, aiming to reduce resource consumption during virtual machine upgrade and improve the efficiency of virtual machine upgrade.
[0007] The present disclosure provides a virtual machine upgrade method, which includes: obtaining an upgrade component program image package; upgrading the component program of a pre-upgrade template virtual machine through the upgrade component program image package, and deploying the upgraded component program in an independent disk mounted on the pre-upgrade template virtual machine to obtain an upgraded template virtual machine; obtaining a to-be-upgraded virtual machine associated with the pre-upgrade template virtual machine, wherein the to-be-upgraded virtual machine is obtained by copying the pre-upgrade template virtual machine; and performing a snapshot operation on the independent disk mounted on the to-be-upgraded virtual machine according to the independent disk mounted on the upgraded template virtual machine to obtain the upgraded virtual machine.
[0008] The disclosed embodiment also proposes a virtual machine upgrade device, which includes: an acquisition module, configured to acquire an upgrade component program image package; a template virtual machine upgrade module, configured 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 an independent disk mounted on the template virtual machine before the upgrade to obtain an upgraded template virtual machine; a virtual machine acquisition module, configured to acquire a virtual machine to be upgraded 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; and a virtual machine upgrade module, configured to perform 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.
[0009] An embodiment of the present disclosure also proposes a terminal device, which 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 described above are implemented.
[0010] The embodiment of the present disclosure 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. BRIEF DESCRIPTION OF THE DRAWINGS
[0011] FIG1 is a schematic diagram of functional modules of a terminal device to which the virtual machine upgrade apparatus of the present disclosure belongs;
[0012] FIG2 is a flow chart of an exemplary embodiment of a virtual machine upgrade method disclosed herein;
[0013] FIG3 is a flowchart of an exemplary embodiment of a virtual machine upgrade method to be upgraded according to the present disclosure;
[0014] FIG4 is a flowchart of an exemplary embodiment of a virtual machine upgrade method to be upgraded according to the present disclosure;
[0015] FIG5 is a flowchart of a fourth exemplary embodiment of a virtual machine upgrade method according to the present disclosure;
[0016] FIG6 is a flowchart of a fifth exemplary embodiment of a virtual machine upgrade method according to the present disclosure;
[0017] FIG7 is a flowchart of a sixth exemplary embodiment of a virtual machine upgrade method according to the present disclosure;
[0018] FIG8 is a flow chart of a virtual machine component program upgrade process of a virtual machine upgrade method disclosed herein;
[0019] FIG9 is a schematic diagram of a component program after the independent disk mounted on the target virtual machine of the virtual machine upgrade method disclosed in the present invention is deployed and upgraded;
[0020] FIG10 is a schematic diagram of a process flow of first-time component deployment of a virtual machine management system in a virtual machine upgrade method disclosed herein;
[0021] FIG11 is a schematic diagram of a virtual machine management system of the virtual machine upgrade method disclosed herein;
[0022] FIG12 is a schematic diagram of a component program after the independent disk mounted on the upgraded virtual machine is deployed according to the virtual machine upgrade method disclosed herein.
[0023] The realization of the objectives, functional features and advantages of the present disclosure will be further explained with reference to the accompanying drawings in conjunction with the embodiments. DETAILED DESCRIPTION
[0024] It should be understood that the specific embodiments described herein are only used to illustrate the present disclosure and are not intended to limit the present disclosure.
[0025] The main solution of the embodiment of the present disclosure 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, 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.
[0026] The disclosed embodiments 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.
[0027] Therefore, the disclosed embodiments can quickly upgrade the component programs of a template virtual machine by upgrading the component program image package, and deploy the upgraded component programs 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-upgraded 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 virtual machine upgrades, and improves virtual machine upgrade efficiency.
[0028] In one embodiment, FIG1 is a schematic diagram of the functional modules of a terminal device to which the virtual machine upgrade apparatus of the present disclosure belongs. As shown in FIG1 , the virtual machine upgrade apparatus 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.
[0029] 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 .
[0030] The memory 130 stores the operating system and the 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.
[0031] When the virtual machine upgrade program in the memory 130 is executed by the processor, the following steps are implemented:
[0032] Obtain the upgrade component program image package;
[0033] 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;
[0034] 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;
[0035] 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.
[0036] In one embodiment, when the virtual machine upgrade program in the memory 130 is executed by the processor, the following steps are implemented:
[0037] Converting the pre-upgrade template virtual machine into a target virtual machine;
[0038] 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;
[0039] The target upgraded virtual machine is converted into the upgraded template virtual machine.
[0040] In one embodiment, when the virtual machine upgrade program in the memory 130 is executed by the processor, the following steps are implemented:
[0041] Creating a leaf node in the independent disk mounted to the target virtual machine;
[0042] 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.
[0043] In one embodiment, when the virtual machine upgrade program in the memory 130 is executed by the processor, the following steps are implemented:
[0044] Creating the template virtual machine before the upgrade, and mounting an independent disk on the template virtual machine before the upgrade;
[0045] A copy operation is performed on the template virtual machine before the upgrade to obtain the virtual machine to be upgraded.
[0046] In one embodiment, when the virtual machine upgrade program in the memory 130 is executed by the processor, the following steps are implemented:
[0047] 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;
[0048] 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.
[0049] In one embodiment, when the virtual machine upgrade program in the memory 130 is executed by the processor, the following steps are implemented:
[0050] Receiving the upgrade message through the host agent module;
[0051] 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.
[0052] In one embodiment, when the virtual machine upgrade program in the memory 130 is executed by the processor, the following steps are implemented:
[0053] According to the upgrade message, the independent disk file mounted on the virtual machine to be upgraded 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 virtual machine to be upgraded and obtain the upgraded virtual machine.
[0054] Based on the above terminal device architecture but not limited to the above architecture, an embodiment of the method disclosed herein is proposed.
[0055] FIG2 is a flow chart of an exemplary embodiment of a virtual machine upgrade method disclosed herein. As shown in FIG2 , the virtual machine upgrade method includes the following steps:
[0056] Step S100, obtaining the upgrade component program image package;
[0057] 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.
[0058] 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.
[0059] In this embodiment, 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.
[0060] 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;
[0061] In this embodiment, the template virtual machine is a pre-installed and configured basic virtual machine. The template virtual machine also mounts an independent disk, which is a storage device independent of the virtual machine and is used to store data and applications of the template virtual machine.
[0062] 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.
[0063] 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;
[0064] In this embodiment, before a virtual machine is upgraded, a pre-upgraded template virtual machine is copied to create one or more virtual machines to be upgraded that are associated with the pre-upgraded template virtual machine. The virtual machines to be upgraded share the same basic environment and configuration as the pre-upgraded template virtual machine and are capable of independent operation. During the virtual machine upgrade, the virtual machines to be upgraded that are associated with the pre-upgraded template virtual machine are obtained so that the virtual machines to be upgraded can be upgraded based on the upgraded template virtual machine.
[0065] 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.
[0066] In this embodiment, 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 operation is performed on 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.
[0067] 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.
[0068] As shown in Figure 8, the process of upgrading a virtual machine component program can convert a 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. The component program of the virtual machine is upgraded and the upgraded component program is deployed on an independent disk. The virtual machine is then converted back into a template to obtain an upgraded template virtual machine; all virtual machines under the template virtual machine before the upgrade are found, and the upgrade flag is set for all 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 a synchronous upgrade of all virtual machine component programs under the template virtual machine. The main advantages of this solution are: the existing technology requires upgrading one by one when the virtual machine is powered on, and the virtual machine needs to be restarted after the upgrade, while the present disclosure only requires upgrading and deploying the virtual machine component program once for the template virtual machine. 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, making the upgrade process 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.
[0069] 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.
[0070] FIG3 is a flowchart of an exemplary embodiment of a virtual machine upgrade method according to the present disclosure. As shown in FIG3 , based on the embodiment shown in FIG2 , in this embodiment, the steps of upgrading the component program of the template virtual machine before the upgrade using 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 include:
[0071] Step S201, converting the template virtual machine before the upgrade into a target virtual machine;
[0072] 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;
[0073] Step S203: converting the target upgrade virtual machine into the upgraded template virtual machine.
[0074] In this embodiment, 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 on the independent disk mounted on the target virtual machine, and the target upgraded virtual machine will be obtained. 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.
[0075] 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.
[0076] FIG4 is a flow chart of an exemplary embodiment of a virtual machine upgrade method according to the present disclosure. As shown in FIG4 , based on the embodiment shown in FIG2 , in this embodiment, the steps of upgrading the component program of the template virtual machine before the upgrade using the upgrade 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 include:
[0077] Step S2021: creating a leaf node in the independent disk mounted on the target virtual machine;
[0078] 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.
[0079] In this embodiment, as shown in Figure 9(a), VM1 through VMn represent the labels of the original independent disk files, Templ represents the label of the upgraded virtual machine template disk file, and as shown in Figure 9(b), Templ_old represents the label of the virtual machine template disk before the upgrade. An empty leaf node is extracted from the template's independent disk file, and the upgrade program is executed in the target virtual machine based on the upgraded component program image package, upgrading the component programs of the template virtual machine. During the upgrade process, the upgraded component program is deployed to the previously created leaf node. The upgraded component program is deployed to the newly extracted empty leaf node from the independent disk file.
[0080] 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.
[0081] In one embodiment, FIG5 is a flowchart of a fourth exemplary embodiment of a virtual machine upgrade method disclosed herein. As shown in FIG5 , based on the embodiment shown in FIG2 above, in this embodiment, before the step of obtaining the upgrade component program image package, the following steps are included:
[0082] Step S101, creating the template virtual machine before the upgrade, and mounting an independent disk on the template virtual machine before the upgrade;
[0083] Step S102: Copy the template virtual machine before the upgrade to obtain the virtual machine to be upgraded.
[0084] In this embodiment, as shown in FIG10 , when a virtual machine management system first deploys a virtual machine component, a pre-upgrade template virtual machine is created and the corresponding operating system is configured. An independent disk dedicated to deploying virtual machine component programs is mounted on the pre-upgrade template virtual machine, and the pre-upgrade template virtual machine installs and deploys the virtual machine component programs on the independent disk. A copy operation is performed on the pre-upgrade template virtual machine, i.e., virtual machines are created based on batch cloning of the template virtual machine to obtain the virtual machines to be upgraded. The virtual machine cloning operation includes cloning the independent disk of the template virtual machine to be upgraded, so that the mounted independent disk of the resulting virtual machine to be upgraded also has the same virtual machine component programs deployed and the same settings as the pre-upgrade template virtual machine, including the operating system, software components, network configuration, and other settings.
[0085] 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.
[0086] In one embodiment, FIG6 is a flowchart of a fifth exemplary embodiment of the virtual machine upgrade method disclosed herein. As shown in FIG6 , based on the embodiment shown in FIG2 above, 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 method includes:
[0087] 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;
[0088] 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.
[0089] In this embodiment, FIG11 is a schematic diagram of a virtual machine management system of the virtual machine upgrade method disclosed herein. As shown in FIG11 , the virtual machine management system includes a virtualization management center, a host agent, and a virtual machine, and 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, and the upgrade message can be sent to the host agent module through a message queue so that the host agent module can control the virtual machine to be upgraded to perform an upgrade.
[0090] 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.
[0091] In one embodiment, FIG7 is a flow chart of a sixth exemplary embodiment of a virtual machine upgrade method according to the present disclosure. As shown in FIG7 , based on the embodiment shown in FIG2 , 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:
[0092] Step S403: receiving the upgrade message through the host agent module;
[0093] 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.
[0094] In this embodiment, as shown in Figure 11, a host agent module is used to receive upgrade messages. The host agent module is a component or service responsible for communicating with the virtualization management center. It can monitor 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 enables the upgrade of the disk of the virtual machine to be upgraded and ensures that the integrity of the original data is not affected during the upgrade process.
[0095] 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.
[0096] In one 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:
[0097] 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.
[0098] In this embodiment, as shown in 12(a) and 12(b) of FIG12 , VM1 to VMn represent the labels of the original independent disk files, Templ represents the label of the upgraded virtual machine template disk file, and Templ_old 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 in the virtual machine to be upgraded and the new independent disk file in which the upgraded template virtual machine deploys the upgraded component programs. That is, the independent disk file dedicated to deploying component programs in the virtual machine to be upgraded is pointed to the new independent disk file in which the template virtual machine deploys the upgraded component programs. Based on the labels VM1 to VMn representing the original independent disk files, Templ representing the upgraded virtual machine template disk file, and Templ_old representing the upgraded virtual machine template disk, the updated independent disk file chain for the virtual machine to be upgraded can be represented as VM1 to VMn->Templ->Templ_old. The upgraded component programs in the template independent disk file are synchronously updated in the independent disk file mounted on the upgraded virtual machine.
[0099] 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.
[0100] In addition, the embodiment of the present disclosure further provides a virtual machine upgrade device, the virtual machine upgrade device comprising:
[0101] Get module, set to get the upgrade component program image package;
[0102] The template virtual machine upgrade module is configured 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;
[0103] 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;
[0104] The virtual machine upgrade module is configured to perform 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.
[0105] 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.
[0106] In addition, an embodiment of the present disclosure 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.
[0107] 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.
[0108] In addition, an embodiment of the present disclosure 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.
[0109] 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.
[0110] The virtual machine upgrade method, apparatus, terminal device, and storage medium proposed in the embodiments of the present disclosure include obtaining an upgrade component program image package; upgrading the component program of a pre-upgrade template virtual machine using the upgrade component program image package, and deploying the upgraded component program on an independent disk mounted on the pre-upgrade template virtual machine to obtain an upgraded template virtual machine; obtaining 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 taking a snapshot of the independent disk mounted on the pre-upgrade template virtual machine based on the independent disk mounted on the pre-upgrade template virtual machine 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, while 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 virtual machine upgrades, and improving virtual machine upgrade efficiency.
[0111] 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.
[0112] The serial numbers of the above-mentioned embodiments of the present disclosure are for description only and do not represent the advantages or disadvantages of the embodiments.
[0113] 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 disclosure, 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 mentioned 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 disclosure.
[0114] The above are only preferred embodiments of the present disclosure and are not intended to limit the patent scope of the present disclosure. Any equivalent structure or equivalent process transformation made using the contents of the present disclosure and the drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present disclosure.
Claims
1. A method for upgrading a virtual machine, comprising 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, wherein: 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, wherein: 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, wherein: 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 virtual machine to be upgraded 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 virtual machine to be upgraded and obtain the upgraded virtual machine.
8. A virtual machine upgrade device, comprising: Get module, set to get the upgrade component program image package; The template virtual machine upgrade module is configured 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 configured to perform 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.
9. A terminal device, comprising a memory, a processor, and a virtual machine upgrade program stored in the memory and executable on the processor, wherein the virtual machine upgrade program, when executed by the processor, implements the steps of the virtual machine upgrade method as described in any one of claims 1 to 7.
10. A computer-readable storage medium, wherein a virtual machine upgrade program is stored on the computer-readable storage medium, and when the virtual machine upgrade program is executed by a processor, the steps of the virtual machine upgrade method according to any one of claims 1 to 7 are implemented.
Citation Information
Patent Citations
Method and device for upgrading virtual machines
CN102999369A
Method and device for recovering virtual machine, as well as method and device for upgrading virtual machine
CN105740003A
Virtual machine upgrading method and device
CN106681744A
Cloud desktop virtual machine proxy component upgrading method and device and storage medium
CN112596757A