Opennebula Virtual Machine migration source code analysis

Source: Internet
Author: User

Opennebula supports Virtual Machine cold migration (migrate) and hot migration (live_migrate, also known as online migration ).CodeTo analyze the code execution path of Virtual Machine migration.

1. lifecycle of the action defined in opennebula

Opennebula represents different operations by defining multiple actions. At the same time, opennebula processes all actions through a unified framework. The entire process is called the lifecycle of an action, each operation on a virtual machine is composed of one or more actions. Therefore, the life cycle of an action can also be understood as the life cycle of a virtual machine.

Shows the lifecycle of actions.

For opennebula users, all operations on virtual machines are initiated through RPC requests (for those who are unfamiliar with RPC principles and mechanisms, see the previous sectionArticleOpennebula source code analysis-Analysis of XML-RPC Principle ), RPC
After the opennebula node receives the RPC request, the server performs the following operations:

(1) convert the RPC request to the action of the DM (dispatchmanager) class, And the DM class is responsible for dispatching the ation.

(2) DM class converts action into lcm (lifecyclemanager) class action. LCM class is responsible for setting the life state of virtual machines, such as pending, Prolog, Boot, running, failed status

(3) The LCM class converts the action to the virtualmachinemanager action of the vmm class. The vmm class is responsible for the actual operations related to the virtual machine, such as creation and deletion, the actual operation here refers to the operation executed through the virsh command

(4) The vmm class will log on to the physical machine through SSH and execute the virsh command to complete the request of the user represented by the action

Taking migrate as an example, let's take a look at the changes in the status of virtual machines throughout the migrate action lifecycle.

Running --> save_migrate --> pending --> Prolog --> boot --> running

First, only virtual machines in the running state can be migrated. Second, the current virtual machine must be saved before migration. Second, copy the saved virtual machine to the host to be migrated. Finally, it is the lifecycle of a virtual machine deployment operation!

2. migrate action-related Code Execution Process

3. libvirt-layer migration commands

(1) Cold migration:

Virsh migrate vm0 qemu + SSH: // 192.168.35 .. 16/System

Migrate a VM named vm0 to host 192.168.35.17 over SSH

(2) online migration:

Virsh migrate -- live vm0 qemu + SSH: // 192.168.35.16/System

SSH is used for data transmission. TCP can also be used, for example:

Virsh migrateVm0
Qemu + TCP: // 192.168.35 .. 16/System

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.