WO2017076180A1 - 虚拟机升级方法及装置 - Google Patents

虚拟机升级方法及装置 Download PDF

Info

Publication number
WO2017076180A1
WO2017076180A1 PCT/CN2016/103094 CN2016103094W WO2017076180A1 WO 2017076180 A1 WO2017076180 A1 WO 2017076180A1 CN 2016103094 W CN2016103094 W CN 2016103094W WO 2017076180 A1 WO2017076180 A1 WO 2017076180A1
Authority
WO
WIPO (PCT)
Prior art keywords
virtual machine
upgraded
disk file
upgrade
template
Prior art date
Application number
PCT/CN2016/103094
Other languages
English (en)
French (fr)
Inventor
缪星星
Original Assignee
中兴通讯股份有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 中兴通讯股份有限公司 filed Critical 中兴通讯股份有限公司
Publication of WO2017076180A1 publication Critical patent/WO2017076180A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/60Software deployment
    • G06F8/65Updates
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/445Program loading or initiating
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45533Hypervisors; Virtual machine monitors

Definitions

  • the embodiments of the present invention relate to the field of communications, and in particular, to a method and an apparatus for upgrading a virtual machine.
  • the one or more virtual machines need to be upgraded in sequence, which causes the virtual machine upgrade process to be cumbersome and wastes a lot of manual time.
  • the embodiment of the invention provides a method and a device for upgrading a virtual machine, so as to solve the problem that at least one virtual machine in the related art needs to perform an upgrade operation on multiple virtual machines in sequence, resulting in low efficiency of virtual machine upgrade.
  • a virtual machine upgrade method including: upgrading a virtual machine template before the upgrade, and obtaining an upgraded virtual machine template, where the The upgraded virtual machine template records the upgraded template disk file; searches for the virtual machine created by the pre-upgrade virtual machine template; and uses the upgraded template disk file to update the disk file in the virtual machine. To get the upgraded virtual machine.
  • the upgrading the virtual machine template before the upgrade, and obtaining the upgraded virtual machine template includes: converting the virtual machine template before the upgrade into a target virtual machine; and performing software upgrade on the target virtual machine to obtain And the upgraded template disk file, wherein the upgraded template disk file records the upgraded data; and the target virtual machine after the software upgrade is performed is converted into the upgraded virtual machine template.
  • the upgraded virtual machine template records the upgraded template disk file.
  • the virtual machine includes one or more virtual machines
  • the updating the disk files in the virtual machine by using the upgraded template disk file includes: deleting the one or more virtual machines a disk file before the upgrade; using the upgraded template disk file to create an upgraded disk file, and setting the upgraded disk file to a disk file in the upgraded virtual machine, wherein the upgrade The upgraded data is recorded in the subsequent disk file.
  • the method further includes: combining the pre-upgrade disk file with a disk file before the last upgrade, where Before the disk file in the virtual machine is updated by using the upgraded template disk file, the disk file in the virtual machine is upgraded from the disk file before the last upgrade to the disk before the upgrade file.
  • the merging the disk file before the upgrade with the disk file before the last upgrade includes: determining whether the disk file before the upgrade is a single reference relationship with the disk file before the previous upgrade; If it is determined that the single reference relationship is, the pre-upgrade disk file is merged with the disk file before the last upgrade.
  • the converting the pre-upgrade virtual machine template into the target virtual machine includes: creating a leaf file in the process of converting the pre-upgrade virtual machine template into the target virtual machine, where the leaf a file as a leaf node associated with a template disk file of the pre-upgrade virtual machine template as a parent node; wherein the converted target virtual machine runs on the leaf On the subfile.
  • a virtual machine upgrade apparatus including: an obtaining module, configured to upgrade a virtual machine template before the upgrade, to obtain an upgraded virtual machine template, where the upgraded virtual machine template is The upgraded template disk file is recorded in the virtual machine template; the search module is set to find the virtual machine created by the pre-upgrade virtual machine template; the update module is set to use the upgraded template disk file update The disk file in the virtual machine is obtained to obtain the upgraded virtual machine.
  • the obtaining module includes: a first converting unit configured to convert the virtual machine template before the upgrade into a target virtual machine; and an upgrading unit configured to perform software upgrade on the target virtual machine to obtain the upgrade a template disk file, wherein the upgraded template disk file records the upgraded data; and the second conversion unit is configured to convert the target virtual machine after the software upgrade is performed to the upgraded The virtual machine template, wherein the upgraded virtual machine template records the upgraded template disk file.
  • the updating module includes: a deleting unit, configured to delete a disk file before the upgrade in the one or more virtual machines when the virtual machine includes one or more virtual machines; and the processing unit is set to And using the upgraded template disk file to create an upgraded disk file, and setting the upgraded disk file to a disk file in the upgraded virtual machine, where the upgraded disk file records The upgraded data.
  • a deleting unit configured to delete a disk file before the upgrade in the one or more virtual machines when the virtual machine includes one or more virtual machines
  • the processing unit is set to And using the upgraded template disk file to create an upgraded disk file, and setting the upgraded disk file to a disk file in the upgraded virtual machine, where the upgraded disk file records The upgraded data.
  • the device further includes: a merging module, configured to: after the disk file in the virtual machine is updated by using the upgraded template disk file, upgrading the pre-upgrade disk file with a previous upgrade The previous disk file is merged, wherein the disk file in the virtual machine is the disk file before the last upgrade before the disk file in the virtual machine is updated by using the upgraded template disk file. Upgrade to the pre-upgrade disk file.
  • a merging module configured to: after the disk file in the virtual machine is updated by using the upgraded template disk file, upgrading the pre-upgrade disk file with a previous upgrade The previous disk file is merged, wherein the disk file in the virtual machine is the disk file before the last upgrade before the disk file in the virtual machine is updated by using the upgraded template disk file. Upgrade to the pre-upgrade disk file.
  • the merging module includes: a determining unit, configured to determine whether the disk file before the upgrade is a single reference relationship with the disk file before the last upgrade; and the merging unit is configured to determine that In the case of a single reference relationship, the pre-upgrade disk file is merged with the disk file before the last upgrade.
  • the first conversion unit is further configured to switch the virtual machine template before the upgrade
  • a leaf file is created, wherein the leaf file is associated as a leaf node to a template disk file of the pre-upgrade virtual machine template as a parent node; wherein the target virtual is converted The machine runs on the leaf file.
  • a computer storage medium is further provided, and the computer storage medium may store an execution instruction for executing the virtual machine upgrade method in the foregoing embodiment.
  • the upgraded virtual machine template is upgraded to obtain the upgraded virtual machine template, wherein the upgraded virtual machine template records the upgraded template disk file; and the virtual machine before the upgrade is searched.
  • the virtual machine created by the template use the upgraded template disk file to update the disk file in the virtual machine to get the upgraded virtual machine.
  • the present invention implements the upgrade of the virtual machine template to implement the upgrade of all the virtual machines in the upgraded virtual machine template without manually upgrading each virtual machine, and solves the related technologies, and multiple virtual machines exist. In this case, multiple virtual machines need to be manually upgraded in sequence, resulting in low efficiency of virtual machine upgrades, thereby improving the efficiency of virtual machine upgrades.
  • FIG. 1 is a flow chart of a virtual machine upgrade according to an embodiment of the present invention
  • FIG. 2 is a structural change diagram of a virtual machine template upgrade according to an embodiment of the present invention.
  • FIG. 3 is a schematic structural diagram of a virtual machine after a batch upgrade according to an embodiment of the present invention.
  • 4a-4d are schematic diagrams showing structural changes of a virtual machine after multiple batch upgrades according to an embodiment of the present invention.
  • FIG. 5 is a flowchart of a batch upgrade of a virtual machine according to an embodiment of the present invention.
  • FIG. 6 is a structural block diagram of a virtual machine upgrade apparatus according to an embodiment of the present invention.
  • FIG. 7 is a structural block diagram (1) of a virtual machine upgrading apparatus according to an embodiment of the present invention.
  • FIG. 8 is a structural block diagram (2) of a virtual machine upgrading apparatus according to an embodiment of the present invention.
  • FIG. 9 is a structural block diagram (3) of a virtual machine upgrading apparatus according to an embodiment of the present invention.
  • FIG. 10 is a structural block diagram (4) of a virtual machine upgrading apparatus according to an embodiment of the present invention.
  • FIG. 1 is a flowchart of a virtual machine upgrade according to an embodiment of the present invention. As shown in FIG. 1 , the process includes the following steps:
  • step S102 the VM template before the upgrade is upgraded, and the upgraded VM template is obtained.
  • the upgraded VM template records the upgraded template disk file.
  • Step S104 searching for a virtual machine created by the virtual machine template before the upgrade
  • Step S106 Update the disk file in the virtual machine by using the upgraded template disk file to obtain the upgraded virtual machine.
  • the foregoing virtual machine upgrade method includes, but is not limited to, performing a virtual machine batch upgrade based on a disk snapshot related to the virtualization management system and a template and a virtual machine template interworking interface.
  • the upgraded virtual machine template is upgraded to obtain the upgraded virtual machine template, wherein the upgraded virtual machine template records the upgraded template disk file; The virtual machine created by the virtual machine template; use the upgraded template disk file to update the disk file in the virtual machine to obtain the upgraded virtual machine.
  • upgrading the virtual machine template by upgrading the virtual machine template, The upgrade of all the virtual machines in the upgraded virtual machine template is implemented without manually upgrading each virtual machine.
  • multiple virtual machines exist multiple virtual machines need to be manually upgraded. The problem of low efficiency of virtual machine upgrade is achieved, and the effect of improving the efficiency of virtual machine upgrade is achieved.
  • the relationship between the virtual machine template and the virtual machine includes, but is not limited to, one virtual machine template corresponding to one virtual machine, and one virtual machine template corresponding to multiple virtual machines.
  • the mapping between the VM template and the VM can be pre-established when the VM is created through the VM template.
  • the updated template disk file is used to update the disk file in the virtual machine to obtain the upgraded virtual machine, including but not limited to: directly replacing the virtual machine with the upgraded template disk file.
  • the disk file in the file that is, the upgraded template disk file is used as the disk file in the virtual machine; or, first, delete the disk file in the virtual machine, and then use the upgraded template disk file to create the virtual machine. Disk file.
  • the virtual machine upgrade interface is developed to implement the function of batch upgrade of the virtual machine.
  • Use the template to switch to the virtual machine interface enter the template virtual machine for software upgrade operation, and then delete the original disk files of all virtual machines under the template, and create a new virtual machine disk file with the new template disk file, so that the newly created disk I already have the software data after the upgrade.
  • the virtual machine is different from the one before the upgrade.
  • the other parameters and the Universal Unique Identifier (UUID) have not changed, so the user can log in to the original virtual after logging in. Go in the machine.
  • the software upgrade of all virtual machines in the template is implemented by using the upgrade of the template disk by using the upgrade method of the virtual machine in the above-mentioned method, thereby avoiding the cumbersome operation of upgrading the virtual machine by one.
  • the upgraded virtual machine template is upgraded, and the upgraded virtual machine template includes the following steps:
  • Step S11 converting the virtual machine template before the upgrade to the target virtual machine
  • Step S12 Perform software upgrade on the target virtual machine to obtain the upgraded template disk file, where the upgraded template disk file records the upgraded data;
  • step S13 the target virtual machine after the software upgrade is converted into the upgraded virtual machine template, wherein the upgraded virtual machine template records the upgraded template disk file.
  • the virtual machine template is not readable and writeable based on the virtual machine template. Therefore, the virtual machine template before the upgrade is first converted into the target virtual machine, and then the target virtual machine is upgraded to obtain the upgrade. The template disk file is finally converted into the upgraded virtual machine template by the upgraded target virtual machine, thereby obtaining the upgraded virtual machine template for recording the upgraded template disk file.
  • the virtual machine template before the upgrade is converted into the target virtual machine, the target virtual machine is upgraded, and then the upgraded target virtual machine is replaced with the upgraded virtual machine template, and the virtual machine template is implemented.
  • the upgrade is performed to further solve the problem that multiple VMs in the related technology need to manually perform upgrade operations on multiple VMs in turn, resulting in low efficiency of VM upgrade.
  • FIG. 2 is a structural change diagram of a virtual machine template upgrade according to an embodiment of the present invention.
  • the process of upgrading a virtual machine template is described below with reference to FIG. 2, wherein the virtual machine disk file takes VM1 to VMn as an example, and the upgraded virtual The Tmp_old disk file is used as an example.
  • the disk file of the VM template before the upgrade is Tmp_old. The main steps are as follows:
  • Step S201 To upgrade the virtual machine software in batches, you need to upgrade the template corresponding to the virtual machine first.
  • the template is first converted to a virtual machine.
  • the virtual machine management center sets the object type in the data structure to 3, that is, the virtual machine type. Then, the empty leaf file is pulled out statically from the disk file of the template, and the new leaf file is used as the disk running file of the new virtual machine;
  • Step S202 Turn on the virtual machine and install the upgrade software into the operating system.
  • Step S203 Convert the upgraded virtual machine into a template, that is, as long as the new virtual machine structure is The object type is set to 4, and there is no change in the disk structure.
  • the converted template disk is shown in the gray node in Figure 2.
  • updating the disk file in the virtual machine using the upgraded template disk file includes the following steps:
  • Step S21 deleting a disk file before the upgrade in one or more virtual machines
  • Step S22 Create an upgraded disk file by using the upgraded template disk file, and set the upgraded disk file to a disk file in the upgraded virtual machine, where the upgraded disk file records the file. Upgraded data.
  • the virtual machine involved in the foregoing steps includes at least one or more virtual machines
  • the disk file involved includes at least one or more disk files.
  • FIG. 3 is a schematic diagram showing structural changes after a virtual machine batch upgrade according to an embodiment of the present invention.
  • the process of upgrading a virtual machine in batches is described below with reference to FIG. 3.
  • the VM file to VM1 is taken as an example.
  • the upgraded VM template disk file is represented by Tmp.
  • the VM template disk file before the upgrade is Take Tmp_old as an example, which mainly includes the following steps:
  • Step S301 After upgrading the template, all virtual machines under the template need to be upgraded.
  • the virtualized management center needs to record the virtual machine created by the template in advance, and then find all the virtual machines under the template after receiving the batch upgrade task of the portal, and then delete the virtual machine disk file;
  • Step S302 Create a virtual machine disk by using the upgraded new template disk file increment, as shown in the structural change diagram shown in FIG.
  • the upgraded disk file is created by using the upgraded template disk file, and the upgraded disk file is set as the disk file in the upgraded virtual machine, wherein the upgraded disk file is recorded.
  • the upgraded data when there are multiple virtual machines, only one upgrade operation, that is, the upgrade of the virtual machine template, and one or more virtual machines under the corresponding virtual machine template directly use the upgraded template disk file as the upgraded template disk file. Disk files of one or more virtual machines, so that each virtual machine records the upgraded data, which achieves the effect of batch upgrade of virtual machines, avoiding the manual upgrade of each virtual machine. Low problems increase the efficiency of virtual machine upgrades.
  • Step S31 the disk file before the upgrade is merged with the disk file before the previous upgrade, wherein the disk file in the virtual machine is used before the disk file in the virtual machine is updated by using the upgraded template disk file.
  • the disk file before the last upgrade is upgraded to the disk file before the upgrade.
  • the first upgrade is to upgrade the data A in the disk file C
  • the second upgrade is to the disk file D.
  • the upgraded data A and the upgraded data B should be merged after the current virtual machine template is upgraded.
  • the disk file before the upgrade is merged with the disk file before the previous upgrade, which improves the efficiency of reading and writing to the disk file.
  • merging the pre-upgrade disk file with the disk file prior to the previous upgrade includes the following steps:
  • Step S41 determining whether the disk file before the upgrade is a single reference relationship with the disk file before the previous upgrade
  • step S42 if the single reference relationship is determined, the disk file before the upgrade is merged with the disk file before the last upgrade.
  • the single reference relationship involved in the above steps may refer to the disk file before the upgrade before the disk file before the upgrade, that is, the reference relationship of the disk file is 1.
  • the disk file before the upgrade is merged with the disk file before the previous upgrade, which further improves the efficiency of reading and writing to the disk file.
  • FIG. 4a-4d are schematic diagrams showing structural changes of a virtual machine after multiple batch upgrades according to an embodiment of the present invention. The following is a detailed description of the virtual machine multiple batch upgrade in combination with FIG. 4a to FIG. 4d.
  • the virtual machine disk file is VM1 to VMn.
  • the upgraded VM template disk file uses Tmp as an example.
  • the VM file disk files before the upgrade are Tmp_old, Tmp_old1, and Tmp_old2. The main steps are as follows:
  • Step S401 Perform a normal upgrade operation according to steps S201 to S203 and steps S301 to S302 described above;
  • Step S402 Detect whether there are two consecutive file reference numbers in the new template disk file. As shown in FIG. 4c, both Tmp_old and Tmp_old1 have only one child node, that is, the reference number is 1, and Tmp_old can be The Tmp_old1 file is merged, and finally Tmp_old2 is obtained, as shown in Figure 4d.
  • converting the pre-upgrade virtual machine template to the target virtual machine includes the following steps:
  • Step S51 In the process of converting the pre-upgrade virtual machine template into the target virtual machine, create a leaf file, where the leaf file is associated as a leaf node to a template disk file of the pre-upgrade virtual machine template as a parent node. .
  • the virtualization management center statically pulls a leaf file on the related template disk file, and the converted virtual file runs on the leaf file.
  • the converted target virtual machine is run on the leaf file, so that the upgraded data running in the leaf file is completely converted into an upgrade during the process of converting the pre-upgrade virtual machine template into the target virtual machine.
  • the data in the subsequent virtual machine template guarantees the integrity of the upgraded data.
  • the virtual machine upgrade mainly includes the following steps:
  • Step S61 the virtual machine template is transferred to the virtual machine: the virtualization management center provides the template to be virtualized.
  • the interface of the machine the interface can convert the virtual machine operation to the selected template.
  • the converted virtual machine can do anything like a normal virtual machine.
  • the virtualization management center statically pulls out a leaf file on the related template disk file, and the converted virtual file runs on the leaf file;
  • step S62 the virtual machine software is upgraded: the virtual machine converted into the virtual machine template is inserted, and the iso installation package required for the upgrade is mounted, and the virtual machine is upgraded.
  • Step S63 Upgrade the virtual machine in batches: find all the virtual machines in the template, delete the disks of the virtual machine, and then use the upgraded virtual machine template file to create new disk files in turn.
  • the newly created disk file thus has the data after the template upgrade, thereby implementing the software upgrade of the virtual machine;
  • Step S64 merging the nodes: After the multiple upgrades according to the above steps S61 to S63, there are many phenomenon that the template nodes are present. At this time, the merged files need to be merged.
  • FIG. 5 is a flowchart of a batch upgrade of a virtual machine according to an embodiment of the present invention, and the specific process is as follows:
  • Step S501 Convert the virtual machine template into a virtual machine
  • Step S502 Perform software upgrade on the virtual machine.
  • Step S503 Convert the upgraded virtual machine into an upgraded virtual machine template.
  • Step S504 Find all virtual machines in the virtual machine template.
  • Step S505 deleting the disk file of the found virtual machine
  • Step S506 Create a new disk file by using the upgraded virtual machine template disk file.
  • Step S507 Merge the virtual machine template disk file.
  • the method according to the above embodiment can be implemented by means of software plus a necessary general hardware platform.
  • hardware can also be used, but in many cases the former is a better implementation.
  • the technical solution of the present invention in essence or the contribution to the related art can be embodied in the form of a software product stored in a storage medium (such as ROM/RAM, disk, CD-ROM).
  • the instructions include a number of instructions for causing a terminal device (which may be a cell phone, computer, server, or network device, etc.) to perform the methods described in various embodiments of the present invention.
  • a virtual machine upgrade device is also provided, which is used to implement the foregoing embodiments and preferred embodiments, and has not been described again.
  • the term "module” may implement a combination of software and/or hardware of a predetermined function.
  • the apparatus described in the following embodiments is preferably implemented in software, hardware, or a combination of software and hardware, is also possible and contemplated.
  • FIG. 6 is a structural block diagram of a virtual machine upgrading apparatus according to an embodiment of the present invention. As shown in FIG. 6, the apparatus includes:
  • the obtaining module 62 is configured to upgrade the virtual machine template before the upgrade, and obtain the upgraded virtual machine template, wherein the upgraded virtual machine template records the upgraded template disk file;
  • a search module 64 configured to find a virtual machine created by the virtual machine template before the upgrade
  • the update module 66 is configured to update the disk file in the virtual machine using the upgraded template disk file to obtain the upgraded virtual machine.
  • the foregoing virtual machine upgrade method includes, but is not limited to, performing a virtual machine batch upgrade based on a disk snapshot related to the virtualization management system and a template and a virtual machine template interworking interface.
  • the upgraded virtual machine template is upgraded to obtain the upgraded virtual machine template, wherein the upgraded virtual machine template records the upgraded template disk file; The virtual machine created by the virtual machine template; use the upgraded template disk file to update the disk file in the virtual machine to get the upgrade The virtual machine.
  • the virtual machine template is upgraded to implement the upgrade of all the virtual machines in the upgraded virtual machine template, without manually upgrading each virtual machine, and the related technology is solved.
  • the relationship between the virtual machine template and the virtual machine includes, but is not limited to, one virtual machine template corresponding to one virtual machine, and one virtual machine template corresponding to multiple virtual machines.
  • the mapping between the VM template and the VM can be pre-established when the VM is created through the VM template.
  • the upgraded template disk file is used to update the disk file in the virtual machine to obtain the upgraded virtual machine, including but not limited to: directly replacing the upgraded template disk file.
  • the disk file in the virtual machine that is, the upgraded template disk file is used as the disk file in the virtual machine in an overwritten manner; or, the disk file in the virtual machine is first deleted, and then the virtualized template disk file is used to create the virtual disk file.
  • the disk file in the machine is directly replaced.
  • the software upgrade of all virtual machines in the template is implemented by using the upgrade of the template disk by using the upgrade method of the virtual machine in the above-mentioned method, thereby avoiding the cumbersome operation of upgrading the virtual machine by one.
  • FIG. 7 is a structural block diagram (1) of a virtual machine upgrading apparatus according to an embodiment of the present invention.
  • the obtaining module 62 includes:
  • the first converting unit 72 is configured to convert the virtual machine template before the upgrade into a target virtual machine
  • the upgrading unit 74 is configured to perform software upgrade on the target virtual machine to obtain the upgraded template disk file, wherein the upgraded template disk file records the upgraded data;
  • the second conversion unit 76 is configured to convert the target virtual machine after the software upgrade to the upgraded virtual machine template, wherein the upgraded virtual machine template records the upgraded template disk file.
  • the virtual machine template is not readable and writeable based on the virtual machine template. Therefore, the virtual machine template before the upgrade is first converted into the target virtual machine, and then the target virtual machine is upgraded to obtain the upgrade. The template disk file is finally converted into the upgraded virtual machine template by the upgraded target virtual machine, thereby obtaining the upgraded virtual machine template for recording the upgraded template disk file.
  • the virtual machine template before the upgrade is converted into the target virtual machine, the target virtual machine is upgraded, and then the upgraded target virtual machine is replaced with the upgraded virtual machine template, and the virtual machine template is implemented.
  • the upgrade is performed to further solve the problem that multiple VMs in the related technology need to manually perform upgrade operations on multiple VMs in turn, resulting in low efficiency of VM upgrade.
  • FIG. 8 is a structural block diagram (2) of a virtual machine upgrading apparatus according to an embodiment of the present invention.
  • the updating module 66 includes:
  • the deleting unit 82 is configured to delete the disk file before the upgrade in the one or more virtual machines when the virtual machine includes one or more virtual machines;
  • the processing unit 84 is configured to create an upgraded disk file by using the upgraded template disk file, and set the upgraded disk file to a disk file in the upgraded virtual machine, wherein the upgraded The upgraded data is recorded in the disk file.
  • the virtual machine involved in the foregoing steps includes at least one or more virtual machines
  • the disk file involved includes at least one or more disk files.
  • the upgraded disk file is created by using the upgraded template disk file, and the upgraded disk file is set as the disk file in the upgraded virtual machine, wherein the upgraded disk file is recorded.
  • the upgraded data when there are multiple virtual machines, only one upgrade operation, that is, the upgrade of the virtual machine template, and one or more virtual machines under the corresponding virtual machine template directly use the upgraded template disk file as the upgraded template disk file. Disk files of one or more virtual machines, so that each virtual machine records the upgraded data, which achieves the effect of batch upgrade of virtual machines, avoiding the problem of low upgrade efficiency caused by manual manual upgrade of each virtual machine. Improve the efficiency of virtual machine upgrades.
  • FIG. 9 is a structural block diagram (3) of a virtual machine upgrading apparatus according to an embodiment of the present invention. As shown in FIG. 9, the apparatus includes: in addition to all the modules shown in FIG.
  • the merging module 92 is configured to merge the disk file before the upgrade with the disk file before the last upgrade after the disk file in the virtual machine is updated by using the upgraded template disk file, where Before the disk file in the virtual machine is updated with the upgraded template disk file, the disk file in the virtual machine is upgraded from the disk file before the last upgrade to the disk file before the upgrade.
  • the first upgrade is to upgrade the data A in the disk file C
  • the second upgrade is to the disk file D.
  • the upgraded data A and the upgraded data B should be merged after the current virtual machine template is upgraded.
  • the disk file before the upgrade is merged with the disk file before the previous upgrade, which improves the efficiency of reading and writing to the disk file.
  • FIG. 10 is a structural block diagram (4) of a virtual machine upgrading apparatus according to an embodiment of the present invention.
  • the merging module 92 includes:
  • the determining unit 102 is configured to determine whether the disk file before the upgrade is a single reference relationship with the disk file before the last upgrade;
  • the merging unit 104 is configured to merge the disk file before the upgrade with the disk file before the last upgrade when it is determined that the single reference relationship is the single reference relationship.
  • the single reference relationship involved in the above steps may refer to the disk file before the upgrade before the disk file before the upgrade, that is, the reference relationship of the disk file is 1.
  • the disk file before the upgrade is merged with the disk file before the previous upgrade, which further improves the efficiency of reading and writing to the disk file.
  • the first converting unit 74 is further configured to: in the process of converting the pre-upgrade virtual machine template into the target virtual machine, create a leaf file, where the leaf file is associated as a leaf node to A template disk file of the pre-upgrade virtual machine template as a parent node; wherein the converted virtual machine is run on the leaf file.
  • the virtualization management center statically pulls a leaf file on the related template disk file, and the converted virtual file runs on the leaf file.
  • the converted target virtual machine is run on the leaf file, so that the upgraded data running in the leaf file is completely converted into an upgrade during the process of converting the pre-upgrade virtual machine template into the target virtual machine.
  • the data in the subsequent virtual machine template guarantees the integrity of the upgraded data.
  • each of the above modules may be implemented by software or hardware.
  • the foregoing may be implemented by, but not limited to, the foregoing modules are all located in the same processor; or, the modules are located in multiple In the processor.
  • Embodiments of the present invention also provide a storage medium.
  • a storage medium may be configured to store program code for performing the following steps:
  • the upgraded VM template is upgraded, and the upgraded VM template is obtained.
  • the upgraded VM template records the upgraded template disk file.
  • the foregoing storage medium may include, but not limited to, a USB flash drive, a Read-Only Memory (ROM), a Random Access Memory (RAM), a mobile hard disk, and a magnetic memory.
  • ROM Read-Only Memory
  • RAM Random Access Memory
  • a mobile hard disk e.g., a hard disk
  • magnetic memory e.g., a hard disk
  • the processor performs the above steps S1, S2, and S3 according to the stored program code in the storage medium.
  • modules or steps of the present invention described above can be implemented by a general-purpose computing device that can be centralized on a single computing device or distributed across a network of multiple computing devices. Alternatively, they may be implemented by program code executable by the computing device such that they may be stored in the storage device by the computing device and, in some cases, may be different from the order herein.
  • the steps shown or described are performed, or they are separately fabricated into individual integrated circuit modules, or a plurality of modules or steps thereof are fabricated as a single integrated circuit module.
  • the invention is not limited to any specific combination of hardware and software.
  • the upgraded virtual machine template is upgraded to obtain the upgraded virtual machine template, wherein the upgraded virtual machine template records the upgraded template disk file; The virtual machine created by the machine template; use the upgraded template disk file to update the disk file in the virtual machine to obtain the upgraded virtual machine.
  • the present invention implements the upgrade of the virtual machine template to implement the upgrade of all the virtual machines in the upgraded virtual machine template without manually upgrading each virtual machine, and solves the related technologies, and multiple virtual machines exist. In this case, multiple virtual machines need to be manually upgraded in sequence, resulting in low efficiency of virtual machine upgrades, thereby improving the efficiency of virtual machine upgrades.

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Security & Cryptography (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

一种虚拟机升级方法及装置。其中,该方法包括:对升级前的虚拟机模板进行升级,得到升级后的虚拟机模板,其中,升级后的虚拟机模板中记录升级后的模板磁盘文件(S102);查找由该升级前的虚拟机模板创建出的虚拟机(S104);使用该升级后的模板磁盘文件更新该虚拟机中的磁盘文件,以得到升级后的该虚拟机(S106)。解决了相关技术中,存在多台虚拟机时,需要手工对多台虚拟机依次执行升级操作,造成虚拟机升级效率低的问题,进而达到了提高虚拟机升级效率的效果。

Description

虚拟机升级方法及装置 技术领域
本发明实施例涉及通信领域,具体而言,涉及一种虚拟机升级方法及装置。
背景技术
在类似学生机房、图书馆查询电脑的场景中,经常需要给所有的虚拟机升级应用软件,最原始的方式是分别进入所有的虚机,依次安装升级软件,这种方式比较保险,但是花费时间很长,非常繁琐。第二种方式,就是通过虚拟机代理,批量安装指定的软件。需要从管理门户上,向所有的虚拟机代理发送指令,最理想的情况下只需要发送一次,就能成功升级所有虚机。但是这种方式最大的弊端就是需要所有的虚拟机都处于正常运行状态,并且要保证所有虚拟机都能安装成功,然而消息发送过程中有可能会因为网络等原因导致虚拟机内部代理无法正常接收到安装指令,另外即便收到消息之后,虚机内部也有可能因为各种原因安装失败。
由此可见,在相关技术中,无论是上述的第一种方式还是第二种方式,均需要对一个或者多个虚拟机依次进行升级操作,造成虚拟机升级过程繁琐,浪费大量的人工时间。
针对相关技术中,存在多台虚拟机时,需要对多台虚拟机依次执行升级操作,造成虚拟机升级效率低的问题,尚未提出有效的解决方案。
发明内容
本发明实施例提供了一种虚拟机升级方法及装置,以至少解决相关技术中存在多台虚拟机时,需要对多台虚拟机依次执行升级操作,造成虚拟机升级效率低的问题。
根据本发明实施例的一个方面,提供了一种虚拟机升级方法,包括:对升级前的虚拟机模板进行升级,得到升级后的虚拟机模板,其中,所述 升级后的虚拟机模板中记录升级后的模板磁盘文件;查找由所述升级前的虚拟机模板创建出的虚拟机;使用所述升级后的模板磁盘文件更新所述虚拟机中的磁盘文件,以得到升级后的所述虚拟机。
可选地,所述对升级前的虚拟机模板进行升级,得到升级后的虚拟机模板包括:将升级前的所述虚拟机模板转换为目标虚拟机;对目标虚拟机进行软件升级,以得到所述升级后的模板磁盘文件,其中,所述升级后的模板磁盘文件中记录了升级后的数据;将进行完所述软件升级之后的目标虚拟机转换为所述升级后的虚拟机模板,其中,所述升级后的虚拟机模板中记录升级后的模板磁盘文件。
可选地,所述虚拟机包括一个或者多个虚拟机,其中,所述使用所述升级后的模板磁盘文件更新所述虚拟机中的磁盘文件包括:删除所述一个或者多个虚拟机中升级前的磁盘文件;使用所述升级后的模板磁盘文件创建升级后的磁盘文件,并将所述升级后的磁盘文件设置为所述升级后的虚拟机中的磁盘文件,其中,所述升级后的磁盘文件中记录了所述升级后的数据。
可选地,所述在使用所述升级后的模板磁盘文件更新所述虚拟机中的磁盘文件之后,还包括:将所述升级前的磁盘文件与上一次升级前的磁盘文件进行合并,其中,在所述使用所述升级后的模板磁盘文件更新所述虚拟机中的磁盘文件之前,所述虚拟机中的磁盘文件由所述上一次升级前的磁盘文件升级到所述升级前的磁盘文件。
可选地,所述将所述升级前的磁盘文件与上一次升级前的磁盘文件进行合并包括:判断所述升级前的磁盘文件与上一次升级前的磁盘文件之间是否为单一引用关系;若判断出为所述单一引用关系,则将所述升级前的磁盘文件与上一次升级前的磁盘文件进行合并。
可选地,所述将所述升级前的虚拟机模板转换为目标虚拟机包括:在将所述升级前的虚拟机模板转换为目标虚拟机的过程中,创建叶子文件,其中,所述叶子文件作为叶子节点关联到作为父节点的所述升级前的虚拟机模板的模板磁盘文件;其中,转换得到的所述目标虚拟机运行在所述叶 子文件上。
根据本发明实施例的另一方面,提供了一种虚拟机升级装置,包括:获取模块,设置为对升级前的虚拟机模板进行升级,得到升级后的虚拟机模板,其中,所述升级后的虚拟机模板中记录升级后的模板磁盘文件;查找模块,设置为查找由所述升级前的虚拟机模板创建出的虚拟机;更新模块,设置为使用所述升级后的模板磁盘文件更新所述虚拟机中的磁盘文件,以得到升级后的所述虚拟机。
可选地,所述获取模块包括:第一转换单元,设置为将升级前的所述虚拟机模板转换为目标虚拟机;升级单元,设置为对目标虚拟机进行软件升级,以得到所述升级后的模板磁盘文件,其中,所述升级后的模板磁盘文件中记录了升级后的数据;第二转换单元,设置为将进行完所述软件升级之后的目标虚拟机转换为所述升级后的虚拟机模板,其中,所述升级后的虚拟机模板中记录升级后的模板磁盘文件。
可选地,所述更新模块包括:删除单元,设置为在所述虚拟机包括一个或者多个虚拟机时,删除所述一个或者多个虚拟机中升级前的磁盘文件;处理单元,设置为使用所述升级后的模板磁盘文件创建升级后的磁盘文件,并将所述升级后的磁盘文件设置为所述升级后的虚拟机中的磁盘文件,其中,所述升级后的磁盘文件中记录了所述升级后的数据。
可选地,所述装置还包括:合并模块,设置为在所述使用所述升级后的模板磁盘文件更新所述虚拟机中的磁盘文件之后,将所述升级前的磁盘文件与上一次升级前的磁盘文件进行合并,其中,在所述使用所述升级后的模板磁盘文件更新所述虚拟机中的磁盘文件之前,所述虚拟机中的磁盘文件由所述上一次升级前的磁盘文件升级到所述升级前的磁盘文件。
可选地,所述合并模块包括:判断单元,设置为判断所述升级前的磁盘文件与上一次升级前的磁盘文件之间是否为单一引用关系;合并单元,设置为在判断出为所述单一引用关系时,将所述升级前的磁盘文件与上一次升级前的磁盘文件进行合并。
可选地,所述第一转换单元还设置为在将所述升级前的虚拟机模板转 换为目标虚拟机的过程中,创建叶子文件,其中,所述叶子文件作为叶子节点关联到作为父节点的所述升级前的虚拟机模板的模板磁盘文件;其中,转换得到的所述目标虚拟机运行在所述叶子文件上。
在本发明实施例中,还提供了一种计算机存储介质,该计算机存储介质可以存储有执行指令,该执行指令用于执行上述实施例中的虚拟机升级方法。
通过本发明实施例,采用对升级前的虚拟机模板进行升级,得到升级后的虚拟机模板,其中,升级后的虚拟机模板中记录升级后的模板磁盘文件;查找由该升级前的虚拟机模板创建出的虚拟机;使用该升级后的模板磁盘文件更新该虚拟机中的磁盘文件,以得到升级后的该虚拟机。换言之,本发明通过对虚拟机模板进行升级,进而实现该升级后的虚拟机模板下的所有虚拟机的升级,而无需手工升级每一台虚拟机,解决了相关技术中,存在多台虚拟机时,需要手工对多台虚拟机依次执行升级操作,造成虚拟机升级效率低的问题,进而达到了提高虚拟机升级效率的效果。
附图说明
此处所说明的附图用来提供对本发明的进一步理解,构成本申请的一部分,本发明的示意性实施例及其说明用于解释本发明,并不构成对本发明的不当限定。在附图中:
图1是根据本发明实施例的虚拟机升级的流程图;
图2是根据本发明实施例的虚拟机模板升级的结构变化图;
图3是根据本发明实施例的虚拟机批量升级之后的结构变化示意图;
图4a~4d是根据本发明实施例的虚拟机多次批量升级之后的结构变化示意图;
图5是根据本发明实施例中的虚拟机批量升级流程图;
图6是根据本发明实施例的虚拟机升级装置的结构框图;
图7是根据本发明实施例的虚拟机升级装置的结构框图(一);
图8是根据本发明实施例的虚拟机升级装置的结构框图(二);
图9是根据本发明实施例的虚拟机升级装置的结构框图(三);
图10是根据本发明实施例的虚拟机升级装置的结构框图(四)。
具体实施方式
下文中将参考附图并结合实施例来详细说明本发明。需要说明的是,在不冲突的情况下,本申请中的实施例及实施例中的特征可以相互组合。
需要说明的是,本发明的说明书和权利要求书及上述附图中的术语“第一”、“第二”等是用于区别类似的对象,而不必用于描述特定的顺序或先后次序。
实施例1
在本实施例中提供了一种虚拟机升级方法,图1是根据本发明实施例的虚拟机升级的流程图,如图1所示,该流程包括如下步骤:
步骤S102,对升级前的虚拟机模板进行升级,得到升级后的虚拟机模板,其中,升级后的虚拟机模板中记录升级后的模板磁盘文件;
步骤S104,查找由该升级前的虚拟机模板创建出的虚拟机;
步骤S106,使用该升级后的模板磁盘文件更新该虚拟机中的磁盘文件,以得到升级后的该虚拟机。
可选的,在本实施例中,上述虚拟机升级方法包括但并不限于基于虚拟化管理系统相关的磁盘快照及模板与虚拟机模板互转接口的基础上,实现虚拟机批量升级。其中,在上述应用环境中,采用对升级前的虚拟机模板进行升级,得到升级后的虚拟机模板,其中,升级后的虚拟机模板中记录升级后的模板磁盘文件;查找由该升级前的虚拟机模板创建出的虚拟机;使用该升级后的模板磁盘文件更新该虚拟机中的磁盘文件,以得到升级后的该虚拟机。换言之,在本实施例中,通过对虚拟机模板进行升级,进而 实现该升级后的虚拟机模板下的所有虚拟机的升级,而无需手工升级每一台虚拟机,解决了相关技术中,存在多台虚拟机时,需要手工对多台虚拟机依次执行升级操作,造成虚拟机升级效率低的问题,进而达到了提高虚拟机升级效率的效果。
可选地,在本实施例中,虚拟机模板和虚拟机之间的关系包括但并不限于:一个虚拟机模板对应一台虚拟机、一个虚拟机模板对应多台虚拟机。其中,虚拟机模板和虚拟机之间的对应关系,可以在通过虚拟机模板创建虚拟机时预先建立。
可选地,在本实施例中,使用升级后的模板磁盘文件更新虚拟机中的磁盘文件,以得到升级后的虚拟机包括但并不限于:使用升级后的模板磁盘文件直接替换该虚拟机中的磁盘文件,即以覆盖的方式将升级后的模板磁盘文件作为虚拟机中的磁盘文件;或者,首先将虚拟机中的磁盘文件删除,然后使用升级后的模板磁盘文件创建虚拟机中的磁盘文件。
下面结合具体示例,对本实施例作举例说明。
本发明实施例是在虚拟化管理系统相关的磁盘快照及模板与虚拟机互转接口的基础上,开发新的虚拟机升级接口,来实现虚拟机批量升级的功能。利用模板转虚拟机接口,进入模板虚拟机进行软件升级操作,然后删除原有的该模板下所有虚拟机的磁盘文件,利用新的模板磁盘文件创建新的虚拟机磁盘文件,这样新创建的磁盘中已经拥有了升级之后的软件数据了。升级之后的虚拟机,只是磁盘跟升级前不一样,其他的各个参数及虚拟机通用唯一识别码(Universally Unique Identifier,简称为UUID)并没有改变,所以用户登录之后还是能登录到原有的虚拟机中去。
通过上述方法基于模板升级的虚拟机批量升级方法,利用对模板磁盘的升级,实现模板下所有虚拟机的软件升级,从而避免了手工一台台升级虚拟机的繁琐操作。
在一个可选的实施方式中,对升级前的虚拟机模板进行升级,得到升级后的虚拟机模板包括以下步骤:
步骤S11,将升级前的该虚拟机模板转换为目标虚拟机;
步骤S12,对目标虚拟机进行软件升级,以得到该升级后的模板磁盘文件,其中,该升级后的模板磁盘文件中记录了升级后的数据;
步骤S13,将进行完该软件升级之后的目标虚拟机转换为该升级后的虚拟机模板,其中,该升级后的虚拟机模板中记录升级后的模板磁盘文件。
可选地,在本实施例中,基于虚拟机模板静态不可进行读写操作,所以首先将升级前的虚拟机模板转换为目标虚拟机,然后对目标虚拟机进行软件升级,以得到该升级后的模板磁盘文件,最后再将升级后的目标虚拟机转换为该升级后的虚拟机模板,进而获得记录升级后的模板磁盘文件的升级后的虚拟机模板。
通过上述步骤,将升级前的虚拟机模板转换为目标虚拟机,对目标虚拟机进行升级操作,然后再将升级后的目标虚拟机装换为升级后的虚拟机模板,实现了对虚拟机模板进行升级,进一步解决了相关技术中存在多台虚拟机时,需要手工对多台虚拟机依次执行升级操作,造成虚拟机升级效率低的问题。
下面结合具体示例,对上述步骤S11至步骤S13进行举例说明。
图2是根据本发明实施例的虚拟机模板升级的结构变化图,下面结合图2对虚拟机模板升级的过程进行说明,其中,虚拟机的磁盘文件以VM1至VMn为例,升级后的虚拟机模板磁盘文件以Tmp为例,升级前的虚拟机模板磁盘文件以Tmp_old为例,主要包括以下步骤:
步骤S201:批量升级虚拟机软件,需要先将虚拟机对应的模板进行升级。首先将模板转为虚拟机,虚拟机管理中心接收到模板转虚拟机任务之后,将数据结构中的对象类型置为3,即虚拟机类型。然后从模板的磁盘文件中静态方式拉出空的叶子文件,将新的叶子文件作为新虚拟机的磁盘运行文件;
步骤S202:开启虚拟机进操作系统内部安装升级软件;
步骤S203:将升级后的虚拟机转成模板,即只要将新虚拟机结构中 的对象类型设置为4即可,磁盘结构没有任何变化。转换之后的模板磁盘如图2中灰色的节点所示。
在一个可选的实施方式中,使用该升级后的模板磁盘文件更新该虚拟机中的磁盘文件包括以下步骤:
步骤S21,删除一个或者多个虚拟机中升级前的磁盘文件;
步骤S22,使用升级后的模板磁盘文件创建升级后的磁盘文件,并将该升级后的磁盘文件设置为该升级后的虚拟机中的磁盘文件,其中,该升级后的磁盘文件中记录了该升级后的数据。
需要说明的是,上述步骤中涉及的虚拟机至少包括一个或者多个虚拟机,涉及到的磁盘文件至少包括一个或者多个磁盘文件。
下面结合具体示例,对上述步骤S21至步骤S22进行举例说明。
图3是根据本发明实施例的虚拟机批量升级之后的结构变化示意图。下面结合图3对虚拟机批量升级的过程进行说明,其中,虚拟机的磁盘文件以VM1至VMn为例,升级后的虚拟机模板磁盘文件以Tmp为例,升级前的虚拟机模板磁盘文件以Tmp_old为例,主要包括以下步骤:
步骤S301:升级完模板之后需要对模板下的所有虚拟机进行升级。虚拟化管理中心需要事先记录由该模板创建的虚拟机,在接收到门户的批量升级任务之后查找模板下的所有虚拟机,接着删除虚拟机的磁盘文件;
步骤S302:利用升级后的新的模板磁盘文件增量创建虚拟机的磁盘,如图3所示的结构变化图。
通过上述步骤,使用升级后的模板磁盘文件创建升级后的磁盘文件,并将该升级后的磁盘文件设置为该升级后的虚拟机中的磁盘文件,其中,该升级后的磁盘文件中记录了该升级后的数据,使得存在多台虚拟机时,仅进行了一次升级操作,即虚拟机模板的升级,而对应虚拟机模板下的一个或者多个虚拟机直接用升级后的模板磁盘文件作为一个或者多个虚拟机的磁盘文件,使得每台虚拟机都记录了升级后的数据,达到虚拟机批量升级的效果,避免了人工手动对每一台虚拟机进行升级操作造成升级效率 低的问题,提高了虚拟机升级的效率。
在一个可选地实施方式中,在使用该升级后的模板磁盘文件更新该虚拟机中的磁盘文件之后还包括以下步骤:
步骤S31,将升级前的磁盘文件与上一次升级前的磁盘文件进行合并,其中,在使用该升级后的模板磁盘文件更新该虚拟机中的磁盘文件之前,该虚拟机中的磁盘文件由该上一次升级前的磁盘文件升级到该升级前的磁盘文件。
例如,假设,在当前的虚拟机模板升级前,已经进行了2次升级,而且第一次升级时,是对磁盘文件C中的数据A进行升级,第二次升级时,是对磁盘文件D中的数据B进行升级,那么在对当前的虚拟机模板进行升级后,应该将包含升级后的数据A和升级后的数据B进行合并。
通过上述步骤,将升级前的磁盘文件与上一次升级前的磁盘文件进行合并,提高了对磁盘文件中的读写效率。
在一个可选地实施方式中,将该升级前的磁盘文件与上一次升级前的磁盘文件进行合并包括以下步骤:
步骤S41,判断该升级前的磁盘文件与上一次升级前的磁盘文件之间是否为单一引用关系;
步骤S42,若判断出为该单一引用关系,则将该升级前的磁盘文件与上一次升级前的磁盘文件进行合并。
需要说明的是,上述步骤中涉及到的单一引用关系可以为升级前的磁盘文件引用上一次升级前的磁盘文件,即磁盘文件的引用关系为1。
通过上述步骤,将升级前的磁盘文件与上一次升级前的磁盘文件进行合并,进一步提高了对磁盘文件中的读写效率。
下面结合具体示例,对上述步骤S41至步骤S42进行举例说明。
图4a~4d是根据本发明实施例的虚拟机多次批量升级之后的结构变化示意图。下面具体结合图4a~4d对虚拟机多次批量升级进行详细说明,其 中,虚拟机的磁盘文件以VM1至VMn为例,升级后的虚拟机模板磁盘文件以Tmp为例,升级前的虚拟机模板磁盘文件以Tmp_old、Tmp_old1、Tmp_old2为例,其中主要包括以下步骤:
步骤S401:按照上述步骤S201至S203以及步骤S301至S302,做普通升级操作;
步骤S402:检测新的模板磁盘文件中,是否有两个连续的文件引用数为1,如图4c所示,Tmp_old和Tmp_old1都只有一个子节点,即引用数为1,此时可以将Tmp_old和Tmp_old1文件进行合并操作,最终得到Tmp_old2,如图4d所示。
在一个可选地实施方式中,将该升级前的虚拟机模板转换为目标虚拟机包括以下步骤:
步骤S51,在将该升级前的虚拟机模板转换为目标虚拟机的过程中,创建叶子文件,其中,该叶子文件作为叶子节点关联到作为父节点的该升级前的虚拟机模板的模板磁盘文件。
需要说明的是,转换得到的目标虚拟机运行在该叶子文件上。
例如,在虚拟机模板转虚拟机的过程中,虚拟化管理中心会对相关的模板磁盘文件静态拉出一个叶子文件,转换后的虚拟就运行在该叶子文件上。
通过上述步骤,将转换得到的目标虚拟机运行在叶子文件上,使得在将升级前的虚拟机模板转换为目标虚拟机的过程中,将叶子文件中运行的升级后的数据完整的转换为升级后的虚拟机模板中的数据,保证了升级后的数据的完整性。
下面结合可选实施例,对本实施例进行举例说明。
可选实施例一
在本实施例中,虚拟机升级的主要包括以下步骤:
步骤S61,虚拟机模板转虚拟机:虚拟化管理中心提供模板转为虚拟 机的接口,界面可以对选中的模板进行转换虚拟机操作。转换后得到的虚拟机可以像普通的虚拟机一样做任何操作。转换过程中,虚拟化管理中心会对相关的模板磁盘文件静态拉出一个叶子文件,转换后的虚拟就运行在该叶子文件上;
步骤S62,虚拟机软件升级:进入虚拟机模板转换后的虚拟机,挂载升级所需的iso安装包,对虚拟机进行升级操作;
步骤S63,批量升级虚拟机:找到该模板下的所有虚拟机,删除虚拟机的磁盘,然后利用升级后的虚拟机模板文件再依次创建新的磁盘文件。这样创建后的新磁盘文件就有了模板升级之后的数据,从而实现了对虚拟机的软件升级;
步骤S64,合并节点:按照以上步骤S61至步骤S63多次升级之后会出现模板节点有很多个的现象,这时候需要对可以合并的文件进行合并操作。
可选实施例二
可选地,在本实施例中主要结合图5对虚拟机升级方法进行详细说明。图5是根据本发明实施例中的虚拟机批量升级流程图,具体流程如下:
步骤S501:将虚拟机模板转为虚拟机;
步骤S502:对虚拟机进行软件升级;
步骤S503:将升级后的虚拟机转为升级后的虚拟机模板;
步骤S504:查找虚拟机模板下所有的虚拟机;
步骤S505:删除找出的虚拟机的磁盘文件;
步骤S506:利用升级后的虚拟机模板磁盘文件创建新的磁盘文件;
步骤S507:合并虚拟机模板磁盘文件。
通过以上的实施方式的描述,本领域的技术人员可以清楚地了解到根据上述实施例的方法可借助软件加必需的通用硬件平台的方式来实现,当 然也可以通过硬件,但很多情况下前者是更佳的实施方式。基于这样的理解,本发明的技术方案本质上或者说对相关技术做出贡献的部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质(如ROM/RAM、磁碟、光盘)中,包括若干指令用以使得一台终端设备(可以是手机,计算机,服务器,或者网络设备等)执行本发明各个实施例所述的方法。
实施例2
在本实施例中还提供了一种虚拟机升级装置,该装置用于实现上述实施例及优选实施方式,已经进行过说明的不再赘述。如以下所使用的,术语“模块”可以实现预定功能的软件和/或硬件的组合。尽管以下实施例所描述的装置较佳地以软件来实现,但是硬件,或者软件和硬件的组合的实现也是可能并被构想的。
图6是根据本发明实施例的虚拟机升级装置的结构框图,如图6所示,该装置包括:
1)获取模块62,设置为对升级前的虚拟机模板进行升级,得到升级后的虚拟机模板,其中,该升级后的虚拟机模板中记录升级后的模板磁盘文件;
2)查找模块64,设置为查找由该升级前的虚拟机模板创建出的虚拟机;
3)更新模块66,设置为使用该升级后的模板磁盘文件更新该虚拟机中的磁盘文件,以得到升级后的该虚拟机。
可选的,在本实施例中,上述虚拟机升级方法包括但并不限于基于虚拟化管理系统相关的磁盘快照及模板与虚拟机模板互转接口的基础上,实现虚拟机批量升级。其中,在上述应用环境中,采用对升级前的虚拟机模板进行升级,得到升级后的虚拟机模板,其中,升级后的虚拟机模板中记录升级后的模板磁盘文件;查找由该升级前的虚拟机模板创建出的虚拟机;使用该升级后的模板磁盘文件更新该虚拟机中的磁盘文件,以得到升级后 的该虚拟机。换言之,在本实施例中,通过对虚拟机模板进行升级,进而实现该升级后的虚拟机模板下的所有虚拟机的升级,而无需手工升级每一台虚拟机,解决了相关技术中,存在多台虚拟机时,需要手工对多台虚拟机依次执行升级操作,造成虚拟机升级效率低的问题,进而达到了提高虚拟机升级效率的效果。
可选地,在本实施例中,虚拟机模板和虚拟机之间的关系包括但并不限于:一个虚拟机模板对应一台虚拟机、一个虚拟机模板对应多台虚拟机。其中,虚拟机模板和虚拟机之间的对应关系,可以在通过虚拟机模板创建虚拟机时预先建立。
可选地,在本实施例中,使用该升级后的模板磁盘文件更新该虚拟机中的磁盘文件,以得到升级后的该虚拟机包括但并不限于:使用升级后的模板磁盘文件直接替换该虚拟机中的磁盘文件,即以覆盖的方式将升级后的模板磁盘文件作为虚拟机中的磁盘文件;或者,首先将虚拟机中的磁盘文件删除,然后使用升级后的模板磁盘文件创建虚拟机中的磁盘文件。
通过上述方法基于模板升级的虚拟机批量升级方法,利用对模板磁盘的升级,实现模板下所有虚拟机的软件升级,从而避免了手工一台台升级虚拟机的繁琐操作。
图7是根据本发明实施例的虚拟机升级装置的结构框图(一),如图7所示,该获取模块62包括:
1)第一转换单元72,设置为将升级前的该虚拟机模板转换为目标虚拟机;
2)升级单元74,设置为对目标虚拟机进行软件升级,以得到该升级后的模板磁盘文件,其中,该升级后的模板磁盘文件中记录了升级后的数据;
3)第二转换单元76,设置为将进行完该软件升级之后的目标虚拟机转换为该升级后的虚拟机模板,其中,该升级后的虚拟机模板中记录升级后的模板磁盘文件。
可选地,在本实施例中,基于虚拟机模板静态不可进行读写操作,所以首先将升级前的虚拟机模板转换为目标虚拟机,然后对目标虚拟机进行软件升级,以得到该升级后的模板磁盘文件,最后再将升级后的目标虚拟机转换为该升级后的虚拟机模板,进而获得记录升级后的模板磁盘文件的升级后的虚拟机模板。
通过上述步骤,将升级前的虚拟机模板转换为目标虚拟机,对目标虚拟机进行升级操作,然后再将升级后的目标虚拟机装换为升级后的虚拟机模板,实现了对虚拟机模板进行升级,进一步解决了相关技术中存在多台虚拟机时,需要手工对多台虚拟机依次执行升级操作,造成虚拟机升级效率低的问题。
图8是根据本发明实施例的虚拟机升级装置的结构框图(二),如图8所示,更新模块66包括:
1)删除单元82,设置为在该虚拟机包括一个或者多个虚拟机时,删除该一个或者多个虚拟机中升级前的磁盘文件;
2)处理单元84,设置为使用该升级后的模板磁盘文件创建升级后的磁盘文件,并将该升级后的磁盘文件设置为该升级后的虚拟机中的磁盘文件,其中,该升级后的磁盘文件中记录了该升级后的数据。
需要说明的是,上述步骤中涉及的虚拟机至少包括一个或者多个虚拟机,涉及到的磁盘文件至少包括一个或者多个磁盘文件。
通过上述步骤,使用升级后的模板磁盘文件创建升级后的磁盘文件,并将该升级后的磁盘文件设置为该升级后的虚拟机中的磁盘文件,其中,该升级后的磁盘文件中记录了该升级后的数据,使得存在多台虚拟机时,仅进行了一次升级操作,即虚拟机模板的升级,而对应虚拟机模板下的一个或者多个虚拟机直接用升级后的模板磁盘文件作为一个或者多个虚拟机的磁盘文件,使得每台虚拟机都记录了升级后的数据,达到虚拟机批量升级的效果,避免了人工手动对每一台虚拟机进行升级操作造成升级效率低的问题,提高了虚拟机升级的效率。
图9是根据本发明实施例的虚拟机升级装置的结构框图(三),如图9所示,该装置除了包括图6所示的所有模块外还包括:
1)合并模块92,设置为在该使用该升级后的模板磁盘文件更新该虚拟机中的磁盘文件之后,将该升级前的磁盘文件与上一次升级前的磁盘文件进行合并,其中,在该使用该升级后的模板磁盘文件更新该虚拟机中的磁盘文件之前,该虚拟机中的磁盘文件由该上一次升级前的磁盘文件升级到该升级前的磁盘文件。
例如,假设,在当前的虚拟机模板升级前,已经进行了2次升级,而且第一次升级时,是对磁盘文件C中的数据A进行升级,第二次升级时,是对磁盘文件D中的数据B进行升级,那么在对当前的虚拟机模板进行升级后,应该将包含升级后的数据A和升级后的数据B进行合并。
通过上述步骤,将升级前的磁盘文件与上一次升级前的磁盘文件进行合并,提高了对磁盘文件中的读写效率。
图10是根据本发明实施例的虚拟机升级装置的结构框图(四),如图10所示,合并模块92包括:
1)判断单元102,设置为判断该升级前的磁盘文件与上一次升级前的磁盘文件之间是否为单一引用关系;
2)合并单元104,设置为在判断出为该单一引用关系时,将该升级前的磁盘文件与上一次升级前的磁盘文件进行合并。
需要说明的是,上述步骤中涉及到的单一引用关系可以为升级前的磁盘文件引用上一次升级前的磁盘文件,即磁盘文件的引用关系为1。
通过上述步骤,将升级前的磁盘文件与上一次升级前的磁盘文件进行合并,进一步提高了对磁盘文件中的读写效率。
可选地,在本实施例中,第一转换单元74还设置为在将该升级前的虚拟机模板转换为目标虚拟机的过程中,创建叶子文件,其中,该叶子文件作为叶子节点关联到作为父节点的该升级前的虚拟机模板的模板磁盘文件;其中,转换得到的该目标虚拟机运行在该叶子文件上。
例如,在虚拟机模板转虚拟机的过程中,虚拟化管理中心会对相关的模板磁盘文件静态拉出一个叶子文件,转换后的虚拟就运行在该叶子文件上。
通过上述步骤,将转换得到的目标虚拟机运行在叶子文件上,使得在将升级前的虚拟机模板转换为目标虚拟机的过程中,将叶子文件中运行的升级后的数据完整的转换为升级后的虚拟机模板中的数据,保证了升级后的数据的完整性。
需要说明的是,上述各个模块是可以通过软件或硬件来实现的,对于后者,可以通过以下方式实现,但不限于此:上述模块均位于同一处理器中;或者,上述模块分别位于多个处理器中。
实施例3
本发明的实施例还提供了一种存储介质。该实施例中的场景及示例可以参考上述实施例1和实施例2,在此,不赘述。可选地,在本实施例中,上述存储介质可以被设置为存储用于执行以下步骤的程序代码:
S1,对升级前的虚拟机模板进行升级,得到升级后的虚拟机模板,其中,升级后的虚拟机模板中记录升级后的模板磁盘文件;
S2,查找由该升级前的虚拟机模板创建出的虚拟机;
S3,使用该升级后的模板磁盘文件更新该虚拟机中的磁盘文件,以得到升级后的该虚拟机。
可选地,在本实施例中,上述存储介质可以包括但不限于:U盘、只读存储器(ROM,Read-Only Memory)、随机存取存储器(RAM,Random Access Memory)、移动硬盘、磁碟或者光盘等各种可以存储程序代码的介质。
可选地,在本实施例中,处理器根据存储介质中已存储的程序代码执行上述步骤S1、S2以及S3。
可选地,本实施例中的具体示例可以参考上述实施例及可选实施方式 中所描述的示例,本实施例在此不再赘述。
显然,本领域的技术人员应该明白,上述的本发明的各模块或各步骤可以用通用的计算装置来实现,它们可以集中在单个的计算装置上,或者分布在多个计算装置所组成的网络上,可选地,它们可以用计算装置可执行的程序代码来实现,从而,可以将它们存储在存储装置中由计算装置来执行,并且在某些情况下,可以以不同于此处的顺序执行所示出或描述的步骤,或者将它们分别制作成各个集成电路模块,或者将它们中的多个模块或步骤制作成单个集成电路模块来实现。这样,本发明不限制于任何特定的硬件和软件结合。
以上所述仅为本发明的优选实施例而已,并不用于限制本发明,对于本领域的技术人员来说,本发明可以有各种更改和变化。凡在本发明的精神和原则之内,所作的任何修改、等同替换、改进等,均应包含在本发明的保护范围之内。
工业实用性
在本发明实施例中,采用对升级前的虚拟机模板进行升级,得到升级后的虚拟机模板,其中,升级后的虚拟机模板中记录升级后的模板磁盘文件;查找由该升级前的虚拟机模板创建出的虚拟机;使用该升级后的模板磁盘文件更新该虚拟机中的磁盘文件,以得到升级后的该虚拟机。换言之,本发明通过对虚拟机模板进行升级,进而实现该升级后的虚拟机模板下的所有虚拟机的升级,而无需手工升级每一台虚拟机,解决了相关技术中,存在多台虚拟机时,需要手工对多台虚拟机依次执行升级操作,造成虚拟机升级效率低的问题,进而达到了提高虚拟机升级效率的效果。

Claims (12)

  1. 一种虚拟机升级方法,包括:
    对升级前的虚拟机模板进行升级,得到升级后的虚拟机模板,其中,所述升级后的虚拟机模板中记录升级后的模板磁盘文件;
    查找由所述升级前的虚拟机模板创建出的虚拟机;
    使用所述升级后的模板磁盘文件更新所述虚拟机中的磁盘文件,以得到升级后的所述虚拟机。
  2. 根据权利要求1所述的方法,其中,所述对升级前的虚拟机模板进行升级,得到升级后的虚拟机模板包括:
    将升级前的所述虚拟机模板转换为目标虚拟机;
    对目标虚拟机进行软件升级,以得到所述升级后的模板磁盘文件,其中,所述升级后的模板磁盘文件中记录了升级后的数据;
    将进行完所述软件升级之后的目标虚拟机转换为所述升级后的虚拟机模板,其中,所述升级后的虚拟机模板中记录升级后的模板磁盘文件。
  3. 根据权利要求2所述的方法,其中,所述虚拟机包括一个或者多个虚拟机,其中,所述使用所述升级后的模板磁盘文件更新所述虚拟机中的磁盘文件包括:
    删除所述一个或者多个虚拟机中升级前的磁盘文件;
    使用所述升级后的模板磁盘文件创建升级后的磁盘文件,并将所述升级后的磁盘文件设置为所述升级后的虚拟机中的磁盘文件,其中,所述升级后的磁盘文件中记录了所述升级后的数据。
  4. 根据权利要求1所述的方法,其中,所述在使用所述升级后 的模板磁盘文件更新所述虚拟机中的磁盘文件之后,还包括:
    将所述升级前的磁盘文件与上一次升级前的磁盘文件进行合并,其中,在所述使用所述升级后的模板磁盘文件更新所述虚拟机中的磁盘文件之前,所述虚拟机中的磁盘文件由所述上一次升级前的磁盘文件升级到所述升级前的磁盘文件。
  5. 根据权利要求4所述的方法,其中,所述将所述升级前的磁盘文件与上一次升级前的磁盘文件进行合并包括:
    判断所述升级前的磁盘文件与上一次升级前的磁盘文件之间是否为单一引用关系;
    若判断出为所述单一引用关系,则将所述升级前的磁盘文件与上一次升级前的磁盘文件进行合并。
  6. 根据权利要求2所述的方法,其中,所述将所述升级前的虚拟机模板转换为目标虚拟机包括:
    在将所述升级前的虚拟机模板转换为目标虚拟机的过程中,创建叶子文件,其中,所述叶子文件作为叶子节点关联到作为父节点的所述升级前的虚拟机模板的模板磁盘文件;
    其中,转换得到的所述目标虚拟机运行在所述叶子文件上。
  7. 一种虚拟机升级装置,包括:
    获取模块,设置为对升级前的虚拟机模板进行升级,得到升级后的虚拟机模板,其中,所述升级后的虚拟机模板中记录升级后的模板磁盘文件;
    查找模块,设置为查找由所述升级前的虚拟机模板创建出的虚拟机;
    更新模块,设置为使用所述升级后的模板磁盘文件更新所述虚拟机中的磁盘文件,以得到升级后的所述虚拟机。
  8. 根据权利要求7所述的装置,其中,所述获取模块包括:
    第一转换单元,设置为将升级前的所述虚拟机模板转换为目标虚拟机;
    升级单元,设置为对目标虚拟机进行软件升级,以得到所述升级后的模板磁盘文件,其中,所述升级后的模板磁盘文件中记录了升级后的数据;
    第二转换单元,设置为将进行完所述软件升级之后的目标虚拟机转换为所述升级后的虚拟机模板,其中,所述升级后的虚拟机模板中记录升级后的模板磁盘文件。
  9. 根据权利要求8所述的装置,其中,所述更新模块包括:
    删除单元,设置为在所述虚拟机包括一个或者多个虚拟机时,删除所述一个或者多个虚拟机中升级前的磁盘文件;
    处理单元,设置为使用所述升级后的模板磁盘文件创建升级后的磁盘文件,并将所述升级后的磁盘文件设置为所述升级后的虚拟机中的磁盘文件,其中,所述升级后的磁盘文件中记录了所述升级后的数据。
  10. 根据权利要求7所述的装置,其中,所述装置还包括:
    合并模块,设置为在所述使用所述升级后的模板磁盘文件更新所述虚拟机中的磁盘文件之后,将所述升级前的磁盘文件与上一次升级前的磁盘文件进行合并,其中,在所述使用所述升级后的模板磁盘文件更新所述虚拟机中的磁盘文件之前,所述虚拟机中的磁盘文件由所 述上一次升级前的磁盘文件升级到所述升级前的磁盘文件。
  11. 根据权利要求10所述的装置,其中,所述合并模块包括:
    判断单元,设置为判断所述升级前的磁盘文件与上一次升级前的磁盘文件之间是否为单一引用关系;
    合并单元,设置为在判断出为所述单一引用关系时,将所述升级前的磁盘文件与上一次升级前的磁盘文件进行合并。
  12. 根据权利要求8所述的装置,其中,所述第一转换单元还设置为在将所述升级前的虚拟机模板转换为目标虚拟机的过程中,创建叶子文件,其中,所述叶子文件作为叶子节点关联到作为父节点的所述升级前的虚拟机模板的模板磁盘文件;
    其中,转换得到的所述目标虚拟机运行在所述叶子文件上。
PCT/CN2016/103094 2015-11-06 2016-10-24 虚拟机升级方法及装置 WO2017076180A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201510753528.0A CN106681744A (zh) 2015-11-06 2015-11-06 虚拟机升级方法及装置
CN201510753528.0 2015-11-06

Publications (1)

Publication Number Publication Date
WO2017076180A1 true WO2017076180A1 (zh) 2017-05-11

Family

ID=58661633

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2016/103094 WO2017076180A1 (zh) 2015-11-06 2016-10-24 虚拟机升级方法及装置

Country Status (2)

Country Link
CN (1) CN106681744A (zh)
WO (1) WO2017076180A1 (zh)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109002343A (zh) * 2017-06-07 2018-12-14 中兴通讯股份有限公司 一种实现虚拟机批量创建的方法及装置

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102799464A (zh) * 2012-06-25 2012-11-28 北京奇虎科技有限公司 虚拟机创建方法及系统、虚拟机重装方法及系统
CN102880515A (zh) * 2012-09-07 2013-01-16 浪潮电子信息产业股份有限公司 一种云海os中虚拟机快速部署方法
CN102999369A (zh) * 2012-12-25 2013-03-27 杭州华三通信技术有限公司 虚拟机升级的方法及装置
CN104360892A (zh) * 2014-10-21 2015-02-18 普华基础软件股份有限公司 创建虚拟机的系统及方法
CN104486392A (zh) * 2014-12-05 2015-04-01 国云科技股份有限公司 一种低存储空间的虚拟机镜像打包方法
US20150128141A1 (en) * 2010-12-14 2015-05-07 Microsoft Technology Licensing, Llc Template virtual machines

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20150128141A1 (en) * 2010-12-14 2015-05-07 Microsoft Technology Licensing, Llc Template virtual machines
CN102799464A (zh) * 2012-06-25 2012-11-28 北京奇虎科技有限公司 虚拟机创建方法及系统、虚拟机重装方法及系统
CN102880515A (zh) * 2012-09-07 2013-01-16 浪潮电子信息产业股份有限公司 一种云海os中虚拟机快速部署方法
CN102999369A (zh) * 2012-12-25 2013-03-27 杭州华三通信技术有限公司 虚拟机升级的方法及装置
CN104360892A (zh) * 2014-10-21 2015-02-18 普华基础软件股份有限公司 创建虚拟机的系统及方法
CN104486392A (zh) * 2014-12-05 2015-04-01 国云科技股份有限公司 一种低存储空间的虚拟机镜像打包方法

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109002343A (zh) * 2017-06-07 2018-12-14 中兴通讯股份有限公司 一种实现虚拟机批量创建的方法及装置
CN109002343B (zh) * 2017-06-07 2023-08-25 中兴通讯股份有限公司 一种实现虚拟机批量创建的方法及装置

Also Published As

Publication number Publication date
CN106681744A (zh) 2017-05-17

Similar Documents

Publication Publication Date Title
US11741046B2 (en) Method and apparatus for creating system disk snapshot of virtual machine
US10185549B2 (en) Updating live system with static changes
CN102402446B (zh) 应用软件的安装方法和应用软件的安装装置
CN101650660B (zh) 从中央存储装置引导计算机系统
US8245217B2 (en) Management of software and operating system updates required for the process of creating a virtual machine facsimile of an existing physical or virtual machine
JP5705869B2 (ja) クラスタベースのjavaアプリケーションシステムのコードをロードおよび更新する装置および方法
CN107992355B (zh) 一种部署应用软件的方法、装置及虚拟机
US20130067449A1 (en) Application packages using block maps
CN104182255A (zh) 一种系统应用的库文件升级方法及终端
US10929149B2 (en) Method and system for updating firmware
EP1788493A1 (en) Detecting changes in data
CN110347483B (zh) 物理机到虚拟机迁移方法、装置及存储介质
JP2014510343A (ja) ライブラリーオペレーティングシステムによるアプリケーションの互換性
US8893272B2 (en) Method and device for recombining runtime instruction
CN102799464A (zh) 虚拟机创建方法及系统、虚拟机重装方法及系统
US20100332637A1 (en) Virtual-machine management program and method for managing virtual machines
WO2020238245A1 (zh) 实现函数跳转的方法、装置及计算机存储介质
CN107368353B (zh) 一种实现虚拟机内存热添加的方法和装置
CN104182257A (zh) 应用软件的安装方法和应用软件的安装装置
US20200403872A1 (en) Pod migration across nodes of a cluster
WO2019041891A1 (zh) 升级包的生成方法及装置
CN113760306A (zh) 安装软件的方法、装置、电子设备及存储介质
CN113296891B (zh) 基于平台的多场景知识图谱处理方法及装置
CN109271194B (zh) 基于分布式版本控制系统的分支访问方法和装置
WO2017076180A1 (zh) 虚拟机升级方法及装置

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 16861448

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 16861448

Country of ref document: EP

Kind code of ref document: A1