Bug 1283495

Summary: [DOC] Enhancing block/disk migration in libvirt
Product: Red Hat Enterprise Linux 7 Reporter: Laura Novich <lnovich>
Component: doc-Virtualization_Deployment_and_Administration_GuideAssignee: Jiri Herrmann <jherrman>
Status: CLOSED CURRENTRELEASE QA Contact:
Severity: low Docs Contact:
Priority: medium    
Version: 7.2CC: dyuan, gfa, jhradile, j.rosenboom, kchamart, matthew.gilliard, mprivozn, mzhan, pboldin, rbalakri, redhat-bugzilla, rhel-docs, tony, xuzhang, zpeng
Target Milestone: rcKeywords: Documentation
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: 1203032 Environment:
Last Closed: 2016-11-08 17:14:27 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 1203032    
Bug Blocks: 1204040, 1210352    

Description Laura Novich 2015-11-19 07:32:18 UTC
+++this bug also should be based on https://bugzilla.redhat.com/show_bug.cgi?id=1210352 +++
+++ This bug was initially created as a clone of Bug #1203032 +++

This is more a feature request than bug.  As libvirt is working it's just that users would benefit from this support.

Here is some context form the openstack world (which at least some of you are
aware of).  There are at least 2 open bug against openstack (nova) in the area
of block/disk migration.

1) Live migration fails when the instance has a config-drive[1]
   Here openstack(nova) fails because a drive that nova expects to be migrated
   isn't migrated.

2) libvirt live_snapshot periodically explodes on libvirt 1.2.2 in the gate[2]
   Here openstack(nova) fails because a drive that nova expects NOT to be
   migrated is migrated.

To me these are essentially the same bug/issue.  There is no way to communicate with
libvirt the users expectations around block/disk mirgration.


The suggestions from the mailing list are to enhance virDomainMigrate3 to take a list of devices to migrate.

[1] https://bugs.launchpad.net/nova/+bug/1246201
[2] https://bugs.launchpad.net/nova/+bug/1334398

--- Additional comment from Tony Breeds on 2015-03-17 20:31:18 EDT ---

I'm very happy to do this work (so I assigned it to me).

I just need to free up the time.

--- Additional comment from Pavel Boldin on 2015-03-23 11:56:24 EDT ---

Hi there,

I want to take part in this as well.

I have a time so if there is any progress I had like to take a look at it.

--- Additional comment from Tony Breeds on 2015-03-23 20:50:01 EDT ---

I don't even have the beginnings of an implementation.  I was still in the code review process when my priorities changed.

If you have the time please feel free to do this work.

I'd be very happy to help and test what you produce.

--- Additional comment from Kashyap Chamarthy on 2015-03-24 07:09:44 EDT ---

[Assigning this bug back to libvirt-maint as it can come up in triage lists.]

--- Additional comment from Pavel Boldin on 2015-04-22 09:37:00 EDT ---

I have started working on the discussed implementation but the code needs some testing before it can be send to the upstream.

Here are the preliminary patches:
https://github.com/paboldin/libvirt/commits/master
https://github.com/paboldin/libvirt-python/commits/master

--- Additional comment from Michal Privoznik on 2015-04-27 01:38:56 EDT ---



--- Additional comment from Michal Privoznik on 2015-05-06 09:00:39 EDT ---

(In reply to Pavel Boldin from comment #5)
> I have started working on the discussed implementation but the code needs
> some testing before it can be send to the upstream.
> 
> Here are the preliminary patches:
> https://github.com/paboldin/libvirt/commits/master
> https://github.com/paboldin/libvirt-python/commits/master

Pavel, can you please post the patches upstream? That's where all the development takes place.

--- Additional comment from Pavel Boldin on 2015-05-13 18:15:09 EDT ---

(In reply to Michal Privoznik from comment #7)
> 
> Pavel, can you please post the patches upstream? That's where all the
> development takes place.

Done. Please review https://www.redhat.com/archives/libvir-list/2015-May/msg00345.html

--- Additional comment from Pavel Boldin on 2015-05-22 08:39:09 EDT ---

Please review re-roll: https://www.redhat.com/archives/libvir-list/2015-May/msg00697.html

--- Additional comment from Michal Privoznik on 2015-05-26 09:07:20 EDT ---

v3:

https://www.redhat.com/archives/libvir-list/2015-May/msg00955.html

--- Additional comment from Michal Privoznik on 2015-06-18 10:59:40 EDT ---

And the patches were jus pushed upstream:

commit a4e92f9e14d0a81ceaa2bc8d0c423522fb455184
Author:     Pavel Boldin <pboldin>
AuthorDate: Tue Jun 16 01:42:11 2015 +0300
Commit:     Michal Privoznik <mprivozn>
CommitDate: Thu Jun 18 16:46:09 2015 +0200

    virsh: selective block device migration
    
    Add `virsh migrate' option `--migrate-disks' that allows CLI user to
    explicitly specify block devices to migrate.
    
    Signed-off-by: Pavel Boldin <pboldin>
    Signed-off-by: Michal Privoznik <mprivozn>

commit 93a19e283e5a147d147d84383aaaa8be63b6a68d
Author:     Pavel Boldin <pboldin>
AuthorDate: Tue Jun 16 01:42:10 2015 +0300
Commit:     Michal Privoznik <mprivozn>
CommitDate: Thu Jun 18 16:46:09 2015 +0200

    qemu: migration: selective block device migration
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1203032
    
    Implement a `migrate_disks' parameters for the QEMU driver. This multi-
    value parameter can be used to explicitly specify what block devices
    are to be migrated using the NBD server. Tunnelled migration using NBD
    is to be done.
    
    Signed-off-by: Pavel Boldin <pboldin>
    Signed-off-by: Michal Privoznik <mprivozn>

commit 5eb03b6ea07d6e9178f5b8510681ea9ec9ca422f
Author:     Pavel Boldin <pboldin>
AuthorDate: Tue Jun 16 01:42:09 2015 +0300
Commit:     Michal Privoznik <mprivozn>
CommitDate: Thu Jun 18 16:46:09 2015 +0200

    util: add virTypedParamsAddStringList
    
    The `virTypedParamsAddStringList' function provides interface to add a
    NULL-terminated array of string values as a multi-value to the params.
    
    Signed-off-by: Pavel Boldin <pboldin>
    Signed-off-by: Michal Privoznik <mprivozn>

commit 952907f5401512013a1296d7888b1217abecff76
Author:     Pavel Boldin <pboldin>
AuthorDate: Tue Jun 16 01:42:08 2015 +0300
Commit:     Michal Privoznik <mprivozn>
CommitDate: Thu Jun 18 16:46:09 2015 +0200

    util: virTypedParams{Filter,GetStringList}
    
    Add multikey API:
    
     * virTypedParamsFilter that filters all the parameters with specified name.
     * virTypedParamsGetStringList that returns a list with all the values for
       specified name and string type.
    
    Signed-off-by: Pavel Boldin <pboldin>
    Signed-off-by: Michal Privoznik <mprivozn>

commit e9ef8565205bdb1438c9a5e40a3d54e29f562b4e
Author:     Pavel Boldin <pboldin>
AuthorDate: Tue Jun 16 01:42:07 2015 +0300
Commit:     Michal Privoznik <mprivozn>
CommitDate: Thu Jun 18 16:46:09 2015 +0200

    util: multi-value parameters in virTypedParamsAdd*
    
    Allow multi-value parameters to be build using virTypedParamsAdd*
    functions by removing check for duplicates.
    
    Signed-off-by: Pavel Boldin <pboldin>
    Signed-off-by: Michal Privoznik <mprivozn>

commit a5250449de8d570992744f309fefaaaa6f8212cd
Author:     Pavel Boldin <pboldin>
AuthorDate: Tue Jun 16 01:42:06 2015 +0300
Commit:     Michal Privoznik <mprivozn>
CommitDate: Thu Jun 18 16:46:09 2015 +0200

    util: multi-value virTypedParameter
    
    The `virTypedParamsValidate' function now can be instructed to allow
    multiple entries for some of the keys. For this flag the type with
    the `VIR_TYPED_PARAM_MULTIPLE' flag.
    
    Add unit tests for this new behaviour.
    
    Signed-off-by: Pavel Boldin <pboldin>
    Signed-off-by: Michal Privoznik <mprivozn>

commit cb7297c150639e9f70e414f3a82d1cde9fa3d9d6
Author:     Michal Privoznik <mprivozn>
AuthorDate: Tue Jun 16 01:42:05 2015 +0300
Commit:     Michal Privoznik <mprivozn>
CommitDate: Thu Jun 18 16:46:09 2015 +0200

    qemuMigrationDriveMirror: Force raw format for NBD
    
    When playing with disk migration lately, I've noticed this warning in
    domain logs:
    
    WARNING: Image format was not specified for 'nbd://masina:49153/drive-virtio-disk0' and probing guessed raw.
             Automatically detecting the format is dangerous for raw images, write operations on block 0 will be restricted.
             Specify the 'raw' format explicitly to remove the restrictions.
    
    So I started digging into qemu source code to see what has triggered
    the warning. I'd expect qemu to know formats of guest's disks since we
    tell them on command line. This lead me to qmp_drive_mirror() where
    the following can be found:
    
        if (!has_format) {
            format = mode == NEW_IMAGE_MODE_EXISTING ? NULL : bs->drv->format_name;
        }
    
    So, format is automatically initialized from the disk iff mode !=
    "existing". Unfortunately, in migration we are tied to use this mode
    (NBD doesn't support creating new images). Therefore the only way to
    avoid this warning is to pass format. The discussion on the mail-list [1]
    resulted in the code that always forces NBD export as "raw" format.
    
    [1] https://www.redhat.com/archives/libvir-list/2015-June/msg00153.html
    Signed-off-by: Michal Privoznik <mprivozn>
    Signed-off-by: Pavel Boldin <pboldin>

commit 9c5efd1afd49a57c4d17fc9245995fc4e1e6f653
Author:     Michal Privoznik <mprivozn>
AuthorDate: Tue Jun 16 01:42:04 2015 +0300
Commit:     Michal Privoznik <mprivozn>
CommitDate: Thu Jun 18 16:46:09 2015 +0200

    qemuMigrationBeginPhase: Fix function header indentation
    
    This function is returning a string (domain XML). Since d3ce7363
    when it was first introduced, it was indented incorrectly:
    
    static char
    *qemuMigrationBeginPhase(..)
    
    Signed-off-by: Michal Privoznik <mprivozn>

commit 1049a8d8b4fa3efb63cfd39ae924f5ada3338115
Author:     Michal Privoznik <mprivozn>
AuthorDate: Tue Jun 16 01:42:03 2015 +0300
Commit:     Michal Privoznik <mprivozn>
CommitDate: Thu Jun 18 16:46:09 2015 +0200

    virDomainDiskGetSource: Mark passed disk as 'const'
    
    The disk is not changed anywhere in the function. Mark this fact
    in the function header too.
    
    Signed-off-by: Michal Privoznik <mprivozn>


v1.2.16-234-ga4e92f9