I think it would be beneficial to add local disk migration feature for ‘blkback' backend since it is one of the mostly used backends. I would like to start a discussion about the design of the machinery needed to achieve this feature.
===========================
Objective
Add a feature to migrate VMs that have local storage and use the blkback iface.
===========================
===========================
User Interface
Add a cmd line option in “xl migrate” command to specify if local disks need to be copied to the destination node.
===========================
===========================
Design
- As part of the libxl_domain_suspend, the “disk mirroring machinery” starts an asynchronous job that copies the disks blocks from source to the destination.
- The protocol to copy the disks should resemble the one used for memory copy:
- Do first initial copy of the disk.
- Check of sectors that have been written since copy started. For this, the blkback driver should be aware that migration of disk is happening and in this case forward the write request to the “migration machinery” so that a record of dirty blocks are logged.
- Migration machinery copies “dirty” blocks until convergence.
- Duplicate all the disk writes/reads to both disks in source and destinations node while VM is being suspended.
Block Diagram
+—------+
| VM |
+-------+
|
| I/O Write
|
V
+----------+ +-----------+ +-------------+
| blkback | ----> | Source | sectors Stream | Destination |
+----------+ | mirror |------------------>| mirror |
| | machinery | I/O Writes | machinery |
| +-----------+ +-------------+
| |
| |
| To I/O block layer |
| |
V V
+----------+ +-------------+
| disk | | Mirrored |
+----------+ | Disk |
+-------------+
======================
Initial Questions
- Is it possible to leverage the current design of QEMU for drive mirroring for Xen?
- What is the best place to implement this protocol? As part of Xen or the kernel?
- Is it possible to use the same stream currently used for migrating the memory to also migrate the disk blocks?
Any guidance/feedback for a more specific design is greatly appreciated.
Thanks,
Bruno