Cross-version upgrade method, electronic device, product and medium of virtualization system
By creating a new partition in the virtualization system and installing the target version of the virtualization system, the problem that the upgrade package can only be from a specific version to a specific target version in the existing technology is solved, and a smooth upgrade from any historical version to a target version is achieved. Improved upgrade efficiency and convenience.
Patent Information
- Application Number
- CN202410750938.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-12
- Publication Date
- 2024-11-12
- Estimated Expiration
- 2044-06-12
AI Technical Summary
The differential upgrade method of existing virtualization systems can only be from a specific version to a specific target version, which leads to developers need to make differential upgrade packages for each historical version, which is very labor-intensive and inefficient in upgrading.
By determining the target version, creating an upgrade package, creating a new partition, installing the target version of the virtualization system under the new partition, refreshing the GRUB boot item, restarting the system, and switching the original partition to the new partition, thereby realizing any historical version to the target version Smooth upgrade.
It reduces the workload of developers, improves the upgrade efficiency of virtualized systems, reduces operational complexity and risks, and realizes the reusability of upgrade packages.
Smart Images

Figure CN118331612B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of system operation and maintenance technology, and in particular to a cross-version upgrade method, electronic equipment, product and medium for a virtualization system. Background Art
[0002] In the era of cloud computing, the deployment of virtualized systems has gradually become a trend. With the continuous updating and evolution of technology or business, virtualized systems also need to be upgraded. Therefore, it is particularly important to achieve a smooth upgrade from any historical version of the virtualized system to the target version, which has also become a technical problem that technicians in the field of virtualized system management need to solve urgently. The commonly used upgrade method is differential upgrade, which mainly includes two types.
[0003] The first differential upgrade method is to compare the differential files of adjacent versions of the virtualization system to create an upgrade package. This upgrade package only supports the upgrade of adjacent versions. If you want to upgrade the old version of the virtualization system to the target version, you can only perform multiple package continuous upgrades, which takes a long time and is prone to upgrade failures due to the lack of upgrade packages.
[0004] To solve this problem, the second differential upgrade method was proposed, which creates an upgrade package by comparing the differential files of two specific versions (non-adjacent versions) of the virtualization system. With this upgrade package, it only takes one upgrade to upgrade any historical version to the target version. Compared with the first differential upgrade package, the number of upgrades is greatly reduced, reducing the risk of failure.
[0005] Although the second differential upgrade method has some improvements over the first one, it still has defects: the upgrade package can only be upgraded from a specific version to a specific target version. With the continuous updating of the virtualization system, in order to achieve the upgrade from any historical version to the target version, the target version needs to produce a differential upgrade package for each historical version, which brings tedious workload to developers. Summary of the invention
[0006] In view of this, embodiments of the present application provide a cross-version upgrade method, electronic device, product and medium of a virtualization system to overcome the above problems or at least partially solve the above problems.
[0007] A first aspect of an embodiment of the present application provides a cross-version upgrade method for a virtualization system, the method comprising:
[0008] Determine the target version of the virtualization system, and create an upgrade package based on the target version;
[0009] Create a new partition, and create a target version of the virtualized system under the new partition according to the original partition where the upgrade package and the original version of the virtualized system are located;
[0010] Refresh the GRUB boot item, and restart the virtualization system, so that the original partition where the virtualization system is located is switched to the new partition.
[0011] Optionally, before making the upgrade package based on the target version, the method further includes:
[0012] Obtain an image file of the target version, and construct a verification file based on the image file;
[0013] Wherein, the verification file is used to verify the image file of the target version;
[0014] The step of making an upgrade package based on the target version includes:
[0015] An upgrade package of the target version is constructed according to the image file and the verification file.
[0016] Optionally, after determining the target version of the virtualization system and making an upgrade package based on the target version, the method further includes:
[0017] Upload the upgrade package to the specified directory of the original partition where the original version of the virtualization system is located;
[0018] Verify the integrity of the image file in the upgrade package through the verification file;
[0019] After the image file is verified, the upgrade package is decompressed to a specified directory of the original partition where the original version of the virtualization system is located.
[0020] Optionally, creating a new partition includes:
[0021] Obtaining the original partition disk size of the original partition where the original version of the virtualized system is located;
[0022] Based on the original partition disk size, create a new partition with the same size as the original partition disk size;
[0023] After the new partition is created, the new partition is formatted.
[0024] Optionally, the step of creating a target version of the virtualized system under the new partition based on the original partition where the upgrade package and the original version of the virtualized system are located includes:
[0025] Mounting the system directory under the original partition where the original version of the virtualized system is located to the root directory of the new partition, so that the new partition obtains the access rights to the system directory under the original partition where the original version of the virtualized system is located;
[0026] The upgrade package is installed in the new partition to obtain a virtualized system of a target version in the new partition.
[0027] Optionally, before installing the upgrade package in the new partition, the method further includes:
[0028] Configure the source path of yum to the path of the specified directory where the upgrade package is located;
[0029] The step of installing the upgrade package under the new partition includes: installing the upgrade package according to the source path of yum.
[0030] Optionally, after installing the upgrade package in the new partition, the method further includes:
[0031] According to the fstab file in the original partition, a new fstab file is rebuilt in the new partition.
[0032] Optionally, the method further comprises:
[0033] Obtaining static configuration files and dynamic service data of the original version of the virtualization system under the original partition;
[0034] The static configuration files and dynamic service data of the original version of the virtualization system are copied to the new partition.
[0035] Optionally, after refreshing the GRUB boot entry, the method further includes:
[0036] With respect to the static configuration file and the dynamic service data, the virtualized system of the target version is restored to the virtualized system state of the original version.
[0037] Optionally, refreshing the GRUB boot item and restarting the virtualization system so as to switch the original partition where the virtualization system is located to the new partition includes:
[0038] Refresh the GRUB boot item and restart the virtualization system;
[0039] The new partition is set as a default boot partition, so that the original partition where the virtualization system is located is switched to the new partition.
[0040] Optionally, the method further comprises:
[0041] After the virtualization system completes the upgrade of the target version, the virtualization system is converted from the target version to the original version by refreshing the GRUB boot item.
[0042] Optionally, the original version and the target version are adjacent versions or non-adjacent versions.
[0043] A second aspect of an embodiment of the present application provides a cross-version upgrade device for a virtualization system, the device comprising:
[0044] A target version determination module, used to determine a target version of the virtualization system and to create an upgrade package based on the target version;
[0045] A new partition creation module, used to create a new partition, and create a target version of the virtualized system under the new partition according to the original partition where the upgrade package and the original version of the virtualized system are located;
[0046] The restart module is used to refresh the GRUB boot item and restart the virtualization system so that the original partition where the virtualization system is located is switched to the new partition.
[0047] According to a third aspect of an embodiment of the present application, an electronic device is provided, comprising a memory, a processor, and a computer program stored in the memory, wherein the processor executes the computer program to implement the cross-version upgrade method of the virtualization system as described in the first aspect.
[0048] According to a fourth aspect of an embodiment of the present application, a computer program product is provided, including a computer program, which, when executed by a processor, implements the cross-version upgrade method of the virtualization system as described in the first aspect.
[0049] According to a fifth aspect of the embodiments of the present application, a computer-readable medium is provided, on which a computer program is stored, wherein when the computer program is executed by a processor, the cross-version upgrade method of the virtualization system as described in the first aspect is implemented.
[0050] Beneficial effects of this application:
[0051] The embodiment of the present application provides a cross-version upgrade method, electronic device, product and medium of a virtualization system, which determines the target version of the virtualization system, creates an upgrade package based on the target version; creates a new partition, creates a virtualization system of the target version under the new partition based on the upgrade package and the original partition where the virtualization system of the original version is located; refreshes the GRUB boot item, and restarts the virtualization system to switch the original partition where the virtualization system is located to the new partition. The upgrade package can be created through the target version, and a new partition can be created. Under the new partition, a virtualization system under the target version is created based on the upgrade package and the virtualization system of the original partition, and the virtualization system is restarted and started, so that the restarted virtualization system switches to the new partition under the target version, completing the upgrade of the virtualization system.
[0052] Since the upgrade package is made based on the target version, all historical versions are compatible. Therefore, there is no need to make a differential upgrade package for each historical version, which reduces the workload of developers, is more convenient, and improves the upgrade efficiency of the virtualization system. BRIEF DESCRIPTION OF THE DRAWINGS
[0053] The drawings constituting a part of the present application are used to provide a further understanding of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application.
[0054] In order to more clearly illustrate the technical solution of the present application, the drawings required for use in the description of the present application will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.
[0055] Figure 1 This is a flowchart of the basic idea of a cross-version upgrade method for a virtualization system provided by an embodiment of the present application;
[0056] Figure 2 It is a flowchart of a cross-version upgrade method of a virtualization system provided by an embodiment of the present application;
[0057] Figure 3 It is a schematic diagram of a process of deploying a new partition in a cross-version upgrade method of a virtualization system provided by an embodiment of the present application;
[0058] Figure 4 It is a schematic diagram of a partition switching process in a cross-version upgrade method of a virtualization system provided by an embodiment of the present application;
[0059] Figure 5 It is a schematic diagram of a framework of a cross-version upgrade device for a virtualization system provided by an embodiment of the present application. DETAILED DESCRIPTION
[0060] It should be noted that, in the absence of conflict, the embodiments and features in the embodiments of the present application may be combined with each other.
[0061] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0062] Based on the technical problems mentioned in the background technology, this application proposes a cross-version upgrade method for a virtualization system, which can enhance the reusability of the virtualization system upgrade package. Only one upgrade package of the target version corresponding to the virtualization system needs to be made to achieve a smooth upgrade from any historical version to the target version. It can avoid the time-consuming problem of continuous upgrades of multiple packages, and avoid the tedious workload of the target version of the virtualization system needing to make more upgrade packages for different historical versions, thereby improving the upgrade efficiency of the virtualization system.
[0063] Figure 1 This is a flowchart of the basic idea of a cross-version upgrade method for a virtualization system provided by an embodiment of the present application. Figure 1 shown.
[0064] The basic idea of the technical solution of this application:
[0065] 1) Determine the target version of the virtualization system that needs to be upgraded, and create an upgrade package based on the image file of the target version;
[0066] 2) Upload the upgrade package to the specified directory of the original version of the virtualization system. After the upload is successful, the integrity of the upgrade package is verified by RSA algorithm or other verification methods;
[0067] 3) Create a new partition, build the target version of the virtualization system in the new partition, and migrate the backup data of the original virtualization system to the new partition;
[0068] 4) Refresh the grub boot item and switch the partition so that the virtualized system can directly enter the new partition after restarting;
[0069] 5) Restart the virtualization system and restore the backup data to complete the upgrade.
[0070] The technical solution of the present application is described in detail below through embodiments.
[0071] Figure 2 FIG. 1 is a flow chart of a cross-version upgrade method of a virtualization system provided by an embodiment of the present application. Figure 2 As shown, an embodiment of the present application provides a cross-version upgrade method for a virtualization system, the method comprising:
[0072] In step S101, a target version of the virtualization system is determined, and an upgrade package is produced based on the target version;
[0073] In step S102, a new partition is created, and a virtualized system of a target version is created under the new partition according to the original partition where the upgrade package and the virtualized system of the original version are located;
[0074] In step S103, the GRUB boot item is refreshed, and the virtualization system is restarted, so that the original partition where the virtualization system is located is switched to the new partition.
[0075] First, in step S101, a target version of the virtualization system is determined, and an upgrade package is produced based on the target version.
[0076] In an embodiment of the present application, a virtualization system refers to a virtualization software or a virtualization platform installed on a physical server, which is a software system for creating, managing, and running virtual machines or containers, and a target version of the virtualization system is a version to which the virtualization system is to be upgraded. After the target version of the virtualization system is determined, an upgrade package needs to be prepared based on the target version. The upgrade package is a compressed package that contains files, scripts, configuration information, etc. required for upgrading the virtualization system. The upgrade package can be used to upgrade the virtualization system in the original version to a virtualization system in the target version.
[0077] Specifically, in the process of making an upgrade package, you need to first collect the files and programs required for the upgrade, then write an upgrade script or program to perform various operations in the upgrade process, then prepare the upgrade configuration information to ensure that the system can run normally after the upgrade, and finally package all the content related to the system upgrade and generate an upgrade package.
[0078] Furthermore, in step S102, a new partition is created, and based on the original partition where the upgrade package and the original version of the virtualized system are located, a virtualized system of the target version is created under the new partition.
[0079] In an embodiment of the present application, first, according to the original partition where the upgrade package and the original version of the virtualization system are located, a new partition needs to be created. In a computer operating system, partitioning is the process of dividing a hard disk drive into different areas, and each partition can be formatted and managed with a file system separately. A new partition is created in the hard disk, and the new partition is for storing files and data related to the target version of the virtualization system to be upgraded. After the new partition is created, according to the original partition where the upgrade package and the original version of the virtualization system are located, the target version of the virtualization system is installed and configured on the new partition, that is, according to the content in the original partition where the upgrade package and the original version of the virtualization system are located, the target version of the virtualization system is created on the new partition.
[0080] Finally, in step S103, the GRUB boot item is refreshed, and the virtualization system is restarted so that the original partition where the virtualization system is located is switched to the new partition. After the target version of the virtualization system is created in the new partition, the GRUB boot item is refreshed, wherein the GRUB boot item (GRand Unified Bootloader) is a commonly used boot loader responsible for loading the operating system at startup. Here, refreshing the GRUB boot item can update or reconfigure the GRUB boot program to ensure that it can identify and boot the virtualization system with an upgraded version. It should be noted that refreshing the GRUB boot item requires executing relevant commands or configuration files according to actual conditions to update the boot item information. Further, after completing the refresh of the GRUB boot item, the virtualization system needs to be restarted. Restarting the virtualization system will make the new boot configuration effective and allow the virtualization system to start from the new configuration. After restarting, the original partition will be switched to the new partition, that is, the virtualization system will start from the new partition just created. In this way, the upgraded target version of the virtualization system will replace the original version, and the virtualization system will run on the new partition, thereby realizing the upgrade of the target version of the virtualization system.
[0081] In an embodiment of the present application, an upgrade package can be created through the target version, and a new partition can be created. Under the new partition, a virtualization system based on the upgrade package and the original partition can be created to create a virtualization system under the target version, and the virtualization system can be restarted. After the restart, the virtualization system switches to the new partition under the target version, completing the upgrade of the virtualization system.
[0082] Through the above embodiment, since the upgrade package is made based on the target version, each historical version is compatible. Therefore, there is no need to make a differential upgrade package for each historical version, which reduces the workload of developers, is more convenient, and improves the upgrade efficiency of the virtualization system. In addition, creating a virtualization system of the target version under a new partition allows the virtualization system of the target version to be deployed independently of the original partition, avoiding the virtualization system of the target version from being affected by the original version. At the same time, creating a new partition can make the virtualization system of the target version have an independent file system and storage space, which is convenient for backup and recovery operations. If an accident or error occurs during the upgrade process, it can be easier to roll back to the original partition without affecting the original data.
[0083] Optionally, the original version and the target version are adjacent versions or non-adjacent versions.
[0084] Specifically, in the embodiment of the present application, the original version and the target version are adjacent versions or non-adjacent versions, that is, in the process of version upgrade, since the upgrade package is created based on the target version, the upgrade package is reusable, that is, it can be used for any historical version. And based on the new partition method, the data of the virtualized system under the original version can be mounted under the new partition, so there is no need to consider whether the original version and the target version are adjacent versions or non-adjacent versions.
[0085] Through the above embodiments, the upgrade process of the virtualization system can be simplified, the operational complexity and risk can be reduced, and the efficiency and consistency of the upgrade can be improved. This method is applicable to virtualization systems of multiple different versions, making the upgrade process more flexible and convenient.
[0086] Optionally, before making the upgrade package based on the target version, the method further includes:
[0087] Obtain an image file of the target version, and construct a verification file based on the image file;
[0088] Wherein, the verification file is used to verify the image file of the target version;
[0089] The step of making an upgrade package based on the target version includes:
[0090] An upgrade package of the target version is constructed according to the image file and the verification file.
[0091] Specifically, in an embodiment of the present application, the first step in making an upgrade package is to obtain an image file of the virtualization system of the target version. The image file is a complete system snapshot, which contains all files and configurations of the virtualization system of the target version. By obtaining the image file of the target version, it can be used as the basic material for making the upgrade package. After obtaining the image file of the target version, it is necessary to build a verification file based on this image file. The verification file is a file used to verify the integrity and consistency of the image file of the target version. Through the verification file, after the subsequent production of the upgrade package, the image file of the target version can be verified by the verification file to ensure that the file is not damaged or tampered with. After preparing the image file and the verification file of the target version, the upgrade package is started. The process of making the upgrade package includes the operation of building the upgrade package according to the image file and the verification file of the target version. This means that the necessary files, configurations and data in the image file are sorted and packaged, and the verification file is included to ensure integrity. By integrating the image file and the verification file of the target version, the upgrade package of the target version is finally constructed. That is, the upgrade package contains all the components and information required for upgrading any version to the target version, which can be used to upgrade the virtualization system to the target version.
[0092] Through the above embodiment, by obtaining the image file, building the verification file and making the upgrade package, the setting of the verification file can ensure the integrity and validity of the upgrade package, thereby successfully completing the version upgrade of the virtualization system.
[0093] Optionally, in the process of making the upgrade package, further content may be supplemented to improve the quality and reliability of the upgrade package, which may include the following aspects:
[0094] Version compatibility testing: Before making an upgrade package, you can perform version compatibility testing. This means testing the upgrade package on the target version to ensure that the upgrade package can be successfully applied between different original versions. This can help discover potential compatibility issues and resolve them in advance.
[0095] Add error handling and rollback mechanisms: To deal with errors that may occur during version upgrades, consider adding error handling and rollback mechanisms to the upgrade package. For example, when an upgrade fails, it can automatically roll back to the original version to avoid system interruption or damage.
[0096] Add certificates and digital signatures: To ensure the integrity and authenticity of the upgrade package, you can consider adding certificates and digital signatures. By digitally signing the upgrade package, you can verify the source and integrity of the upgrade package and prevent tampering and malicious operations.
[0097] Documentation and instructions: When making an upgrade package, you can provide detailed documentation and instructions, including upgrade steps, precautions, and solutions to common problems. This will help users better understand and use the upgrade package and reduce operational errors.
[0098] Automated deployment tools: We will develop automated deployment tools to simplify the deployment process of upgrade packages. Automated tools can reduce manual operations and errors, and improve upgrade efficiency and consistency.
[0099] Optionally, after determining the target version of the virtualization system and making an upgrade package based on the target version, the method further includes:
[0100] Upload the upgrade package to the specified directory of the original partition where the original version of the virtualization system is located;
[0101] Verify the integrity of the image file in the upgrade package through the verification file;
[0102] After the image file is verified, the upgrade package is decompressed to a specified directory of the original partition where the original version of the virtualization system is located.
[0103] Specifically, in an embodiment of the present application, after the upgrade package is made, the upgrade package must first be uploaded to the specified directory of the original partition where the original version of the virtualization system is located to ensure that the upgrade package can be accessed by the virtualization system to facilitate subsequent upgrade operations. Further, it is necessary to verify the integrity of the image file in the upgrade package through a verification file. The verification file contains verification information for the image file, and through verification, it can be ensured that the image file is not lost or damaged. After the verification of the image file passes, the upgrade package is decompressed to the specified directory of the original partition where the original version of the virtualization system is located. Decompressing the upgrade package means decompressing the files, configurations, and data in the upgrade package and deploying them to the location specified by the system.
[0104] Through the above embodiments, the prepared upgrade package can be successfully applied to the original version of the virtualized system to implement the system upgrade operation. At the same time, by verifying the upgrade package, the integrity and correctness of the upgrade package can be ensured to ensure that the upgrade process proceeds smoothly, and the virtualized system can run normally in the target version, thereby improving the effectiveness and reliability of the version upgrade operation.
[0105] Optionally, creating a new partition includes:
[0106] Obtaining the original partition disk size of the original partition where the original version of the virtualized system is located;
[0107] Based on the original partition disk size, create a new partition with the same size as the original partition disk size;
[0108] After the new partition is created, the new partition is formatted.
[0109] Figure 3 FIG. 1 is a flow chart of deploying a new partition in a cross-version upgrade method of a virtualization system provided in an embodiment of the present application. Figure 3 shown.
[0110] Specifically, in an embodiment of the present application, during the process of upgrading the virtualization system, it is necessary to create a new partition in the system. First, it is necessary to obtain the disk size of the original partition where the original version of the virtualization system is located. By obtaining the disk size of the original partition, the disk size that the new partition needs to have can be determined to ensure that the new partition is the same size as the original partition; further, a new partition of the same size as the original partition is created: based on the obtained disk size of the original partition, a new partition is created, and the size of the new partition is the same as the original partition. This ensures that the new partition is large enough to accommodate the files and data required by the virtualization system while maintaining the same capacity as the original partition. Finally, after the new partition is created, the new partition needs to be formatted in preparation for installing the file system on the new partition. Formatting refers to establishing a file system structure on the new partition so that it can store and manage files and data. This step ensures that the new partition can be used normally.
[0111] As an example, the disk size of the original partition where the original version of the virtualization system is located is obtained, a new partition / s_root having the same disk size as the original partition where the original version of the virtualization system is located is created, and the new partition is formatted using the underlying command (mkfs.ext4).
[0112] Through the above embodiments, a new partition can be created in the virtualization system to provide additional storage space or other necessary support for the upgrade process of the virtualization system. Creating a new partition is helpful for system management and upgrade.
[0113] Optionally, the step of creating a target version of the virtualized system under the new partition based on the original partition where the upgrade package and the original version of the virtualized system are located includes:
[0114] Mounting the system directory under the original partition where the original version of the virtualized system is located to the root directory of the new partition, so that the new partition obtains the access rights to the system directory under the original partition where the original version of the virtualized system is located;
[0115] The upgrade package is installed in the new partition to obtain a virtualized system of a target version in the new partition.
[0116] Specifically, Figure 3As shown, in an embodiment of the present application, during the virtualization system upgrade process, a target version of the virtualization system is created under a new partition. First, the system directory under the original partition where the original version of the virtualization system is located is mounted to the root directory of the new partition. By mounting the system directory, the new partition can obtain access rights to the system directory of the original partition in order to read and copy the files and configurations therein. Further, by installing the upgrade package, the target version of the virtualization system is deployed to the new partition to achieve the system upgrade. Installing the upgrade package means installing the files, configurations, and data in the upgrade package to the new partition, making the new partition the target version of the virtualization system.
[0117] As an example: When you need to upgrade a virtualized system, the specific steps may be as follows:
[0118] Assume that the system directory of the original version of the virtualization system is / sys, which stores system information.
[0119] Prepare a new partition and mount the system directory of the original version of the virtualization system, / sys, to the / s_root directory.
[0120] Mount command:
[0121] mount --rbind / sys / s_root / sys means to mount the system directory / sys of the original version of the virtualization system to the / s_root / sys directory of the new partition.
[0122] Among them, mount is the mount command, and --rbind is an instruction parameter, which means to recursively mount a directory and all its subdirectories.
[0123] / sys is the system directory of the original version of the virtualization system, and / s_root / sys is the corresponding directory of the new partition.
[0124] Operation effect:
[0125] Through the above command, the system information in the / sys directory of the original version of the virtualization system will be mounted to the / s_root / sys directory of the new partition.
[0126] The / s_root / sys directory on the new partition will become a mirror of the original version of the virtualized system / sys directory, and can obtain the same system information and enjoy the same access rights.
[0127] This allows you to easily access and operate the system information of the original version of the virtualized system on the new partition, which is very useful for system maintenance and management.
[0128] In summary, when you use the mount --rbind command to mount a directory, you mount the specified directory of the original version of the virtualized system to the corresponding directory on the new partition, thereby obtaining the access rights and functions of the same directory of the original version of the virtualized system on the new partition. Execute the upgrade package installer to deploy the target version of the virtualized system to the new partition. For example, you can run a script or installer to decompress the upgrade package, configure the new system, and start the new version system service.
[0129] Through the above embodiment, the virtualized system of the target version can be successfully created under the new partition, and the system upgrade process can be completed. Mounting the original partition system directory can ensure that the new partition obtains the necessary system files, and installing the upgrade package can deploy the target version of the system to the new partition to achieve system upgrade. These steps ensure the smooth progress of the upgrade process and the correct deployment of the new system.
[0130] Optionally, before installing the upgrade package in the new partition, the method further includes:
[0131] Configure the source path of yum to the path of the specified directory where the upgrade package is located;
[0132] The step of installing the upgrade package under the new partition includes: installing the upgrade package according to the source path of yum.
[0133] Specifically, yum (Yellowdog Updater, Modified) is a powerful software package management tool. By configuring the yum source path, the software packages on the system can be easily managed to meet the requirements of the system administrator on software installation, update and upgrade. In the embodiment of the present application, before installing the upgrade package, the upgrade package can be installed by configuring the yum source path, and the underlying command (yum --repofrompath) is used to install all rpm packages in the yum source in the root directory of the new partition.
[0134] First, if Figure 3 As shown in the figure, before executing the upgrade package installation, you can set the source path of yum, that is, specify the yum server or local path, that is, tell the virtualization system where to find and obtain the installation package. Configuring the source path of yum to the specified directory path where the upgrade package is located means that the system will obtain the software packages, dependencies, etc. required for the upgrade package from the specified directory. Further, according to the set yum source path, execute the installation command in the new partition to install the upgrade package. The virtualization system obtains the upgrade package from the specified directory path according to the configuration of the yum source path and performs the installation operation.
[0135] As an example:
[0136] Before you install the upgrade package in a new partition, you can first configure the yum source path to the specified directory path where the upgrade package is located, and then install the upgrade package according to the path.
[0137] Use the --repofrompath parameter of the Yum command to install all rpm packages in the specified group in the Yum software repository with a specified path in the directory of the new partition.
[0138] Set the Yum software repository path to the upgrade package path:
[0139] First, you need to configure the Yum software repository path as the path of the upgrade package.
[0140] Use the yum --repofrompath command:
[0141] Next, use the yum --repofrompath command to instruct Yum to load the software repository information from the specified path.
[0142] Optionally, after installing the upgrade package in the new partition, the method further includes:
[0143] According to the fstab file in the original partition, a new fstab file is rebuilt in the new partition.
[0144] Specifically, the fstab file (File System Table, a configuration file in the Linux operating system). In the embodiment of the present application, Figure 3 As shown in the figure, after installing the upgrade package, you need to recreate a new fstab file. Therefore, you can obtain the fstab file under the original partition and rebuild a new fstab file under the new partition based on the fstab file under the original partition.
[0145] Through the above embodiment, a new fstab file can be rebuilt under the new partition according to the fstab file under the original partition, thereby facilitating the management of the virtualization system and improving the stability of the virtualization system.
[0146] Optionally, the method further comprises:
[0147] Obtaining static configuration files and dynamic service data of the original version of the virtualized system under the original partition;
[0148] The static configuration files and dynamic service data of the original version of the virtualization system are copied to the new partition.
[0149] Specifically, the static configuration file contains the configuration information of the virtualization system, such as network settings, service configuration, system parameters, etc. Static configuration files are usually not changed frequently, such as / etc / network / interfaces, / etc / hosts, etc. Dynamic business data contains the operating data of business applications in the virtualization system, such as databases, log files, user data, etc. Dynamic business data changes continuously as the system runs. In an embodiment of the present application, it is necessary to obtain the static configuration file and dynamic business data of the original version of the virtualization system under the original partition, copy the static configuration file in the original partition to the new partition, and ensure that the virtualization system can use the same static configuration file to provide services. At the same time, the dynamic business data in the original partition is copied to the new partition to retain the business data generated when the virtualization system is running under the original version. This ensures that the virtualization system after the version upgrade has the same data state as the original version of the virtualization system.
[0150] Through the above embodiments, Figure 3 As shown, copying the static configuration files and dynamic business data of the original version of the virtualization system to the new partition can ensure that the newly deployed virtualization system has the same configuration and data as the original system, thereby achieving smooth system upgrade or migration and improving the functionality and stability of the virtualization system after the version upgrade.
[0151] Optionally, after refreshing the GRUB boot entry, the method further includes:
[0152] With respect to the static configuration file and the dynamic service data, the virtualized system of the target version is restored to the virtualized system state of the original version.
[0153] In the embodiment of the present application, a key step after refreshing the GRUB boot item is to use the copied static configuration files and dynamic service data to restore the target version of the virtualization system to the state of the original version of the virtualization system.
[0154] Specifically, after completing the installation of the target version virtualization system and the corresponding configuration (i.e. installing the upgrade package and copying the static configuration file and dynamic business data), by refreshing the GRUB boot item, ensure that the system boot program recognizes the configuration of the virtualization system so as to correctly start the target version system. By processing the static configuration file and dynamic business data, the target version virtualization system is restored to the state of the original version virtualization system. Ensure that the target version virtualization system has the same configuration and data as the original version, thereby maintaining the consistency of system functions and stability.
[0155] Through the above embodiment, the target version virtualization system is restored to the original version system state, and the system administrator can ensure that after switching to the new version system, the virtualization system can continue to operate normally with the original configuration and data state after the version upgrade.
[0156] Optionally, refreshing the GRUB boot item and restarting the virtualization system so as to switch the original partition where the virtualization system is located to the new partition includes:
[0157] Refresh the GRUB boot item and restart the virtualization system;
[0158] The new partition is set as a default boot partition, so that the original partition where the virtualization system is located is switched to the new partition.
[0159] Specifically, in an embodiment of the present application, in the process of refreshing the GRUB boot item and restarting the virtualization system, the original partition is switched to the new partition. First, the GRUB boot item needs to be refreshed to ensure that the virtualization system can correctly identify the system configuration of the target version. Further, by restarting the virtualization system, the new GRUB boot item and other system files are loaded to prepare to switch the original partition to the new partition. After restarting, the new partition needs to be set as the default boot partition. The virtualization system is automatically booted to the new partition at startup, rather than the original partition of the original version. After setting the new partition as the default boot partition, the original partition will be switched to the new partition, so that the operating environment and configuration of the virtualization system will be switched from the original partition to the new partition, so that the virtualization system will continue to run on the new partition.
[0160] As an example, you can use the chroot command to switch the root directory to the root directory / s_root of the new partition, use the underlying command (grub2-mkconfig -o) to refresh the grub boot item, and set the new partition as the default boot partition so that the virtualized system can enter the new partition after restarting.
[0161] Figure 4 is a schematic diagram of a partition switching process in a cross-version upgrade method of a virtualization system provided by an embodiment of the present application, such as Figure 4 As described above, before creating a new partition, the virtualization system corresponds to four partitions, namely, the boot partition, the system partition, the swap partition, and the log partition. Among them, the system partition of the virtualization system is the original partition. After creating a new partition, the system partition of the virtualization system is still the original partition until the grub boot item is refreshed and restarted, and the system partition of the virtualization system is switched from the original partition to the new partition.
[0162] Through the above embodiment, by refreshing the GRUB boot item and restarting the system, and setting the new partition as the default boot partition, the original partition is switched to the new partition, and the target version of the virtualization system runs normally under the new partition.
[0163] Optionally, the method further comprises:
[0164] After the virtualization system completes the upgrade of the target version, the virtualization system is converted from the target version to the original version by refreshing the GRUB boot item.
[0165] Specifically, in the embodiment of the present application, after completing the process of upgrading the virtualization system to the target version, the system has been successfully installed and configured as the target version. Refreshing the GRUB boot item is to update the configuration of the boot program so that the virtualization system can correctly identify and boot to the original version of the virtualization system when it starts, thereby returning the virtualization system to the configuration and environment of the original version when it starts.
[0166] Through the above embodiment, the virtualized system can be switched from the target version back to the original version when needed, which is convenient for rolling back to the previous system version in an emergency, or restoring to the original version for repair when problems occur after upgrading.
[0167] Figure 5 is a schematic diagram of a framework of a cross-version upgrade device for a virtualization system provided by an embodiment of the present application, such as Figure 5 shown.
[0168] Based on the same inventive concept, another embodiment of the present application further provides a cross-version upgrade device for a virtualization system, the device comprising:
[0169] A target version determination module 11 is used to determine a target version of the virtualization system and to create an upgrade package based on the target version;
[0170] A new partition creation module 12, used to create a new partition, and create a target version of the virtualized system under the new partition according to the original partition where the upgrade package and the original version of the virtualized system are located;
[0171] The restart module 13 is used to refresh the GRUB boot item and restart the virtualization system so that the original partition where the virtualization system is located is switched to the new partition.
[0172] Optionally, the device further comprises:
[0173] A verification file construction module, used to obtain the image file of the target version and construct a verification file based on the image file before making an upgrade package based on the target version;
[0174] Wherein, the verification file is used to verify the image file of the target version;
[0175] The verification file construction module includes:
[0176] The verification file construction unit is used to construct the upgrade package of the target version according to the image file and the verification file.
[0177] Optionally, the device further comprises:
[0178] An upgrade package uploading module is used to determine the target version of the virtualization system, create an upgrade package based on the target version, and then upload the upgrade package to a designated directory of the original partition where the original version of the virtualization system is located;
[0179] A verification module, used to verify the integrity of the image file in the upgrade package through the verification file;
[0180] The decompression module is used to decompress the upgrade package to a specified directory of the original partition where the original version of the virtualization system is located after the image file is verified.
[0181] Optionally, the new partition creation module 12 includes:
[0182] An original partition disk size acquisition unit, used to acquire the original partition disk size of the original partition where the original version of the virtualization system is located;
[0183] A new partition creation unit, configured to create a new partition having the same size as the original partition disk size based on the original partition disk size;
[0184] The formatting unit is used to format the new partition after the new partition is created.
[0185] Optionally, the new partition creation module 12 includes:
[0186] A mounting unit, used to mount the system directory under the original partition where the original version of the virtualization system is located to the root directory of the new partition, so that the new partition obtains the access rights to the system directory under the original partition where the original version of the virtualization system is located;
[0187] The installation unit is used to install the upgrade package in the new partition to obtain the virtualized system of the target version in the new partition.
[0188] Optionally, the device further comprises:
[0189] A path configuration module, used for configuring the source path of yum to the path of the designated directory where the upgrade package is located before installing the upgrade package in the new partition;
[0190] The installation unit includes: an installation subunit, which is used to install the upgrade package according to the source path of yum.
[0191] Optionally, the device further comprises:
[0192] The file reconstruction module is used to rebuild a new fstab file under the new partition according to the fstab file under the original partition after the upgrade package is installed under the new partition.
[0193] Optionally, the device further comprises:
[0194] A data acquisition module, used to acquire static configuration files and dynamic service data of the original version of the virtualization system under the original partition;
[0195] The copy module is used to copy the static configuration files and dynamic service data of the original version of the virtualization system to the new partition.
[0196] Optionally, the device further comprises:
[0197] The data recovery module is used to restore the virtualization system of the target version to the virtualization system state of the original version for the static configuration file and the dynamic service data after the GRUB boot item is refreshed.
[0198] Optionally, the restart module 13 includes:
[0199] A refresh module, used for refreshing the GRUB boot item and restarting the virtualization system;
[0200] The switching module is used to set the new partition as the default boot partition so that the original partition where the virtualization system is located is switched to the new partition.
[0201] Optionally, the device further comprises:
[0202] The original version conversion module is used to convert the virtualization system from the target version to the original version by refreshing the GRUB boot item after the virtualization system completes the upgrade of the target version.
[0203] Optionally, the original version and the target version are adjacent versions or non-adjacent versions.
[0204] Based on the same inventive concept, another embodiment of the present application further provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory, wherein the processor executes the computer program to implement the cross-version upgrade method of the virtualization system as described in any of the above embodiments.
[0205] Based on the same inventive concept, another embodiment of the present application further provides a computer program product, including a computer program, which is executed by a processor to implement the cross-version upgrade method of the virtualization system as described in any of the above embodiments.
[0206] Based on the same inventive concept, another embodiment of the present application further provides a computer-readable medium on which a computer program is stored, wherein when the program is executed by a processor, the cross-version upgrade method of the virtualization system as described in any of the above embodiments is implemented.
[0207] As for the device, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.
Claims
1. A cross-version upgrade method for a virtualization system, characterized in that: The method comprises: Determine the target version of the virtualization system, and create an upgrade package based on the target version; A new partition is created, and a target version of the virtualized system is created under the new partition according to the upgrade package and the original partition where the original version of the virtualized system is located, including: mounting the system directory under the original partition where the original version of the virtualized system is located to the root directory of the new partition, so that the new partition obtains the access rights of the system directory under the original partition where the original version of the virtualized system is located; installing the upgrade package under the new partition to obtain the target version of the virtualized system under the new partition; Refresh the GRUB boot item and restart the virtualization system so that the original partition where the virtualization system is located is switched to the new partition; The method further comprises: Obtaining the static configuration file and dynamic service data of the original version of the virtualization system under the original partition; copying the static configuration file and dynamic service data of the original version of the virtualization system to the new partition; The method further includes: after the virtualization system completes the upgrade of the target version, refreshing the GRUB boot entry so as to convert the virtualization system from the target version to the original version.
2. The cross-version upgrade method of a virtualization system according to claim 1, characterized in that: Before making an upgrade package based on the target version, the following is also included: Obtain an image file of the target version, and construct a verification file based on the image file; Wherein, the verification file is used to verify the image file of the target version; The step of making an upgrade package based on the target version includes: An upgrade package of the target version is constructed according to the image file and the verification file.
3. The cross-version upgrade method of a virtualization system according to claim 2, characterized in that: After determining the target version of the virtualization system and making an upgrade package based on the target version, the method further includes: Upload the upgrade package to the specified directory of the original partition where the original version of the virtualization system is located; Verify the integrity of the image file in the upgrade package through the verification file; After the image file is verified, the upgrade package is decompressed to a specified directory of the original partition where the original version of the virtualization system is located.
4. The cross-version upgrade method of a virtualization system according to claim 1, characterized in that: The creating of a new partition comprises: Obtaining the original partition disk size of the original partition where the original version of the virtualized system is located; Based on the original partition disk size, create a new partition with the same size as the original partition disk size; After the new partition is created, the new partition is formatted.
5. The cross-version upgrade method of a virtualization system according to claim 3, characterized in that: Before installing the upgrade package in the new partition, the method further includes: Configure the source path of yum to the path of the specified directory where the upgrade package is located; The step of installing the upgrade package under the new partition includes: installing the upgrade package according to the source path of yum.
6. The cross-version upgrade method of a virtualization system according to claim 1, characterized in that: After installing the upgrade package in the new partition, the method further includes: According to the fstab file in the original partition, a new fstab file is rebuilt in the new partition.
7. The cross-version upgrade method of a virtualization system according to claim 5, characterized in that: After the GRUB boot entry is refreshed, the following steps are also included: With respect to the static configuration file and the dynamic service data, the virtualized system of the target version is restored to the virtualized system state of the original version.
8. The cross-version upgrade method of a virtualization system according to claim 1, characterized in that: The refreshing of the GRUB boot item and restarting the virtualization system so that the original partition where the virtualization system is located is switched to the new partition includes: Refresh the GRUB boot item and restart the virtualization system; The new partition is set as a default boot partition, so that the original partition where the virtualization system is located is switched to the new partition.
9. The cross-version upgrade method of a virtualization system according to any one of claims 1 to 8, characterized in that: The original version and the target version are adjacent versions or non-adjacent versions.
10. An electronic device, characterized in that: The system comprises a memory, a processor and a computer program stored in the memory, wherein the processor executes the computer program to implement the cross-version upgrade method of the virtualization system according to any one of claims 1 to 9.
11. A computer readable medium, characterized in that A computer program is stored thereon, wherein when the computer program is executed by a processor, the cross-version upgrade method of the virtualization system as described in any one of claims 1 to 9 is implemented.
12. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the cross-version upgrade method of the virtualization system as described in any one of claims 1 to 9 is implemented.
