Bug 1180521

Summary: Domain restore fails from a saved state in a file with xml option.
Product: Red Hat Enterprise Linux 6 Reporter: Jan Kurik <jkurik>
Component: libvirtAssignee: Ján Tomko <jtomko>
Status: CLOSED ERRATA QA Contact: Virtualization Bugs <virt-bugs>
Severity: medium Docs Contact:
Priority: medium    
Version: 6.3CC: acathrow, cwei, dallan, dyuan, gsun, jdenemar, jsuchane, jtomko, leiwan, lhuang, michal.skrivanek, mzhan, pkrempa, pm-eus, rbalakri, rhodain, shyu, zhwang
Target Milestone: rcKeywords: Reopened, Upstream, ZStream
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: libvirt-0.10.2-46.el6_6.3 Doc Type: Bug Fix
Doc Text:
Cause: Libvirtd converted the user-specified domain XML to migratable form before comparing it against the domain XML stored in the save file, but for external snapshots, non-migratable XML was stored in the save file. Consequence: Restore from an external snapshot with user-specified XML was impossible, because it failed the ABI stability check. Fix: Use migratable XML in save files for external snapshots as well to fix this for new saves. Do the ABI stability check against the user-specified XML directly if it fails against the migratable form, to allow restoring saves from older libvirt. Result: Restore works with XML in both migratable and non-migratable form.
Story Points: ---
Clone Of: 834196 Environment:
Last Closed: 2015-01-30 21:13:38 UTC Type: ---
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: 834196    
Bug Blocks:    

Description Jan Kurik 2015-01-09 10:52:09 UTC
This bug has been copied from bug #834196 and has been proposed
to be backported to 6.6 z-stream (EUS).

Comment 5 Luyao Huang 2015-01-28 07:58:45 UTC
I can reproduce this issue with libvirt-0.10.2-46.el6.x86_64:

1. # virsh dumpxml r6
    <controller type='usb' index='0'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
    </controller>
    <controller type='ccid' index='0'/>

2. # virsh start r6

3.# virsh dumpxml r6 > r6.xml
4.# virsh dumpxml r6 --migratable > r6mig.xml

5.edit r6.xml and r6mig.xml and change disk path to /tmp/r6.img
# vim r6mig.xml
# vim r6.xml

6.# virsh save r6 r6.save --xml r6.xml

Domain r6 saved to r6.save

7. check the r6.save if the disk path have been changed:

# vim r6.save

8. restore vm and will failed with r6.xml:

# virsh restore r6.save --xml r6.xml
error: Failed to restore domain from r6.save
error: unsupported configuration: Target controller type usb does not match source ccid

# virsh restore r6.save --xml r6mig.xml
Domain restored from r6.save

And verify this issue with libvirt-0.10.2-46.el6_6.3.x86_64:

1. update libvirt to libvirt-0.10.2-46.el6_6.3.x86_64 and use old save file test:
# yum update libvirt*

2.# virsh restore r6.save --xml r6.xml
Domain restored from r6.save

3.# virsh destroy r6
Domain r6 destroyed

4.# virsh restore r6.save --xml r6mig.xml
Domain restored from r6.save

5. retest with the reproduce steps:

# virsh start r6

# virsh dumpxml r6 > r6.xml
# virsh dumpxml r6 --migratable > r6mig.xml

6.edit r6.xml and r6mig.xml and change disk path to /tmp/r6.img
# vim r6mig.xml
# vim r6.xml

7.save 
# virsh save r6 r6.save --xml r6.xml
Domain r6 saved to r6.save

8.restore
# virsh restore r6.save --xml r6.xml
Domain restored from r6.save

# virsh destroy r6
Domain r6 destroyed

# virsh restore r6.save --xml r6mig.xml
Domain restored from r6.save

And also test with snapshot (although we do not support it).

But i found this cannot work when vm use:
  <cpu mode='host-passthrough'>
  </cpu>

# virsh dumpxml r6 > r6.xml
# vim r6.xml (change path to /tmp/r6)
# virsh save r6 r6.save --xml r6.xml

Domain r6 saved to r6.save

# virsh restore r6.save --xml r6.xml
error: Failed to restore domain from r6.save
error: unsupported configuration: Target CPU model (null) does not match source SandyBridge

And also found this issue with rhel7.1 (and i think maybe the same with bug 1183869)

Comment 6 Luyao Huang 2015-01-28 08:03:13 UTC
Hi Jan,

Would you please help me to checkout if steps in comment 5 is ok to verify this bug? and is the last issue i met is a issue need fix in rhel6? 

Thanks in advance for your answer.

Comment 7 Ján Tomko 2015-01-28 17:59:39 UTC
The verification steps are correct.

I don't think restore with XML that wasn't generated with --migratable or --update-cpu is worth fixing in RHEL 6.

Comment 8 Luyao Huang 2015-01-29 00:35:27 UTC
(In reply to Jan Tomko from comment #7)
> The verification steps are correct.
> 
> I don't think restore with XML that wasn't generated with --migratable or
> --update-cpu is worth fixing in RHEL 6.

Thanks for your reply and verify this bug with comment 5

Comment 10 errata-xmlrpc 2015-01-30 21:13:38 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/RHBA-2015-0106.html