Bug 1273686 - libvirt do not check the if the serial type is changed during migrate/save
libvirt do not check the if the serial type is changed during migrate/save
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: libvirt (Show other bugs)
7.2
x86_64 Linux
low Severity low
: rc
: ---
Assigned To: Jiri Denemark
Virtualization Bugs
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2015-10-20 22:39 EDT by Luyao Huang
Modified: 2016-11-03 14:28 EDT (History)
6 users (show)

See Also:
Fixed In Version: libvirt-1.3.1-1.el7
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2016-11-03 14:28:25 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Luyao Huang 2015-10-20 22:39:30 EDT
Description of problem:
libvirt do not check the if the serial type is changed during migrate/save, if we change them will cause migrate or save/restore failed, and as we know libvirt have function like *CheckABIStability to avoid this

Version-Release number of selected component (if applicable):
libvirt-1.2.17-13.el7.x86_64

How reproducible:
100%

Steps to Reproduce:
1. prepare a running guest use isa-serial

# virsh dumpxml rhel7.0-rhel 
    <serial type='pty'>
      <source path='/dev/pts/1'/>
      <target type='isa-serial' port='1'/>
      <alias name='serial0'/>
    </serial>
    <console type='pty'>
      <source path='/dev/pts/1'/>
      <target type='serial' port='1'/>
      <alias name='serial0'/>
    </console>


2. save this guest to a file:

# virsh save rhel7.0-rhel r7.save

Domain rhel7.0-rhel saved to r7.save

3. edit the save file:

    <serial type='pty'>
      <target type='isa-serial' port='1'/>
    </serial>

change to:

    <serial type='pty'>
      <target type='pci-serial' port='1'/>
    </serial>


# virsh save-image-edit r7.save
State file r7.save edited.

# virsh save-image-dumpxml r7.save |grep serial
    <controller type='virtio-serial' index='0'>
    <serial type='pty'>
      <target type='pci-serial' port='1'/>
    </serial>
      <target type='serial' port='1'/>
      <address type='virtio-serial' controller='0' bus='0' port='2'/>

4. restore the guest:

# virsh restore r7.save
error: Failed to restore domain from r7.save
error: internal error: early end of file from monitor: possible problem:
2015-10-21T02:33:18.134054Z qemu-kvm: Unknown savevm section or instance 'serial' 0
2015-10-21T02:33:18.134166Z qemu-kvm: load of migration failed: Invalid argument


Actual results:

libvirt not check if he serial type is changed during migrate/save

Expected results:

this will cause qemu cannot restore with new save file

Additional info:


test with other chr device:

change 
    <console type='pty'>
      <target type='serial' port='1'/>
    </console>
to
    <console type='pty'>
      <target type='virtio' port='1'/>
    </console>

# virsh save-image-edit r7.save
error: unsupported configuration: Target console type virtio does not match source serial
Failed. Try again? [y,n,f,?]:
Comment 1 Luyao Huang 2015-10-21 05:26:15 EDT
Send a patch to upstream:

https://www.redhat.com/archives/libvir-list/2015-October/msg00667.html
Comment 2 Peter Krempa 2015-10-27 08:22:38 EDT
commit a98145e7c9f023b0253e91dd41d3484b95e51bc4
Author: Luyao Huang <lhuang@redhat.com>
Date:   Wed Oct 21 15:14:03 2015 +0800

    conf: Add serial target type to ABI stability check
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1273686
    
    There is no ABI check for serial target type attribute, just
    add it.

v1.2.20-140-ga98145e
Comment 4 zhenfeng wang 2016-03-01 01:24:12 EST
Verify this bug with libvirt-1.3.1-1.el7, steps as following 
1.prepare a running guest use isa-serial

# virsh dumpxml rhel74
    <serial type='pty'>
      <source path='/dev/pts/1'/>
      <target type='isa-serial' port='1'/>
      <alias name='serial0'/>
    </serial>
    <console type='pty'>
      <source path='/dev/pts/1'/>
      <target type='serial' port='1'/>
      <alias name='serial0'/>
    </console>

2.Dumpxml the guest's xml to local file
#virsh dumpxml rhel74 >rhel74.xml

3.Save the guest to a save file
#virsh save rhel74 7r.save

4.edit the save file:

    <serial type='pty'>
      <target type='isa-serial' port='1'/>
    </serial>

change to:

    <serial type='pty'>
      <target type='pci-serial' port='1'/>
    </serial>

will get the expect error
# virsh save-image-edit 7r.save
error: unsupported configuration:Target serial type pci-serial does not match source isa-serial
Failed. Try again? [y,n,f,?]:

5.edit the guest's xml
    <serial type='pty'>
      <target type='isa-serial' port='1'/>
    </serial>

change to:

    <serial type='pty'>
      <target type='pci-serial' port='1'/>
    </serial>

6.Restore guest with the modified xml, will get the expect error
# virsh restore 7r.save --xml rhel74.xml 
error: Failed to restore domain from 7r.save
error: unsupported configuration:Target serial type pci-serial does not match source isa-serial

7.Prepare a migration env, then migrate the guest with specify the upper modified xml, will get the following error
# virsh migrate --live rhel74  qemu+ssh://$dest_ip/system --verbose --xml rhel74.xml  --unsafe
root@$dest_ip's password: 
error: unsupported configuration: Target serial type pci-serial does not match source isa-serial
Comment 5 zhe peng 2016-04-13 01:54:43 EDT
Per comment 4 , move to verified.
Comment 7 errata-xmlrpc 2016-11-03 14:28:25 EDT
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

Note You need to log in before you can comment on or make changes to this bug.