mirror of
https://github.com/retspen/webvirtcloud
synced 2026-11-10 04:06:47 +00:00
fix(instances): internal snapshots no longer rewrite UEFI loaders
Taking or reverting an internal snapshot redefined a pflash VM with a rom loader around the operation. libvirt 10.10 rejects that definition, so the request ended in a 500; where it was accepted, the snapshot recorded the fake loader, and a failure between rewrite and restore left the VM unable to boot. The definition is no longer touched: libvirt decides, and its error is shown (for a running VM with raw NVRAM: 'internal snapshots of a VM with pflash based firmware require QCOW2 nvram format'). A stopped VM's disk-only internal snapshot is taken, as libvirt allows it. Revert errors are shown too. The external snapshot path keeps its rewrite for now. Live tests cover running and stopped UEFI VMs; both failed with a 500 on the previous code.
This commit is contained in:
parent
3e427a41b8
commit
21f0777e76
4 changed files with 71 additions and 31 deletions
|
|
@ -1367,15 +1367,12 @@ class wvmInstance(wvmConnect):
|
|||
state,
|
||||
time.time(),
|
||||
)
|
||||
changed = self.change_snapshot_xml()
|
||||
try:
|
||||
xml += self._XMLDesc(VIR_DOMAIN_XML_SECURE)
|
||||
xml += """<active>0</active>
|
||||
</domainsnapshot>"""
|
||||
self._snapshotCreateXML(xml, 0)
|
||||
finally:
|
||||
if changed:
|
||||
self.recover_snapshot_xml()
|
||||
# libvirt decides whether this firmware/NVRAM supports internal
|
||||
# snapshots; the domain definition is never rewritten for it (R-13).
|
||||
xml += self._XMLDesc(VIR_DOMAIN_XML_SECURE)
|
||||
xml += """<active>0</active>
|
||||
</domainsnapshot>"""
|
||||
self._snapshotCreateXML(xml, 0)
|
||||
|
||||
def change_snapshot_xml(self):
|
||||
try:
|
||||
|
|
@ -1508,13 +1505,8 @@ class wvmInstance(wvmConnect):
|
|||
snap.delete(0)
|
||||
|
||||
def snapshot_revert(self, snapshot):
|
||||
changed = self.change_snapshot_xml()
|
||||
try:
|
||||
snap = self.instance.snapshotLookupByName(snapshot, 0)
|
||||
self.instance.revertToSnapshot(snap, 0)
|
||||
finally:
|
||||
if changed:
|
||||
self.recover_snapshot_xml()
|
||||
snap = self.instance.snapshotLookupByName(snapshot, 0)
|
||||
self.instance.revertToSnapshot(snap, 0)
|
||||
|
||||
def get_managed_save_image(self):
|
||||
return self.instance.hasManagedSaveImage(0)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue