Bug 1183869
| Summary: | save-image-edit show the wrong xml when edit and cannot resume success if we edit success with passthrough model cpu | ||
|---|---|---|---|
| Product: | Red Hat Enterprise Linux 7 | Reporter: | Luyao Huang <lhuang> |
| Component: | libvirt | Assignee: | Michal Privoznik <mprivozn> |
| Status: | CLOSED ERRATA | QA Contact: | Virtualization Bugs <virt-bugs> |
| Severity: | medium | Docs Contact: | |
| Priority: | medium | ||
| Version: | 7.1 | CC: | dyuan, hliu, mzhan, rbalakri, zhwang |
| Target Milestone: | rc | Keywords: | Upstream |
| Target Release: | --- | ||
| Hardware: | x86_64 | ||
| OS: | All | ||
| Whiteboard: | |||
| Fixed In Version: | libvirt-1.2.13-1.el7 | Doc Type: | Bug Fix |
| Doc Text: | Story Points: | --- | |
| Clone Of: | Environment: | ||
| Last Closed: | 2015-11-19 06:08:18 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: | |||
Meet a issue like this bug, i guess maybe will be fix after this bug have been fixed: 1.prepare a vm have cpu settings like this: <cpu mode='host-passthrough'> </cpu> 2. # virsh start test3 Domain test3 started 3.# virsh dumpxml test3 > test3.xml 4.change disk path to /tmp/test3.img # vim test3.xml 5.# virsh save test3 test3.save --xml test3.xml Domain test3 saved to test3.save [root@lhuang ~]# virsh restore test3.save --xml test3.xml error: Failed to restore domain from test3.save error: unsupported configuration: Target CPU model <null> does not match source Opteron_G5 Patches proposed upstream: https://www.redhat.com/archives/libvir-list/2015-February/msg00687.html And moving to POST:
commit cf2d4c603c37a58c7c6cacc87f0e78b45903ae7c
Author: Michal Privoznik <mprivozn>
AuthorDate: Thu Feb 19 13:54:53 2015 +0100
Commit: Michal Privoznik <mprivozn>
CommitDate: Wed Feb 25 09:28:54 2015 +0100
qemu: Use correct flags for ABI stability check in SaveImageUpdateDef
https://bugzilla.redhat.com/show_bug.cgi?id=1183869
Soo. you've successfully started yourself a domain. And since you want
to use it on your host exclusively you are confident enough to
passthrough the host CPU model, like this:
<cpu mode='host-passthrough'/>
Then, after a while, you want to save the domain into a file (e.g.
virsh save dom dom.save). And here comes the trouble. The file consist
of two parts: Libvirt header (containing domain XML among other
things), and qemu migration data. Now, the domain XML in the header is
formatted using special flags (VIR_DOMAIN_XML_SECURE |
VIR_DOMAIN_XML_UPDATE_CPU | VIR_DOMAIN_XML_INACTIVE |
VIR_DOMAIN_XML_MIGRATABLE).
Then, on your way back from the bar, you think of changing something
in the XML in the saved file (we have a command for it after all), say
listen address for graphics console. So you successfully type in the
command:
virsh save-image-edit dom.save
Change all the bits, and exit the editor. But instead of success
you're left with sad error message:
error: unsupported configuration: Target CPU model <null> does not
match source Pentium Pro
Sigh. Digging into the code you see lines, where we check for ABI
stability. The new XML you've produced is compared with the old one
from the saved file to see if qemu ABI will break or not. Wait, what?
We are using different flags to parse the XML you've provided so we
were just lucky it worked in some cases? Yep, that's right.
Signed-off-by: Michal Privoznik <mprivozn>
commit c75f42f3318463b0555edac333c8f20d54b4d5dc
Author: Ján Tomko <jtomko>
AuthorDate: Fri Feb 27 11:55:40 2015 +0100
Commit: Ján Tomko <jtomko>
CommitDate: Fri Feb 27 12:01:31 2015 +0100
Really fix XML formatting flags in SaveImageUpdateDef
Commit cf2d4c6 used a logical or instead of bitwise or,
effectively passing 1, that is VIR_DOMAIN_XML_INACTIVE.
This was caught by a warning when building with clang.
https://bugzilla.redhat.com/show_bug.cgi?id=1183869
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index e9aa0b5..e282464 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -5734,7 +5734,7 @@ qemuDomainSaveImageUpdateDef(virQEMUDriverPtr driver,
if (!(newdef_migr = qemuDomainDefCopy(driver,
newdef,
- QEMU_DOMAIN_FORMAT_LIVE_FLAGS ||
+ QEMU_DOMAIN_FORMAT_LIVE_FLAGS |
VIR_DOMAIN_XML_MIGRATABLE)))
goto cleanup;
v1.2.13-rc2-6-gc75f42f
Verify this bug with libvirt-1.2.15-2.el7.x86_64:
1. a vm with host-passthrough cpu:
# virsh dumpxml test3
...
<cpu mode='host-passthrough'>
<numa>
<cell id='0' cpus='0' memory='512000' unit='KiB'/>
<cell id='1' cpus='1' memory='512000' unit='KiB'/>
</numa>
</cpu>
...
2. save it:
# virsh save test3 test3.save
Domain test3 saved to test3.save
3. use save-image-edit to change something:
# virsh save-image-dumpxml test3.save
<cpu mode='host-passthrough'>
<feature policy='require' name='bmi1'/>
<feature policy='require' name='perfctr_nb'/>
<feature policy='require' name='perfctr_core'/>
<feature policy='require' name='topoext'/>
<feature policy='require' name='nodeid_msr'/>
<feature policy='require' name='tce'/>
<feature policy='require' name='lwp'/>
<feature policy='require' name='wdt'/>
<feature policy='require' name='skinit'/>
<feature policy='require' name='ibs'/>
<feature policy='require' name='osvw'/>
<feature policy='require' name='cr8legacy'/>
<feature policy='require' name='extapic'/>
<feature policy='require' name='cmp_legacy'/>
<feature policy='require' name='fxsr_opt'/>
<feature policy='require' name='mmxext'/>
<feature policy='require' name='osxsave'/>
<feature policy='require' name='monitor'/>
<feature policy='require' name='ht'/>
<feature policy='require' name='vme'/>
<numa>
<cell id='0' cpus='0' memory='512000' unit='KiB'/>
<cell id='1' cpus='1' memory='512000' unit='KiB'/>
</numa>
</cpu>
# virsh save-image-edit test3.save
State file test3.save edited.
4. recheck the xml after edit the save file:
# virsh save-image-dumpxml test3.save
<cpu mode='host-passthrough'>
<feature policy='require' name='bmi1'/>
<feature policy='require' name='perfctr_nb'/>
<feature policy='require' name='perfctr_core'/>
<feature policy='require' name='topoext'/>
<feature policy='require' name='nodeid_msr'/>
<feature policy='require' name='tce'/>
<feature policy='require' name='lwp'/>
<feature policy='require' name='wdt'/>
<feature policy='require' name='skinit'/>
<feature policy='require' name='ibs'/>
<feature policy='require' name='osvw'/>
<feature policy='require' name='cr8legacy'/>
<feature policy='require' name='extapic'/>
<feature policy='require' name='cmp_legacy'/>
<feature policy='require' name='fxsr_opt'/>
<feature policy='require' name='mmxext'/>
<feature policy='require' name='osxsave'/>
<feature policy='require' name='monitor'/>
<feature policy='require' name='ht'/>
<feature policy='require' name='vme'/>
<numa>
<cell id='0' cpus='0' memory='512000' unit='KiB'/>
<cell id='1' cpus='1' memory='512000' unit='KiB'/>
</numa>
</cpu>
5. restore the guest and guest can start:
# virsh restore test3.save
Domain restored from test3.save
6. also test with --xml with save/restore works well
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-2202.html |
Description of problem: save-image-edit show the wrong xml when edit and cannot resume success if we edit success with passthrough model cpu Version-Release number of selected component (if applicable): libvirt-1.2.8-13.el7.x86_64 How reproducible: 100% Steps to Reproduce: Part 1: 1.prepare a running guest have passthrough cpu model # virsh dumpxml test3 <cpu mode='host-passthrough'> </cpu> 2.save it to a file # virsh save test3 test3.save Domain test3 saved to test3.save 3.use save-image-edit to edit the save file(just make a blank line in the last) # virsh save-image-edit test3.save error: unsupported configuration: Target CPU model <null> does not match source Opteron_G5 Failed. Try again? [y,n,f,?]: Part 2: 4.add cpu information when edit save file, and save will success <cpu mode='host-passthrough' match='minimum'> <model>Opteron_G5</model> <vendor>AMD</vendor> <feature policy='require' name='bmi1'/> <feature policy='require' name='perfctr_nb'/> <feature policy='require' name='perfctr_core'/> <feature policy='require' name='topoext'/> <feature policy='require' name='nodeid_msr'/> <feature policy='require' name='tce'/> <feature policy='require' name='lwp'/> <feature policy='require' name='wdt'/> <feature policy='require' name='skinit'/> <feature policy='require' name='ibs'/> <feature policy='require' name='osvw'/> <feature policy='require' name='cr8legacy'/> <feature policy='require' name='extapic'/> <feature policy='require' name='cmp_legacy'/> <feature policy='require' name='fxsr_opt'/> <feature policy='require' name='mmxext'/> <feature policy='require' name='osxsave'/> <feature policy='require' name='monitor'/> <feature policy='require' name='ht'/> <feature policy='require' name='vme'/> </cpu> # virsh save-image-edit test3.save State file test3.save edited. 5.but cannot restore the guest # virsh restore test3.save error: Failed to restore domain from test3.save error: invalid argument: no guest CPU model specified Actual results: in part 1 save-image-edit show the wrong xml when we edit it in part 2 cannot resume success if we edit success also found this issue with host model cpu: <cpu mode='host-model'> <model fallback='forbid'/> <topology sockets='1' cores='2' threads='1'/> </cpu> Expected results: part 1: show the correct xml part 2: guest can start success Additional info: About part 1 i checked the save file via vim and found: when we use save to create a save file and the xml in save file is: # vim test3.save <cpu mode='host-passthrough' match='minimum'> <model>Opteron_G5</model> <vendor>AMD</vendor> <feature policy='require' name='bmi1'/> <feature policy='require' name='perfctr_nb'/> <feature policy='require' name='perfctr_core'/> <feature policy='require' name='topoext'/> <feature policy='require' name='nodeid_msr'/> <feature policy='require' name='tce'/> <feature policy='require' name='lwp'/> <feature policy='require' name='wdt'/> <feature policy='require' name='skinit'/> <feature policy='require' name='ibs'/> <feature policy='require' name='osvw'/> <feature policy='require' name='cr8legacy'/> <feature policy='require' name='extapic'/> <feature policy='require' name='cmp_legacy'/> <feature policy='require' name='fxsr_opt'/> <feature policy='require' name='mmxext'/> <feature policy='require' name='osxsave'/> <feature policy='require' name='monitor'/> <feature policy='require' name='ht'/> <feature policy='require' name='vme'/> </cpu> but we cannot find them when we edit save file: # virsh save-image-edit test3.save <cpu mode='host-passthrough'> </cpu> So cause the source xml and target xml cpu model not the same and will forbid edit even we do not change anything (just add a blank line) in virDomainDefCheckABIStability. About part 2 if we add the cpu information in save file and edit will success, but the xml in save file will loss cpu information: # vim test3.save (after edit success) <cpu mode='host-passthrough'> </cpu> so guest will fail to start.