Bug 1278404

Summary: error "unsupported migration cookie feature memory-hotplug" is reported despite migration working
Product: Red Hat Enterprise Linux 7 Reporter: Peter Krempa <pkrempa>
Component: libvirtAssignee: Peter Krempa <pkrempa>
Status: CLOSED ERRATA QA Contact: Virtualization Bugs <virt-bugs>
Severity: low Docs Contact:
Priority: high    
Version: 7.2CC: dyuan, fjin, jsuchane, michal.skrivanek, mzhan, rbalakri, snagar, tlavigne, zpeng
Target Milestone: rcKeywords: ZStream
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: libvirt-1.3.1-1.el7 Doc Type: Bug Fix
Doc Text:
Cause: Improperly logged error message when migrating with memory hotplug enabled. Consequence: When migrating with memory hotplug enabled the destination host logged a spurious message saying "unsupported migration cookie feature memory-hotplug". This didn't break migration but in cases where the migration would fail for some other reason this would sidetrack from the real cause of the failure. Fix: The error message is suppressed by correctly parsing the migration cookie flags. Result:
Story Points: ---
Clone Of:
: 1280419 (view as bug list) Environment:
Last Closed: 2016-11-03 18:29:54 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:    
Bug Blocks: 1172230, 1280419    

Description Peter Krempa 2015-11-05 12:04:24 UTC
Description of problem:
Libvirt errorneously reports "unsupported migration cookie feature memory-hotplug" even when destination host actually supports it.

Version-Release number of selected component (if applicable):
Upstream 1.2.18, downstream 1.2.17-3.el7

How reproducible:
100%

Steps to Reproduce:
1. Migrate a guest with <maxMemory> set.
2. Look at destination log files.
3.

Actual results:
Migration succeeds, but bogus error is reported in the log file.

Comment 1 Peter Krempa 2015-11-05 12:09:54 UTC
In the migration cookie parser code, there are two checks :

    for (i = 0; i < n; i++) {
        int val;
        char *str = virXMLPropString(nodes[i], "name");
        if (!str) {
            virReportError(VIR_ERR_INTERNAL_ERROR,
                           "%s", _("missing feature name"));
            goto error;
        }

        if ((val = qemuMigrationCookieFlagTypeFromString(str)) < 0) {
            virReportError(VIR_ERR_INTERNAL_ERROR,
                           _("Unknown migration cookie feature %s"),
                           str);
            VIR_FREE(str);

This one produces the error message and rejects the migration in legitimate purposes in case where destination does not support it. (Prior to upstream commit 136f3de4112c75af0b38fc1946f44e3658ed1890).

            goto error;

This branch also correctly aborts the migration.
        }


What I missed while writing and testing the commit mentioned above is the following check:
        if ((flags & (1 << val)) == 0) {
            virReportError(VIR_ERR_INTERNAL_ERROR,
                           _("Unsupported migration cookie feature %s"),

Since the commit mentioned above didn't add the correct flag to 'flags' at the point where it's called, this error message get's always printed once the memory hotplug flag is parsed ...

                           str);
            VIR_FREE(str);

... but due to a missing 'goto error;' it's not actually rejected, but the error is logged.

        }
        VIR_FREE(str);
    }

Comment 3 Peter Krempa 2015-11-06 13:47:27 UTC
Upstream fix:

commit f59808b724f99d43d042600455f55428a88a1ad9
Author: Peter Krempa <pkrempa>
Date:   Thu Nov 5 15:20:21 2015 +0100

    qemu: migration: Properly parse memory hotplug migration flag
    
    Since the flag was not enabled when 'eating' the migration cookie,
    libvirt reported a bogus error when memory hotplug was enabled:
    
     unsupported migration cookie feature memory-hotplug
    
    The error was ignored though due to a bug in the code so it slipped
    through testing.
    
    Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1278404

Comment 4 zhe peng 2015-11-09 06:30:23 UTC
I can reproduce this with build libvirt-1.2.17-3.el7.x86_64

Comment 8 Fangge Jin 2016-08-17 10:00:56 UTC
I can reproduce on build libvirt-1.2.17-13.el7.x86_64

Verify pass on build libvirt-2.0.0-5.el7.x86_64

Steps:
1. Prepare a guest with maxmemory setting:
# virsh dumpxml rhel7
...
  <maxMemory slots='16' unit='KiB'>1524288</maxMemory>
...
  <cpu mode='custom' match='exact'>
    <model fallback='allow'>IvyBridge</model>
    <numa>
      <cell id='0' cpus='0-1' memory='512000' unit='KiB'/>
      <cell id='1' cpus='2-3' memory='512000' unit='KiB'/>
...

2. Start guest
3. Do migrate
4. Check libvirtd log on target, there is no such log:
internal error: Unsupported migration cookie feature memory-hotplug

Comment 10 errata-xmlrpc 2016-11-03 18:29:54 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://rhn.redhat.com/errata/RHSA-2016-2577.html